Monday, March 23, 2009

Drunken .NET MF Device

AUG Elektronik was showing a .NET MF device at the GAST trade fair that was running under water. The drink dispenser is using Atmel QMatrix touch sensor ICs that detect touch using a scanned passive matrix of electrode sets.

Have a look at this video on YouTube demonstrating the dispenser while water is running over the screen.


BTW: AUG Elektronik is using a very clear 3.4" AMOLED display which looks really nice.

And the MSDN Premium goes to…?

Yesterday I had to find the winner of my MSDN Premium subscription. My last MSDN Premium winner was found by a really simple Console application. To have more winners I added two new prizes: one for a guaranteed book prize (.NET 3.5 related) for the next game and one with a double chance to win.

Here are the winners:


Congratulation Joe, you are the winner of the MSDN Premium subscription. Łukasz and Anheledir got the two other prizes. The next MSDN Premium is waiting for you… sure!

Friday, March 13, 2009

Talk to your .NET MF device with Live Messenger

Some months ago I was working on a Live Messenger or Google Talk integration in an Web application. Before trying to implement all at my own I started playing with imified. imified is really cool! You can register an account and imified will send you arriving messages as a simple http POST request. As html output you return the text you want to reply.

Using my simple Webserver for .NET Micro Framework you are able to build steps and reply to the chat partner.

imageLook at this example:

context.Response.ContentType = "text/html; charset=UTF-8";
switch (context.Request.Form["step"])
    case "1":
        context.Response.Write("Hi, what's your name?");
    case "2":
        context.Response.Write("Hello " +
                               context.Request["value1"]) + "!");

This example will say "Hi, what’s your name?" when you start chatting with the account. If you enter your name and press enter the account will reply with "Hello" and your entered text.

I put my Google Talk account interactive [at] and Live Messenger account imified [at] in the HttpConsole demo application. Simple add the corresponding account to your favorite messenger and talk to my Tahoe-II board. It will tell you i.e. the temperature in my kitchen using the XBee modules from Digi.

Looking forward hearing from you what you think about this way talking to a .NET Micro Framework device.

Tuesday, March 10, 2009

How to use Cultures in Microsoft .NET Micro Framework

I’m currently working on a .NET MF device that should support several languages. The problem I noticed was the missing support of mscorlib culture depending formatting. Well, you’ll find the solution how to get i.e. the correct DecimalSeparator for German in Jens Kühner’s book.

What you have to do is a simple library project that contains a single embedded resource with all the separator / patterns inside. The root namespace of the project files must be System.Globalization.Resources.CultureInfo. That’s the trick!

Next you have to add a reference to this file and you’re able to switch the culture:

public class Program
    public static void Main()
        Debug.Print((1.23456).ToString());    // 1.23456
        Debug.Print((1.23456).ToString());    // 1,23456 comma instead of dot

    static void ResetResourceManager()
        FieldInfo fieldInfo = typeof(Resources).GetField("manager",
                                                BindingFlags.NonPublic | BindingFlags.Static);
        fieldInfo.SetValue(null, null);

    static void SetCulture(string cultureName)
        ResourceUtility.SetCurrentUICulture(new CultureInfo(cultureName));
        // render screen with new culture

I have created a very simple application that is creating those project files. You can download the containing all the project files.

This evaluation version of the .NET Micro Framework runtime will expire

Did you ever got this message in Visual Studio output when started debugging a real device?

This evaluation version of the .NET Micro Framework runtime will
expire in 29 days, 23 hours, 55 minutes, and 0 seconds.

Well, the porting kit provides tools to build time-bombed runtime images. You get 720 hours of runtime – this means you could basically run the device for up to 2 years at 1 hour per day or a month (30 days) at 24 hours per day.

When starting with a new prototype (or a new device) some companies don’t care about this. What they need is to sign a volume license agreement with Microsoft telling them the real number of .NET MF licenses to flash a not time-bombed image.

If you own a device that will expire in some days simple download the latest firmware update on the company’s Web site and flash your device. The 720 hours will start again and again from the time of the last flash.

Links from 10th March

Ondrej wrote a blog post about an error in DPWS Metadata Response and how to create a work-around.  I didn’t stumbled over this error yet but I found the small tool DPWS Explorer really interesting.

Pavel added some more photos taken at the Embedded World 2009.

I found another cool article about how to implement LINQ on the .NET Micro Framework. As LINQ only requires version 2.0 of the CLR you’re now able to write lambda expressions, extension methods and list comprehensions.

