FEB 1 SDK G120 EWR - WiFi - DHCP

G120 - MF 4.2.8

Although hard to proof for me, I have some sense that the current related WiFi - DHCP - Socket problems on the G120 has to do with internal storage / memory management of variables in non volatile memory / flash.

I mentioned the example below in another topic, but for now added simple WiFi open - Close. Run this example using the debugger, restart the debug sessions 2 or 3 times and WiFi will try to update the firmware… Also notice that data in EWR is lost the 3rd run…

Found debugger!

Create TS.

Loading start at a0e00000, end a0e0fc38

Assembly: mscorlib ( Assembly: Microsoft.SPOT.Native ( Assembly: Microsoft.SPOT.Hardware (
Assembly: Microsoft.SPOT.Hardware.PWM ( Loading Deployment Assemblies.

Attaching deployed file.

Assembly: G120EWR ( Attaching deployed file.

Assembly: GHI.Premium.Net ( Attaching deployed file.

Assembly: GHI.Premium.System ( Attaching deployed file.

Assembly: Microsoft.SPOT.Hardware.Usb ( Attaching deployed file.

Assembly: GHI.Premium.Hardware.G120 ( Attaching deployed file.

Assembly: Microsoft.SPOT.Net ( Resolving.

GC: 1msec 304392 bytes used, 7035276 bytes available

Type 0F (STRING ): 24 bytes

Type 15 (FREEBLOCK ): 7035276 bytes

Type 17 (ASSEMBLY ): 11544 bytes

Type 1E (BINARY_BLOB_HEAD ): 292752 bytes

Type 34 (APPDOMAIN_HEAD ): 72 bytes

GC: performing heap compaction…

The debugging target runtime is loading the application assemblies and starting execution.

New configuration, defaults saved
The thread ‘’ (0x2) has exited with code 0 (0x0).
EWR test start
#### Exception GHI.Premium.Net.NetworkInterfaceExtensionException - 0x00000000 (1) ####
#### Message:
#### GHI.Premium.Net.WiFiRS9110::RunFirmware [IP: 0049] ####
#### GHI.Premium.Net.WiFiRS9110::Open [IP: 0014] ####
Start Updating WiFi module firmware:
This might take up to 1 minute
0 Sec
1 Sec
2 Sec
3 Sec
4 Sec
5 Sec
6 Sec
7 Sec
8 Sec
9 Sec
10 Sec

using System;
using System.Threading;
using GHI.Premium.Hardware;
using GHI.Premium.Net;
using GHI.Premium.System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace G120EWR
    public class Program
        private static readonly Configuration Config = new Configuration();
        private static WiFiRS9110 _wifi;

        public static void Main()
            Debug.Print("EWR test start");

            _wifi = new WiFiRS9110(SPI.SPI_module.SPI3, G120.Pin.P1_10, G120.Pin.P0_5, G120.Pin.P1_8);
                if (!_wifi.IsOpen)
            catch (Exception e)
                Debug.Print("WiFi Open Exception: " + e.Message);


            // Place a breakpoint here and restart a debug session.

    public sealed class Configuration
        private static ExtendedWeakReference _settingsReference;
        internal AppSettings Settings = new AppSettings();

        public Configuration()
            _settingsReference = ExtendedWeakReference.RecoverOrCreate(typeof (AppSettings), 0,
                                                                       ExtendedWeakReference.c_SurviveBoot |
            _settingsReference.Priority = (int) ExtendedWeakReference.PriorityLevel.System;
            Settings = _settingsReference.Target as AppSettings;
            if (Settings == null)
                // Must be a first time init
                Settings = new AppSettings();
                _settingsReference.Target = Settings;
                Debug.Print("New configuration, defaults saved");
                // -------------------------------------------------
                // !!! EWR destroyed when next method "PushBackIntoRecoverList" is called  !!!
                // -------------------------------------------------
                Debug.Print("Configuration loaded");

        public void Save()
            _settingsReference.Target = Settings;

    internal sealed class AppSettings
        public string SomeConfigData = "just some text";

@ GHI - Can someone confirm if this issue is picked up and/or could be reproduced? Thanks in advance.

EWR is what we are investigating as we speak.

We did some testing on this and we are not seeing any errors in our drivers. What we learned is that on 4.2, using PushBackIntoRecoverList in debugging will always wipe out the data on the next deployment but this works fine if the device run stand alone.

One way to handle this would be by using EWR the same way it is in this example C:\Users\Dat\Documents\Microsoft .NET Micro Framework 4.2\Samples\ExtendedWeakReferences

Your code works fine (I mean EWR, not relate to Wifi or Network) if you change it like the example code above and not use PushBackIntoRecoverList

@ Dat - Thanks for your reply, if i remember well we introduced using this method in 4.1 because of loosing data… at least it solved the problem in 4.1
As of today reading a topic about “In Field Update” i realize that storing data in EWR might not always be the best solution. I consider to store configuration data on a SD card. Will be think about more tomorrow. Have a good week-end!