Did you ever want to use C# and Visual Studio for programming a modern microcontroller? Swiss-based Oberon Microsystems Inc. has contributed its port of Microsoft's .NET Micro Framework (NETMF) to the open source community, under the same license as NETMF itself (Apache 2.0). It targets the STM32 microcontroller family, which is based on the ARM Cortex-M3 architecture.
The .NET Micro Framework (NETMF) is an implementation of.NET specifically for microcontrollers. It allows writing embedded software in C#, using Microsoft’s Visual Studio tools. NETMF is able to run directly on the hardware, without underlying operating system (it is a "bootable .NET runtime").
The .NET Micro Framework is governed by the Apache 2.0 open source license: there are no "target royalties", you may develop commercial software without being required to pass on your own improvements, and adaptations to new hardware are possible anytime.
There have been NETMF ports to various ARM7 and ARM9 cores for some time now. An ARM core is a specific implementation of an ARM architec-ture, where there may exist multiple cores for the same architecture. Confusingly, an ARM7 core implements the ARMv3, ARMv4, or ARMv5 architecture. An ARM9 core implements the ARMv4 or ARMv5 architecture. Cores that implement the current ARMv7M architecture have a more intuitive naming scheme. They are called Cortex-M, with a suffix that indicates the relative performance and functionality.
Oberon has ported NETMF to the Cortex-M3 core. This task involved mainly the core initializations: interrupts, reset, error handling, etc. . STMicroelectronics is one of several ARM licensees that have built products around the Cortex-M3 core and there are over 170 different STM32 variations. Oberon has ported NETMF to the STM32F103 family. This involved writing drivers for the on-chip peripherals: GPIOs, analog inputs and outputs, I2C, SPI, UARTs, USB, internal flash, power management, and timers.
One specific example is the STM32F103RE, which has 512 KB of flash and 64 KB of RAM in a 64 pin package that measures 10 by 10 millimeter. The flash and RAM are sufficient to run the .NET Micro Framework plus a small application, even without attaching additional external memory chips (which is possible with some other family members).
One product containing an STM32F103 is the MCBSTM32E evaluation kit from Keil and Oberon has ported NETMF to this board. This involved writing drivers for the external flash (8 MB) and the external RAM (1 MB). There is no support for the board’s LCD display.
The ET-STM32-Stamp from Futurlec is board which contains another STM32F103 model. Oberon has ported NETMF to this board. This involved using the boot loader built into the STM32 chips, instead of using the normal NETMF boot loaders. This saves memory – the board has no additional external memory.
Oberon says it is possible to adapt one of the above board ports to any other board with the STM32F103. Depending on your experience and knowledge of NETMF and the C/C++ tool chain that you use, this may take from less than one day to several weeks. Additional work may be required depending on what additional hardware the board provides. For example, if the board has a GSM module, then a driver for this module must be developed.
The board shown below uses an STM32F103RE microcontroller and NET-MF for STM32. It was custom-designed for Phonak (aka Unitron), the world’s largest provider of hearing aids. The board helps the Phonak engineers to test new hearing aids. It allows switching between several pairs of attached hearing aids. This switching is controlled by a PC via USB.
For the PC, Oberon provided a .NET library that sends control commands to the board. In this way, it was able to use .NET, C# and Visual Studio both for the PC application and for the embedded software, eliminating the need for special-purpose embedded tools.
The company has contributed the port(s) described above to the open source community. The source code, governed by the Apache 2.0 license, has been integrated into Microsoft's NETMF Porting Kit. You can download the source code
from the download section of Codeplex.
Oberon can provide technical support exclusively within customer projects and says if you find any issues with the code, the issue tracker
on Codeplex should be used to report them.
Oberon Microsystems AG
If you found this article to be of interest, visit the Micocontroller Designline
where you will find links to relevant technical articles, blogs, new products and news.
You can also get a weekly newsletter highlighting the latest developments in this sector - just Click Here
to request this newsletter using the Manage Newsletters tab - if you aren't already a member you'll be asked to register.