Kevin added a cool demo how to add little GUI elements with .NET Micro Framework which looks really nice.

Blair is writing about his Dare to Dream Difference Challenge project. I’m very interesting in seeing his device using XBee in real live.

And another Dare to Dream Difference Challenge project created an API for Facebook on the .NET Micro Framework.

Monday, March 9, 2009

New Release: .NET Micro Framework Toolkit

There is a new release of the .NET Micro Framework Toolkit available. Following changes are in the new build:

  • Improvements in http server: mime content support when using forms including file uploads, http classes redesigned, cookie and http headers support fixed, uploading larger content now working, form posts and access to parameters, query string and form data added
  • DNS bugs fixed for .NET Micro Framework
  • Added a new NTP library to get the current DateTime from NTP servers
  • Added new uALFAT library from Elze Kool

If there is something missing or not working as expected feel free to send me any comment.

Friday, March 6, 2009

Webserver now handling File Uploads, Form Elements and Querystring correct

I’m currently working on the next release of the MFtoolkit including a tiny Webserver. Since the first release there are big improvements in handling http requests as correct POST and GET handling, parsing of http headers and body. Mime-coded POSTs (i.e. when you uploading a file) are handled and available directly in the HttpRequest class. Cookie support is included, too.

The online demo is still available, give it a try. I have changed the page output when you’re running any POST or GET.


Any feedback welcome! The release will be available during the next weekend. I hope I can add some more demo pages to show the full power of the Webserver.

Embedded World 2009

I had the chance to meet some other .NET MF developers as well as people from Device Solutions, AUG Elektronik and Microsoft. We had really interesting discussions about the .NET MF 3.0 and wishes for the upcoming version 4.0. Hopefully some of our ideas or questions will be answered in a first beta.

Here are some pictures taken at the Embedded World this year in Nuremberg:

IMG_0685 IMG_0687 IMG_0689 IMG_0690 IMG_0681 IMG_0682 IMG_0683 IMG_0684

And don’t forget to note the date for next year’s Embedded World 2010: 2.-4. March 2010.


Wednesday, March 4, 2009

Windows SideShow Device SDK for .NET Micro Framework 3.0

sideshow Windows SideShow delivers information from your computer to a secondary display that is either integrated into the computer, such as a small color display in a laptop lid; or separate from the computer, such as a remote control or mobile phone.

There are a wide variety of uses for this technology, from using a mobile phone to control your media library, to viewing news and calendar appointments in a digital picture frame, to being able to manage your e-mail while you play a game on your computer.

On the Windows SideShow Connect website, you can find the latest SideShow software betas, including tools to build SideShow-compatible devices and upcoming SideShow gadgets from Microsoft.

To participate in the Windows SideShow Device SDK for .NET Micro Framework 3.0 RC or the Device Simulator 3.0 for Windows SideShow RC program visit the Windows SideShow Connect website.

If you’re using SideShow on a Windows Mobile there is an update of the Windows Mobile Developer Preview.

New features implemented in the Windows SideShow Device SDK for .NET Micro Framework 3.0 since the beta release:

  • Support for TCP/IP is provided in the Microsoft.AuxiliaryDisplay.DPWS assembly.
  • The Microsoft.SPOT.TinyCore assembly has been replaced with Microsoft.AuxiliaryDisplay.Framework assembly, which is optimized for screen update and event handling performance.
  • Sprite animation support. A new sample project demonstrates how to implement sprites.
  • A callback for displaying an appropriate disconnected message if the device is disconnected, is provided in the OEM class.
  • The default lock screen is now brought up by a press-and-hold, and unlocked with a tap in the upper-right followed by a tap in the upper-left.
  • On pages that support select event feedback, a callback is provided for handling select events, and gesture feedback is optional. SCF pages now treat a tap as a select action.
  • Context menus feature a “chevron” bitmap that the user taps to open the context menu. This bitmap can be modified as part of your theme.
  • Status icons such as power, wireless strength, and sound level are customizable in your theme.
  • Support for collapsing and expanding the area of the display that SideShow uses, so that in collapsed mode, the area below the SideShow portion of the display can be used as a touch pad for mouse navigation. The OEM project has been updated to show how to implement a collapsed mode SideShow display.
  • Support for debug messages that display event response times for touch events.

Tuesday, March 3, 2009

SocketException ErrorCode 10035 – Network Switch Problem

