Netduino home hardware projects downloads community

Jump to content


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

Pyt's Content

There have been 18 items by Pyt (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#55566 MFUpdate supported on 4.3?

Posted by Pyt on 22 January 2014 - 04:18 PM in Beta Firmware and Drivers

We'll be updating the Netduino 4.3 beta firmware soon...and we're getting fairly close to an RTM release). We'll post all the source code for it.

Thanks. Anxiously waiting  :)




#55553 MFUpdate supported on 4.3?

Posted by Pyt on 22 January 2014 - 06:58 AM in Beta Firmware and Drivers

your Netduino doesn't have room for MFUpdate partitions.

Could this be done with external storage (SD) ?

If so, is it possible to get access to the 4.3 firmware source code ? I'd like to get a chance at implementing that...




#55531 MFUpdate supported on 4.3?

Posted by Pyt on 21 January 2014 - 03:55 PM in Beta Firmware and Drivers

Hello,

 

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.

 

Thanks,

Pyt




#55445 Self-updating Netduino application ?

Posted by Pyt on 17 January 2014 - 05:38 PM in Netduino 2 (and Netduino 1)

I'll try that and report to the forum if/when I've made progress.

 

Thanks

Pyt.




#55417 Self-updating Netduino application ?

Posted by Pyt on 16 January 2014 - 10:29 AM in Netduino 2 (and Netduino 1)

Hello, Chris,

 

where can I find the information about the flash, its layout, how it is programmed, the format of the file used to program it, etc... Would you have any sample code ?

 

thanks,

Pyt.




#55390 Self-updating Netduino application ?

Posted by Pyt on 15 January 2014 - 06:33 AM in Netduino 2 (and Netduino 1)

That sounds intriguing, but I'm not sure about the [font="calibri, sans-serif;"]feasibility[/font]. As I understand it (and I'm by no means an expert), the app on the Netduino flash creates the assembly and method objects when loading a program from the SD card, so they are part of the flash application's RAM. So if the flash application exited (which is probably necessary to write to the flash memory), it would dispose of the assembly and method objects as well. I'm also not sure if the firmware would allow for direct access to the flash memory from managed code, though it may be possible to modify the firmware to allow this.

The point is that the flash application wouldn't need to exit. The loader would just hard reboot the system. And the loader might have to be partially unmanaged.

Any body has any idea what the flash layout is, where to put the application assemblies and how to burn the thing ? or should I reverse engineer the firmware and/or bootloader ?

Thanks.

 




#55377 Self-updating Netduino application ?

Posted by Pyt on 14 January 2014 - 08:17 PM in Netduino 2 (and Netduino 1)

Hmmm, interesting thoughts. I will give it a try, but I'm afraid I might run out of ram space.

If we push the concept one step further, is it possible to update the flash from a program that runs entirely in ram and doesn't need the flash ?

Because in that particular case, we could do something like:

 

1. Flash app downloads new binary and loader from the server into the SD card

2. Flash app loads the loader from SD and executes it in RAM

3. Loader updates the flash with the new binary

4. Loader reboots the device

5. We're now running the updated app from flash

 

Any thoughts on step 3 ?

 

Thanks.




#55370 Self-updating Netduino application ?

Posted by Pyt on 14 January 2014 - 06:45 PM in Netduino 2 (and Netduino 1)

Hello,

 

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 ?

 

Thanks,

Pyt.

 

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




#55106 PowerState.RebootDevice & Ethernet circuitry

Posted by Pyt on 01 January 2014 - 05:38 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

 

For the record, I finally got it to work... The trick,for some reason that you may understand better than I do, is to change the network configuration before the RebootDevice(). It then works like a charm.

 

Thanks for time.

Pyt.




#55104 Static IP address changes and HTTP listeners

