I’m a huge proponent of .NET Micro Framework — by running the .NET VM on bare metal, application developers can write managed-language applications targeting embedded devices that are typically programmed in C/C++. With .NET MF, your embedded projects can use the same sorts of features you’re used to when writing desktop applications — like Events, Threads, Collections, Exceptions, and Visual Studio’s awesome debugging engine.
There are two components of the .NET Micro Framework ecosystem: the managed application, that you, the user, write in C#. And the firmware running on the actual processor, which is written in C/C++. The firmware provides the VM, as well as hardware services, like UART/SPI/I2C interfaces, GPIO, PWM pins, LCD interfacing, etc. The firmware code is fixed to the actual “target” — the particular hardware you’re using; this firmware source code only needs to be deployed once to the target; once it is on the target, the rest of the development is done in the managed language. This allows end users to develop embedded systems applications without having to write low-level C/C++ code (or have to buy all the associated software toolchains and debuggers to set up that sort of system). All these users need is a copy of Visual Studio (.NET MF supports the free Express Edition).
We’ve been using the GHI .NET Gadgeteer platform to prototype a WSN project we’re working on in the lab, and it has been, by far, the least-stressful embedded project I’ve ever worked on. We’re using the FEZ Cerberus ($29) and FEZ Hydra ($79) — both of which are a great value, and offer a lot of connectivity. I strongly recommend either board for anyone started out in embedded design.
However, for the best bang-for-your buck, nothing beats the STM32F4 Discovery boards, which have an on-board ST-Link JTAG debugger, an accelerometer, RGB LED, and an audio codec. At less than $15, ST is basically giving them away.
Wouldn’t it be great if you could put .NET Micro Framework on the STM32F4 Discovery?
The only difference between the two is the 8 MHz crystal on the Discovery and the 12 MHz crystal on the FEZ Cerberus. So, all we need to do is update the firmware; specifically, change line 78 of FEZ Cerberus’s platform_selector.h file from:
#define SYSTEM_CRYSTAL_CLOCK_HZ 12000000 // 12MHz external clock
#define SYSTEM_CRYSTAL_CLOCK_HZ 8000000 // 8MHz external clock
Unfortunately, getting the source code *compiled* is an entirely different story. You’ll need a copy of MDK to be able to compile the firmware, and it’s not cheap — more than $4000.
We have a copy of MDK, so I’ve taken the time to recompile the FEZ Cerberus firmware to target the Discovery board. Here is a ZIP archive with the files needed: http://mc2.unl.edu/uploads/discoveryCerberus.zip
You’ll need to use the ST-LINK utility to erase the chip and flash it with tinybooter.hex. Once this is done, reboot the board and install the GHI WinUSB drivers. This should provide a .NET MF Debugging interface. Now, use MFDeploy (it’s a tool found in the .NET MF SDK) to deploy the two files in tinyclr.hex — ER_CONFIG and ER_FLASH.
After that, you should be good to go!