Some days ago a customer had a problem with the Tahoe-II board. A simple demo application was accessing a http server using sockets and download the html source. Using the Microsoft or Tahoe-II emulator everything works fine, but deploying and running it from a real device I got following error message from time to time:

#### Exception System.Net.Sockets.SocketException - E_FAIL (1) ####
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
#### System.Net.Sockets.Socket::Connect [IP: 0029] ####
#### NetworkTester.Program::Main [IP: 00f7] ####
#### SocketException ErrorCode = 10035 
Exception (first chance) of type "System.Net.Sockets.SocketException" in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10035
#### SocketException ErrorCode = 10035
#### SocketException ErrorCode = 10035
SocketException: Exception was thrown: System.Net.Sockets.SocketException Error-code: 10035 
The thread 0x1 exited with code 0 (0x0).

While playing around I got the device running on a different switch. The first used switch was a Netgear switch with 100/1000 MBit auto selection. As the Tahoe-II board is using a 10 MBit network card I put this on a 100 MBit switch and everything works fine. I’m not sure if this is the real problem, but since using the slower network switch the customer is happy.

Monday, March 2, 2009

How to create PE files for .NET Micro Framework without Visual Studio?

While I was searching for a solution to deploy an .NET MF application without Visual Studio I tried the first steps to build my application with the .NET Framework compiler from command line.

I downloaded the .NET MF Framework SDK 2.5 and installed it on a Virtual PC. This download includes all the DLLs including the core library for .NET MF. The compiler itself comes with the standard .NET Framework 2.0.

For testing purpose I created a new .NET MF project and copied Program.cs and GPIOButtonInputProvider.cs in a temporary folder. Next I created following batch file which will compile and start the .NET MF Emulator:

SET NET_BIN=%windir%\Microsoft.NET\Framework\v2.0.50727

SET MF_VER=v2.0.3036

SET MF_BIN=%programfiles%\Microsoft .NET Micro Framework\%MF_VER%\Tools
SET MF_LIB=%programfiles%\Microsoft .NET Micro Framework\%MF_VER%\Assemblies

"%NET_BIN%\csc.exe" /noconfig /nostdlib+ /optimize- /r:"%MF_LIB%\mscorlib.dll" /r:"%MF_LIB%\Microsoft.SPOT.Native.dll" /r:"%MF_LIB%\Microsoft.SPOT.Graphics.dll" /r:"%MF_LIB%\Microsoft.SPOT.Hardware.dll" /r:"%MF_LIB%\Microsoft.SPOT.TinyCore.dll" /out:Program.exe /target:exe *.cs

"%MF_BIN%\MetaDataProcessor.exe" -loadHints mscorlib "%MF_LIB%\mscorlib.dll"
-loadHints Microsoft.SPOT.Native "%MF_LIB%\Microsoft.SPOT.Native.dll"
-loadHints Microsoft.SPOT.Graphics "%MF_LIB%\Microsoft.SPOT.Graphics.dll"
-loadHints Microsoft.SPOT.Hardware "%MF_LIB%\Microsoft.SPOT.Hardware.dll"
-loadHints Microsoft.SPOT.TinyCore "%MF_LIB%\Microsoft.SPOT.TinyCore.dll"
-parse Program.exe -minimize

/ /load:"%MF_LIB%\" /load:"%MF_LIB%\" /load:"%MF_LIB%\" /load:"%MF_LIB%\" /load:"%MF_LIB%\"

Well, I found a solution to build my .NET MF projects and got my DLL and PE files. The only missing part is deploying the files to a real device which is not working outside of Visual Studio.

How to deploy your .NET MF application?

Some weeks ago I tried to deploy an .NET MF application using MFDeploy. I was searching for an solution how I could deploy my application without installing Visual Studio. Well, the problem was that I wasn’t with the customer and I couldn’t install Visual Studio on their PCs as they are using Visual Studio 2008 and I needed Visual Studio 2005 for the .NET MF 2.5 version.

With MFDeploy you can extract the flashed image into HEX files. Those HEX files you can use to deploy / flash other hardware identical devices. Is there really no way to deploy an application without Visual Studio? What is the magic behind this flashing procedure?

I asked the .NET MF newsgroup and got following answer:

Then you'd need to get that device from the customer, test your application
on it and create a master image from that.

Hm, that’s not really nice for me (and the customer, of course). My solution: I have installed a Virtual PC with Visual Studio 2005 trial edition and have successfully installed my new application on that device. Hopefully there will be any tool in the future that let’s you flash your application remotely without Visual Studio.