Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.


Member Since 14 Dec 2013
Offline Last Active Feb 26 2014 05:25 PM

Topics I've Started

MFUpdate supported on 4.3?

21 January 2014 - 03:55 PM



are the MFUpdate and Microsoft.SPOT.Update assemblies supported ?


As soon as I add a reference to them, my N+2 hangs badly when VS loads the assemblies. I have to resort to the DFU utilities from ST to erase everything and reburn the 4.3 firmware... (erasing from MFDeploy does not work, as it becomes impossible to connect to the N+2).

If I remove the references, everything goes back to normal.




Self-updating Netduino application ?

14 January 2014 - 06:45 PM



I have quite a few Netduino devices (2 and +2) deployed in the field. For reasons specific to the installation, I don't have direct access to any of the ports on the devices (usb or serial) and yet I need to perform a remote update of my application.

Through the protocol implemented to communicate with the devices, I have the ability to download just about any content to those devices. That content could be whatever's needed to upgrade the application.

So is there a way to make the application self-updating. The operations that would be required are :


1. Get the update code from the server

2. Do whatever's needed to perform the update

3. Reboot into the new application


Is there a way of performing step 2 above ? If so, how ? Would you have any pointers to a similar implementation ?





PS : not sure this is the best forum to post this, but I had to pick one...

Static IP address changes and HTTP listeners

01 January 2014 - 04:25 PM

In reference to my previous post (http://forums.netdui...rnet-circuitry/), where I've failed miserably to change the IP configuration across a device reboot without unplugging said device, I came across another problem, which may be related.

Since I couldn't get it to work with a simple reboot, I tried dynamically changing the static IP address. Here's the extent of the code:

public static void Main() {    NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("", "", "");    Debug.Print("IP = " + IPAddress.GetDefaultLocalAddress());    HttpListener listener = new HttpListener("http");    listener.Start();    HttpListenerContext context = listener.GetContext(); // blocks until we get a request    Debug.Print(context.Request.Headers.ToString());    context.Close();    listener.Close();    Thread.Sleep(1000);    NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("", "", "");    listener = new HttpListener("http");    bool nok = true;    while (nok) {        try {            listener.Start();            Debug.Print("Success");            Debug.Print("IP = " + IPAddress.GetDefaultLocalAddress());            nok = false;        } catch (Exception ex) {            Debug.Print("Failed with " + ex.ToString());            Thread.Sleep(100);        }    }    context = listener.GetContext();    Debug.Print(context.Request.Headers.ToString());    context.Close();}

In essence, I'm programming the network interface with a static IP address (, starting an HTTP listener, sending a request to through my browser, printing the headers, then closing the context and the listener. So far, so good.

Then I change the IP address and try again, to no avail: the new HTTP listener will never start, throwing a SocketException everytime.

Now if I comment out the second EnableStaticIP (line 11), the new listener will fail to start exactly 4 times in a row, throwing a SocketException again, and succeed the 5th time ! By the way, if I reuse the same listener as the first time, not creating a new one, I get the exact same behavior (in other words. listener.Stop() followed by listerner.Start() fails).


Here's a transcript of the debug window for this last case:

IP = text/html, application/xhtml+xml, */*Accept-Language: en-US,en;q=0.8,fr-FR;q=0.5,fr;q=0.3User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; MAARJS; rv:11.0) like GeckoAccept-Encoding: gzip, deflateHost: 1Connection: Keep-AliveAuthorization: Basic YWRtaW46cGFzc3dvcmQ=A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dllThe thread '<No Name>' (0x5) has exited with code 0 (0x0).A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dllFailed with System.Net.Sockets.SocketExceptionA first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dllFailed with System.Net.Sockets.SocketExceptionA first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dllFailed with System.Net.Sockets.SocketExceptionA first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dllFailed with System.Net.Sockets.SocketExceptionSuccessIP =

In the first case where I change the IP address, I get the same transcript, except that the "Success" message never comes and it keeps failing over and over.


So bottom line:

  • Why doesn't [font="'courier new', courier, monospace;"]{ listener.Stop(); listener.Start(); }[/font] work right away ?
  • What does it take to change the IP address of the network interface and still be able to get an HttpListener that will start properly without having to power cycle the device?

Thanks for your help.


PowerState.RebootDevice & Ethernet circuitry

31 December 2013 - 09:05 AM



I wrote a very small web server for the Netduino Plus 2; the only purpose of the server is to give the user the ability to change the IP configuration of the board (enable DHCP or set a static address).


At the beginning of my Main() routine is a piece of code that retrieves the IP configuration from SD (if any, otherwise, it uses defaults), programs the network interface accordingly, and then starts the web server.


Once the user has entered the new configuration, I store it to the SD card, then reboot the device with [font="'courier new', courier, monospace;"]PowerState.RebootDevice(false)[/font]. The [font="'courier new', courier, monospace;"]Main()[/font] routine restarts, but then the Netduino card cannot be accessed from the network ; it just does not answer ; for the rest, it appears to be alive and well. I have to remove and re-apply power to get it back to responding to the network.


I tried RonZon's approach to hard reset the Ethernet chip (http://forums.netdui...+ethernet +port), but that apparently does not change anything (though I'm not sure what I'm really doing as I'm kind of working blindfolded, not havving an oscilloscope to put on the /ENC_RESET signal...).


Any idea how to change the IP configuration on the fly without powering off the Netduino ?


BTW, this is with the .Net MF 4.3 and the 4.3 beta 1 SDK.





Size of uart buffers

30 December 2013 - 04:37 PM

What are the sizes of the UART buffers on the Netduino Plus 2 ? After a little search and experimenting, I figured the receive buffer is 512 bytes and the send buffer 256 bytes. Is this right ? Is this documented anywhere ?

Will the SerialPort.Write() method properly work if used with a buffer larger than the size of the send buffer ?




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.