Posted by Pyt on 01 January 2014 - 04:25 PM in Netduino Plus 2 (and Netduino Plus 1)

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("10.0.0.10", "255.255.255.0", "10.0.0.1");    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("10.0.0.11", "255.255.255.0", "10.0.0.1");    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 (10.0.0.10), starting an HTTP listener, sending a request to http://10.0.0.10 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 = 10.0.0.10Accept: 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: 10.0.0.10DNT: 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 = 10.0.0.10

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.

Pyt.




#55096 PowerState.RebootDevice & Ethernet circuitry

Posted by Pyt on 01 January 2014 - 09:02 AM in Netduino Plus 2 (and Netduino Plus 1)

The code you link to is sending the wrong value on the pin at the very least, use Aaron's code linked in the reply here

 

http://forums.netdui...ripheral-power/

 

Hmm, I believe the value was right (the signal is active low), but anyway, thanks for the hint. I tried to enhance my reboot routine :

public static void Reboot() {    OutputPort ethResetN = new OutputPort((Cpu.Pin)50, true); // reset signal for Eth chip, active low    OutputPort powerEnableN = new OutputPort((Cpu.Pin)47, false); // power enable for Eth chip, actie low    ethResetN.Write(false); // reset Eth chip    Thread.Sleep(50); // sleep 50ms    powerEnableN.Write(true); // turn power off    Thread.Sleep(1000); // sleep 1s    powerEnableN.Write(false); // turn power back on    Thread.Sleep(100);    ethResetN.Write(true); // release reset signal    PowerState.RebootDevice(false); // hard reboot}

but to no avail. This is still not equivalent to unplugging/replugging the netduino device. My guess is there must be some part of the very early Ethernet chip initiallization which is not re-run when PowerState.RebootDevice() is called. Or maybe I just goofed somewhere...

 

The overall logic of my program is as follows :

public static void Main() {    // This is where the IP configuration gets set according    // to information stored in the SD the last time around.    NetConfig.Initialize();    // Start the web server in a separate thread    // (prompts the user for a new IP address)    new Thread(WebServer.Run).Start();    // More logic here to spy on the switch and reboot when it    // has been pressed for more than 3 secondss.    // The reboot can also be triggered by an action through the    // web server}

Chris, any hint ? (Happy new year by the way, and thanks for staying on line at this time of year...)

 

Thanks,

Pyt.




#55025 PowerState.RebootDevice & Ethernet circuitry

Posted by Pyt on 31 December 2013 - 09:05 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

 

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.

 

Thanks,

Pyt.

 




#55005 Size of uart buffers

Posted by Pyt on 30 December 2013 - 04:37 PM in Netduino Plus 2 (and Netduino Plus 1)

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 ?

 

Thanks,

Pyt.




#55004 Sending break over serial port

Posted by Pyt on 30 December 2013 - 04:33 PM in Netduino Plus 2 (and Netduino Plus 1)

Yes, this is an important requirement for me. I'm daisy-chaining Netduinos through serial ports, and propagating serial data frames across the chain. If  a netduino ever looses a piece of data, it will be desynchronized with no ability to easily find the start of frame again. One solution is to send a short break at the beginning of each frame, which will force every netduino in the chain back into a known state, whether they are in or out of sync.

The short break provided by the SBK is enough for my needs,but I reckon there might be other needs.

 

Yes, I'm comfortable hacking the firmware (with proper guidance). It's either that or do ugly things in my code for sync purposes, so if push comes to shove...

 

Regards,

Pyt.




#55000 Sending break over serial port

Posted by Pyt on 30 December 2013 - 11:27 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

 

Is there a way  of sending a break condition over a serial port ? From the reference manual, the Netduino processor can apparently do this (there's an SBK bit in the UART CR1 register to that avail), but I couldn't find anything in the SerialPort class that gave that possiblity.

Did I overllok something ? Any hint as to how to do this ?

 

Thanks,

Pyt.

 

 




#54747 Simple Storage

Posted by Pyt on 18 December 2013 - 05:24 AM in Netduino Plus 2 (and Netduino Plus 1)

And might I ask when that would be available for the average developer ?  :D




#54745 Simple Storage

Posted by Pyt on 18 December 2013 - 05:07 AM in Netduino Plus 2 (and Netduino Plus 1)

I'm seconding the question (for the Plus 2)... Thx.

 

Was Simple Storage ever implemented for v4.2 on Netduino Plus v1? Are there any examples of it's use? I've not seen any mention of it since 2012 and I could use some basic storage capabilities without having to resort to SD Card.

 

Thanx.




#54697 Netduino Plus 2 Firmware v4.3.0 (beta 1)

Posted by Pyt on 15 December 2013 - 09:40 AM in Beta Firmware and Drivers

Hello,

 

I'm trying to develop a very small web server on a NetDuino plus 2, with v4.3.0 beta 1. The server just displays a single page when hit with any request. The first request works fine. The second one also, but then I get a System.NullReferenceException in System.Http.dll. This exception seems to be triggered completely out of my code, because I cannot catch it anywhere, not in any thread, and not in Main, nor does it report any call stack involving my code. 

Any idea ?

(code follows; the static WebServer.Run() method is called from Main -- not reproduced here --- after making sure the board has an IP address.)

 

Thx,

Pyt.

    public static class WebServer {        #region Properties and fields        //////private Socket _socket = null;        private static readonly NetworkInterface _netIf = NetworkInterface.GetAllNetworkInterfaces()[0];        private const string _c_httpPrefix = "http";        private static Queue _contextQueue = new Queue();        #endregion        #region Methods        /// <summary>        /// The web server's main routine.        /// </summary>        public static void Run() {            HttpListener listener = new HttpListener(_c_httpPrefix);            while (true) {                try {                    if (!listener.IsListening) listener.Start();                    // Whenever a request comes in, we queue the context, start a                     // new thread to handle the request, and go back to listening for                    // more requests. Several threads may thus be started in parallel                    // which will each be handling an incoming request.                    HttpListenerContext context = listener.GetContext(); // blocks until incoming request                    lock (_contextQueue) _contextQueue.Enqueue(context);                    Thread th = new Thread(new ThreadStart(_requestHandlerProc));                    th.Start();                } catch (InvalidOperationException) {                    listener.Stop();                    Thread.Sleep(200);                } catch (ObjectDisposedException) {                    listener.Start();                } catch {                    Thread.Sleep(200);                }            }        }        private static void _requestHandlerProc() {            HttpListenerContext context = null;            try {                lock (_contextQueue) context = (HttpListenerContext)_contextQueue.Dequeue();                if (context != null) {                    switch (context.Request.HttpMethod.ToUpper()) {                        case "GET":                            _processClientGetRequest(context);                            break;                        //////case "POST": ProcessClientPostRequest(context); break;                    }                }            } catch (Exception ex) {                Utils.DebugPrintException(ex, "_requestHandlerProc");            } finally { if (context != null) context.Close(); }        }        private static void _processClientGetRequest(HttpListenerContext context) {            Debug.Print("Request URL: " + context.Request.RawUrl);            Debug.Print("Request Headers:");            Debug.Print(context.Request.Headers.ToString());            //Compose a response            StringBuilder sbResp = new StringBuilder("<html><header><title>Energlass gateway</title></header><body><b>");            sbResp.Append(_netIf.IsDhcpEnabled ? "Dynamic IP = " : "Static IP = ");            sbResp.Append("</b>");            sbResp.Append(_netIf.IPAddress);            sbResp.Append("<p/>" + DateTime.Now.ToString());            sbResp.Append("</body></html>");            byte[] msgBody = Encoding.UTF8.GetBytes(sbResp.ToString());            context.Response.ContentEncoding = Encoding.UTF8;            context.Response.ContentType = "text/html";            context.Response.ContentLength64 = msgBody.Length;            context.Response.StatusCode = (int)HttpStatusCode.OK;            context.Response.OutputStream.Write(msgBody, 0, msgBody.Length);        }        #endregion    }




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.