USB and C# in .NET Micro Framework (NETMF)

The .NET Micro Framework implements a USB device (also known as USB client) that enables your device to act as a USB device, like a mouse, keyboard, or printer. For example, a .NET Micro Framework device can function as a mouse, and after connecting to a PC can provide mouse coordinates.

Does .NET Micro Framework supports the USB host?

The USB host feature that allows you to connect other USB devices to your .NET Micro Framework device is not supported. However, .NET Micro Framework devices from GHI Electronics ( are all capable of USB host through a proprietary implemented USB host stack.

The GHI Embedded Master SDK includes a mouse sample, along with other samples, that shows how to make your device available as a virtual COM port when connected to a PC.

An extensive article that shows how to use a USB device feature with the .NET Micro Framework be found at It also covers how to write custom drivers for your USB devices.

C# and .NET Micro Framework (NETMF)

Microsoft’s .NET Micro Framework (NETMF) is a re-implementation of desktop .NET CLR for embedded devices with limited resources. But at the same time, the developer can enjoy the easy and rich development platform the NETMF offers, on devices with greater resources.
You can create applications that run on a range of systems from tiny devices, like remote controls, to PCs and Servers on the cloud– all with the same programming model and tools.
The .NET Micro Framework enables you to write embedded applications for small, connected, embedded devices with Visual Studio and C#. That means you can now use the same development tools and language that you use to build desktop and smart device (PDA and smartphone) applications to develop applications for microcontrollers.
What are the available .NET Micro Framework devices and development boards that you can write applications in C#?
1) Meridian CPU
You can write applications in C# using Visual Studio. The block diagram of this board is shown below:

Figure 1. Meridian CPU Block Diagram

The Meridian CPU and the .NET Micro Framework are ideal for applications such as; industrial automation, home automation, healthcare, consumer devices, retail point-of-sale, PC peripherals, and automotive applications.
2) Tahoe-II
The Tahoe-II development platform is the ideal place to start when developing small, smart, connected devices. The familiar development environment of Visual Studio enables .NET desktop programmers to work easily with this board.
The Tahoe- features a 3.5” touch-screen LCD, wired and wireless networking, USB function for interfacing to PCs, an accelerometer for innovative sensing and user interface applications. When you need to prototype a new device, the Tahoe-II has easy access to an array of expansion options; including serial ports, I2C, SPI and plenty of GPIO.
The block diagram of this Tahoe-II is shown below:

Figure 2. Tahoe-II Block Diagram

USB 3.0 and C#

USB 3.0 defines a new, 10x faster SuperSpeed bus (a bus speed of 5 Gbps) that operates parallel to the USB 2.0 bus.

How to use USB device in C#?

To use the USB device in your C# application, you can use libusb (from which is a library that gives user level applications uniform access to USB devices across many different operating systems.

There is also another library called LibUsbDotNet (from that is a .NET C# USB library for WinUsb, libusb-win32, and Linux libusb v1.x developers. All basic USB device functionality can be performed through common device classes allowing you to write OS and driver independent code.

LibUsbDotNet is a development tool written for .NET software developers who need a fast and easy way to create a custom USB driver solution for Unix-like and Windows platforms. LibUsbDotNet 2.1.0 and above supports the genuine libusb-win32 driver package. However, access to basic device information via the Windows registry is not available. LibUsbDotNet features full support for WinUSB and extended kernel level support for libusb-win32. It also allows common device classes a single code base to support multiple drivers and platforms, and includes a wizard utility for generating USB installation packages and removing devices.
LibUsbDotNet also features device discovery using either of the following criteria: VendorID or ProductID, Device Interface GUID, Revision Code, and Serial Number.

Copyright © All Rights Reserved - C# Learners