DEV Community

Cover image for #JulyOT - 1st July: Getting started with nanoFramework!
Jim Bennett for Microsoft Azure

Posted on • Originally published at julyot.dev on

#JulyOT - 1st July: Getting started with nanoFramework!

What we have for you today

Getting started with nanoFramework

.NET nanoFramework: Our mantra is about making it easy to write C# code for embedded systems! And all that we're doing here is about that. This free and Open Source platform enables the writing of managed code applications for constrained embedded devices. As a developer, you can use your powerful and familiar tools like Microsoft Visual Studio IDE and your .NET C# skills to write code on a microcontroller.

.NET nanoFramework supports a large variety of Micro Controller Units (MCU): STM32, ESP32, TI, and NXP. The .NET nanoFramework provides access to low-level IO and protocols, as well as networking and advanced security features allowing connection to the Cloud.

Here you'll find all the tools, examples, documentation and a great developer ecosystem to help you on your next embedded systems project.

New : Adoption of .NET nanoFramework is growing fast. It just reached 2 million NuGet downloads, it took 5 years to reach the first million and only 9 months for the second one! Read more about it here

To get started, you can use our step by step guide containing as well short videos.

You'll go through the installation of the Visual Studio extension:

step by step

Then installing nanoff, the tool to flash your device, and flashing your device:

install and flash nanoff

And then coding your first hello .NET nanoFramework application and setting debug breakpoints in your code:

Hello nano

In a matter of a few minutes, you'll be up and running with .NET nanoFramework!

And a lot of samples to start: https://github.com/nanoframework/Samples

What is .NET nanoFramework?

.NET nanoFramework is a free and open-source platform that enables the writing of managed code applications for constrained embedded devices. It is suitable for many types of projects including IoT sensors, wearables, academic proof of concept, robotics, hobbyist/makers creations, or even complex industrial equipment. The .NET nanoFramework makes development easier, faster, and less costly by giving embedded developers access to modern technologies and tools used by desktop application developers.

Developers can harness the powerful and familiar Microsoft Visual Studio IDE and their .NET C# knowledge to quickly write code without having to worry about the low-level hardware intricacies of a microcontroller. Desktop .NET developers will feel “at home” and can use their skills in embedded systems development, enlarging the pool of qualified embedded developers. Using Microsoft Visual Studio, a developer can deploy and debug the code directly on real hardware.

The .NET nanoFramework includes a reduced version of the .NET Common Language Runtime (CLR) and features a subset of the .NET base class libraries along with the most common APIs included in .NET IoT allowing code reuse from .NET IoT applications, thousands of code examples, and open source projects.

The project is supported by the .NET Foundation.

You can watch this video from the Microsoft IoT Show featuring .NET nanoFramework connected to Azure IoT Hub, measuring a BMP280 sensors, and using the unique deep sleep feature from microcontrollers. A real-life example with .NET nanoFramework:

IoT Show

Why use .NET nanoFramework?

.NET nanoFramework is the perfect enabler for developing software that works on embedded devices. Start with a low-cost and readily available development board, then use nanoFramework to write, debug and deploy your code.

Whether this is your first foray into programming or you are a seasoned developer, if you want a powerful and easy-to-use tool for developing software that runs on embedded devices, you are in the right place. With its modular architecture, it's easy to grab the core components (like the CLR, debugger, and interpreter) and extend them to new hardware platforms, .NET nanoFramework is the perfect partner for your project. The current reference implementation uses ChibiOS supporting several ST Microelectronics development boards, Espressif ESP32, Texas Instruments CC3220 Launchpad, CC1352 Launchpad, and NXP MIMXRT1060-EVK.

Because it's completely free and Open Source you have access to and the ability to modify all parts of the code including the ability to leverage what others have already contributed. If you are willing to, you can help shape the future by contributing back to the project and rapidly growing community.

Here are a couple of supported boards:

nucleo esp32 M5Stack OrgPall PalThree NXP

Our reference boards can be found here. And community boards here. Depending on your board, it can be a matter of a few hours to get your board supported! A blog post will explain how.

Here are some of its unique features:

  • Can run on resource-constrained devices with as low as 128kB of flash and 64kB of RAM.
  • Runs directly on bare metal. Currently, ARM Cortex-M and ESP32 devices are supported.
  • Supports common embedded peripherals and interconnects like GPIO, UART, SPI, I2C, USB, and networking.
  • Provides multi-threading support natively.
  • Support for energy-efficient operations such as devices running on batteries.
  • Support for Interop code allows developers to easily write libraries that have both managed (C#) and native code (C/C++).
  • No manual memory management because of its simpler mark-and-sweep garbage collector.
  • Execution constraints to catch device lockups and crashes.

Here are some advantages over other similar systems:

  • First-class debugger experience right on the target hardware with breakpoints, single step, step into, step out, step over, pause and stop.
  • Powerful and free developer tools with Microsoft Visual Studio IDE.
  • Support for a large range of inexpensive boards from several manufacturers including Discovery and Nucleo boards from ST Microelectronics, Quail from Mikrobus, Netduino from Wilderness Labs, ESP32 DevKit C, Texas Instruments CC3220 Launchpad, CC1352 Launchpad, and NXP MIMXRT1060-EVK.
  • Easily expandable to other hardware and RTOS platforms. Currently targets CMSIS and ESP32 FreeRTOS ports.
  • Completely free and Open Source. From the core components to the utilities used for building, deploying, debugging, and IDE components.

Associated links:

Find us on Fridays all July! See you for another post on how to use GPIO, SPI, I2C, PWM, and more on .NET nanoFramework! And feedback is welcome.

Top comments (0)