I have been programming a Netduino for some robotics projects and I just wanted to document some of the things that I’ve noticed with my setup. If your not familiar, netduino is an open source open hardware microcontroller that can be used for any number of projects from home automation, to art installations and can be programmed in C#. My interest in them is easy to program low cost robotics.
I use linux for work and on my laptop at home, so this was a hurdle I had to overcome in order to use the netduino. While there is an open source alternative to Microsoft’s .NET framework implementation (called mono) it doesn’t include the “micro” version of the framework required to code the microcontroller. It is possible to program the .NET micro framework in linux with mono it is super hacky, and to me, not worth the effort to setup.
I decided to use a virtual machine hosted inside of my Ubuntu operating system on my laptop. Oracle provides an excellent free virtualization solution called VirtualBox which is easy to obtain and install, and since I already had it, this is what I used.
Since I had a Windows XP cd kicking around, this is what I installed in my virtual machine to support the Microsoft .NET micro and interface to the netduino. The required software can be found here. Visual Studio makes programming and deploying to the netduino super easy and it’s great that the “express” version can be had for free from Microsoft. I installed 2010 for C# .NET which is still available and intended to work on XP.
I had forgotten that Windows takes forever to install and so do Visual Studio and the required .NET frameworks, but all you have to do is follow the order of download and install on the netduino page to ensure that you have done it properly.
Some things to keep in mind
Connecting the netduino (USB)
- The specifications on the netduino website says that USB is not officially supported as a protocol for a Linux/Mac system hosting a Windows virtual machine to connect to the netduino. I didnt’ realize this when I first got started, and it may explain some of the weirdness I have experienced, but it definitely seems to work just fine for me.
- You have to make sure that the netduino is accessible as a usb device to your virtual machine. Once you have connected the usb cable between your device and computer, go to the Devices menu in your virtual machine window and find the netduino under the usb category and select it.
- Once the netduino is available as a usb device to your virtual machine, Windows asks if you would like to install the required drivers. I’m not sure if this is required, but I did it successfully but selecting the default options all the way through the new hardware wizard.
Deploying code to the netduino
- In order to deploy the code to the netduino microcontroller, it must be selected as the target in your Visual Studio project’s properties (Properties menu option in the Project menu. Then select .NET Micro Framework from the list.) This involves changing the transport method to USB and the target to your netduino (mine showed up as Netduino_Netduino). You can deploy code and start debugging by pressing F5 or delecting Start Debugging in the Visual Studio Debug menu.
- If it doesn’t show up in the target list (or intermittently it seems to be disconnected/deployment fails) just unplug the usb cable and plug it back in. Then re-select the device as a usb device in the virtual machine’s menu.
- If the code builds correctly and netduino is attached, Visual Studio will program the microcontroller with your code and try to run it. When I do this Visual Studio indicates that it needs to reboot the netduino for the new code to run, and just sits there. I’m not sure if this is typical, but once this happens if I just press the reset button on netduino the netduino restarts and begins running my new code.
- If you stop debugging now (I get a warning when I opt to stop debugging, but you can just ignore it), you can unplug your netduino from the computer and run your new code by pressing its reset button provided you are still providing power to the unit. (I will write a post soon about creating a simple battery pack for the netduino with a 9v battery.)
MMP : error MMP0000: 0x80131700
You may get an error that says MMP and something about metadata. This apparently may happen with clean installs of XP where just the netduino .NET requirements are installed. I learned how to solve this issue here, but basically it involves copying the text below and saving it as MetaDataProcessor.exe.config in your ../Program Files/Microsoft .NET Micro Framework\v4.1\Tools folder. (Or installing .NET 3.5 SP1)
<?xml version="1.0" encoding="utf-8" ?>