.net, Netduino

Windows 10 Technical Preview (9926) and Netduino Plus 2

I’ve been working with the Windows 10 preview, and with its imminent release (this year anyway) I’ve been keen to see how my hardware gets along. Some of these pieces of hardware are a bit niche – Netduino Plus 2, Roland iModela CNC Milling Machine, so I wanted to see if they would work on the new OS, or if I’d have to maintain a legacy Windows machine. (I’ll blog about the iModela soon).

I’ve found how to make both of these pieces of hardware work – it hasn’t been perfectly straightforward, but definitely possible.

An issue I’ve found previously with getting started with “Internet of Things” kit is that it rarely just works perfectly out of the box, and my experience this time was pretty similar. After I got my environment working, I decided share the knowledge (gleaned from various forums) in this piece. Any comments which could be interpreted in this piece as criticism are intended to be constructive – if I point out something as wrong, I’ll always try to suggest what I think would be a potential solution.

Software Requirements

1. Windows 10 Technical Preview (9926)

2. Visual Studio 2013 Community Edition

3. .NET Microframework V4.3 SDK (QFE2-RTM)

4. .NET MF Visual Studio 2013 Add-in

5. Netduino SDK 4.3.1

You’ll have to make sure all of these are installed – also if you’ve previously installed any .NET Microframework SDKs or Netduino SDKs, these should be uninstalled first.

Tweaks to get the Netduino Plus 2 working

As I mentioned before, even after all these installs, things don’t quite work yet (but we’re nearly there).

When you connect the Netduino Plus 2 for the first time, you’ll see the usual installation screen.

NetduinoDriversOpen Visual Studio 2013, choose the ‘Netduino Plus 2’ project template, and try the canonical blinking LED program (page 4 of the Getting Started guide).

public static void Main()
    // write your code here
    OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
    while (true)
        led.Write(true); // turn on the LED
        Thread.Sleep(250); // sleep for 250ms
        led.Write(false); // turn off the LED
        Thread.Sleep(250); // sleep for 250ms

But when you try to compile and run this, you’ll see the following error:netduino_errorThis isn’t a massively helpful error message, and it’s a known issue. Fortunately there’s a workaround posted on StackOverflow that generally seems to work. You can either:

  • Install the .NET Framework 3.5 – this is not my preferred solution, not that there’s anything wrong with .NET 3.5, but more that I’d prefer to not install multiple versions of the .NET Framework if I can avoid it.
  • Alternatively, drop the MetaDataProcessor.exe.config file into the .NET MicroFramework Tools directory  – %ProgramFiles%\Microsoft .NET Micro Framework\v4.3\Tools.

After these tweaks, ensure the project is set to use the Netduino emulator.

netduino_emulator_settingWith this setting, simple blinking LED application should compile.

Connecting to the real thing

Connect the Netduino, and in the Project Properties ‘.NET Micro Framework’ tab, change the transport to USB and from the Device dropdown, select your device (probably called something like “NetduinoPlus2_Netduino”).

netduino_emulator_setting_2Try to deploy your code to the Netduino – sadly, you’ll probably see another error.

netduino_version_errorThis error is slightly more useful – this tells us that my device has the version firmware installed, but of course we’re on .NET Micro Framework 4.3.

So we need to do a couple more things before we’re home and dry.

1. Change the application Target Framework to ‘.NET Micro Framework 4.2’.

netduino_emulator_setting_32. Drop the MetaDataProcessor.exe.config file into the .NET MicroFramework Tools directory for v4.2  – %ProgramFiles%\Microsoft .NET Micro Framework\v4.2\Tools.

Recompile – deploy – hit the reset button – and you should have a blinking blue LED. Now you’ve successfully worked through the process of getting the ‘Hello World’ level application to work, you’re ready deploy your own custom applications.

(You’re right – we aren’t using the most up to date version of the Micro Framework, we’re using v4.2 instead of v4.3.  I’ll blog another time about how to get it working with v4.3).

Final Thoughts

These thoughts are regarding the eco-system around the Netduino and the .NET Microframework. As I said earlier, I hope these are constructive comments.

Comment #1: I would say that the first problem for a new-comer is cosmetic – the information on http://www.netduino.com is so old.

In both the projects and downloads section, it recommends using “Microsoft Visual C# Express 2010”. This is now a way old IDE and it makes the product look stale. I don’t want to have multiple IDEs on my development environment. If I have VS2013 installed and I can see that it works with the Netduino, then that’s one less barrier to me being productive. And when a beta is released, this should be promoted more. Don’t keep it quiet if it’s good – look at what Microsoft are doing with the Windows 10 Tech Preview.

Comment #2: The information on forums.netduino.com is great – it’s invaluable for troubleshooting. But this information should also be in an FAQ section on the main site. Being able to effectively search for information to solve your problem is an art, and not everyone knows the precise search term required to get to the forum post that’s going to solve your problem.