G120 low level 3 exception 4.2.10

@ GHI any news… I need to take serious decision on how to continue if this issue can’t be solved within a reasonable period of time. It’s hard me for me to imagine that the problem is not seen at GHI because i am not the only user mentioning this problem.

IIRC, you said this problem didn’t happen a second time so it must be extremely rare to happen.

#7 was the second time… i was waiting and i didn’t report more events after you wrote
"we might have something" 2 other customers returned their device this week with corrupted flash. if the config flash is corrupted it start to output low level exceptions at the serial port

@ Gus - We’ve saw the problem with the G120 modules, the reason we wouldn’t see it more is because we had to shelve the G120 design and go back to the EMX until firmware problems with the G120 were fixed.

Dat reported he had fixed the problem with USB disconnection not being reported, and it would be out in the next SDK release. You also said hibernate support was close, and we were hoping to see that soon too. Do you have any time-frame for an SDK with those fixes?

SDK comes very soon. No set date yet but we are working on it very closely.

Please email to GHI and we will send you a fixed firmware for testing!

@ Dat - Unfortunately this fix did not solve the issue that config flash gets corrupt and exceptions messages are send to com port :frowning:

I used the following setup:

A custom G120 board connected to a power supply that switch on automatically and leaves power at the board for 1,5 minute. after 1.5 minute it switches the power down for 2 seconds and starts over.

The test code is basicly setup the RS9110 module. The first time as infra structure mode and the next time the system startsup it will setup RS9110 in AD-Hoc mode.

Changing the wifi mode makes sure that write actions take place to flash.

After 132 startups the system crashed.

@ RobvanSchelven -

Show us that code, please!

@ Dat - I did a second test… after 150 cycles it crashed again. I changed the code to start-over faster, instead of waiting 1,5 minutes… i just wait 2 seconds once Wi-Fi was initialized and running. this 3th test after about 30 cycles the system starts to output the following message to com1

6:21:13.985 socket available=0
6:21:14.254 socket available=0
6:21:14.523 socket available=0
6:21:14.791 socket available=0
6:21:15.60 socket available=0
6:21:15.328 socket available=0
6:21:15.596 socket available=0
6:21:15.865 socket available=0
6:21:16.134 socket available=0
6:21:16.402 socket available=0
6:21:16.670 socket available=0

I know you need code to test but this will cost me again a large amount of time to isolate it. I am not sure if i need to invest more time in to this module :frowning:

@ RobvanSchelven -

Just one thing I can say is, let me try to reproduce it on Monday.
One more question:

Does “6:21:13.985 socket available==0” come from your Debug.print() or you just see it over com port?

One customer confirmed bug overload number socket is gone (he didn’t see it in one week and continue testing) , it can be destroyed by self, doesn’t matter global or local, so it is weird for me.

@ Dat - Below you find code to reproduce the low level exception. The socket available=0 comes from my debug print. I think we can forget it for a while because i need to do more testing on that.

You need to run the code for a while. Here the exception shows up after about 130 itterations


// added references:
// GHI.Hardware.G120;
// GHI.Premium.Hardware
// GHI.Premium.Net
// Microsoft.SPOT.Hardware;
// Microsoft.SPOT.Hardware.SerialPort
// Microsoft.SPOT.Native
// Microsoft.SPOT.Net
// mscorlib

using System;
using System.Diagnostics;
using System.IO.Ports;
using System.Threading;
using GHI.Hardware.G120;
using GHI.Premium.Hardware;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHI.Premium.Net;


public class Program
{
    public static WiFiRS9110 Wifi;

    public static void Main()
    {
        DebugHelper.UseRs232();
        DebugHelper.DebugPrint("Start");

        Wifi = new WiFiRS9110(SPI.SPI_module.SPI3, Pin.P1_10, Pin.P0_5, Pin.P1_8);

        if (!Wifi.IsOpen)
            Wifi.Open();

        // Abuse the the realtime clock year variable as temp persistent variable

        if (RealTimeClock.GetTime().Year == 2000)
        {
            DebugHelper.DebugPrint("Start Infra mode");
            RealTimeClock.SetTime(new DateTime(2013, 1, 1, 0, 0, 0));

            if (!Wifi.NetworkInterface.IsDhcpEnabled)
                Wifi.NetworkInterface.EnableDhcp();

            Wifi.NetworkAddressChanged += WifiNetworkAddressChanged;
            Wifi.WirelessConnectivityChanged += WifiWirelessConnectivityChanged;

            NetworkInterfaceExtension.AssignNetworkingStackTo(Wifi);

            WiFiNetworkInfo[] scanResult = Wifi.Scan();
            for (int i = 0; i < scanResult.Length; i++)
            {
                if (scanResult[i].SSID == "MatRouter")
                {
                    Wifi.Join(scanResult[i], "Wi$1024Fi");
                    break;
                }
            }

            while (Wifi.NetworkInterface.IPAddress == "0.0.0.0")
            {
                Thread.Sleep(500);
            }
        }
        else
        {
            DebugHelper.DebugPrint("Start Adhoc");
            RealTimeClock.SetTime(new DateTime(2000, 1, 1, 0, 0, 0));
            Wifi.StartAdHocHost("MyAdhoc", SecurityMode.Open, "", 6);
            Wifi.NetworkInterface.EnableStaticIP("169.254.0.200", "255.255.0.0", "169.254.0.1");
        }
        DebugHelper.DebugPrint("Reboot");

        Thread.Sleep(5000);
        PowerState.RebootDevice(true);
    }


    private static void WifiWirelessConnectivityChanged(object sender, WiFiRS9110.WirelessConnectivityEventArgs e)
    {
        DebugHelper.DebugPrint("Wireless Connectivity changed");
    }

    private static void WifiNetworkAddressChanged(object sender, EventArgs e)
    {
        DebugHelper.DebugPrint("Network address change");
    }



    public static class DebugHelper
    {
        private static bool _outputModeRs232;
        private static SerialPort _s;

        [Conditional("DEBUG")]
        public static void DebugPrint(string msg)
        {
            Debug.Print(msg);
            if (_outputModeRs232)
            {
                var buffer = new byte[msg.Length + 2];
                for (int i = 0; i < msg.Length; i++)
                {
                    buffer[i] = (byte) msg[i];
                }
                buffer[buffer.Length - 2] = 0xA;
                buffer[buffer.Length - 1] = 0xD;
                _s.Write(buffer, 0, buffer.Length);
            }
        }

        [Conditional("DEBUG")]
        public static void UseRs232()
        {
            _outputModeRs232 = true;
            _s = new SerialPort("COM1", 115200);
            _s.Open();
        }
    }
}

@ Dat - I’ve just done some testing with the 9.2.10.2 firmware you sent, and the failure to see USB disconnection problem is still there.
https://www.ghielectronics.com/community/forum/topic?id=12436&page=1#msg126878

Test 1 - Start with USB attached

State Reported
Att Att
Det Det
Att Att
Det Det
Att Att
Det No change
Att Det, Att (when attached shows detach,then after a delay attached)
Det Det
Att Att
Det Det (And then continued operating correctly for 5 cycles until I stopped)

[b]Test 2 - Start with USB detached

State Reported[/b]

Att Att
Det No change
Att No change
Det No change
Att Det, Att
Det No change
Att Det, Att
Det Det
Att Att
Det no change
Att Det, Att
Det no change
Att Det, Att

So it seems that USB disconnected detection is not reliable or usable yet.

@ Dat - I’ve done some more testing with the G120 9.2.10.2 test firmware, this time testing the hibernate function.

Hibernate now appears to work, rather than crashing immediately as with the previous version firmware. Awakening after a short period of hibernation works correctly, however after hibernating for a longer period the device crashes immediately after awakening.

I can’t quantity the periods as yet - I’ll try adding a time-stamp to the debug prints and do some more testing when I get a chance. However identical code running on the EMX functions robustly.

Debug output from hibernate sequence. First was short, only a few seconds. Second, where it crashed, was a few minutes. It just kept on with the “Exception 6” messages until reset.


Version: 4.2.10.1
Debug: COM1
LCD: 0x0
.NetMF v4.2.0.0
G120, Build Date:
        Jul 25 2013 09:33:12
ARM Compiler version 410713

TinyCLR (Build 4.2.0.0)

Starting...
Created EE.
Started Hardware.
MSdbgV1¸±Gwß\PCreate TS.
 Loading start at a0e85788, end a0e9cee4
   Assembly: mscorlib (4.2.0.0)     Assembly: Microsoft.SPOT.Native (4.2.0.0)     Assembly: Microsoft.SPOT.Hardware (4.2.0.0)     Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1)     Assembly: Microsoft.SPOT.Security.PKCS11 (4.2.0.0)     Assembly: System.Security (4.2.0.0)  Loading Deployment Assemblies.
Attaching deployed file.
   Assembly: GHI.Premium.IO (4.2.10.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.Graphics (4.2.0.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.TinyCore (4.2.0.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.Hardware.Usb (4.2.0.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.IO (4.2.0.0)  Attaching deployed file.
   Assembly: GHI.Premium.System (4.2.10.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.Touch (4.2.0.0)  Attaching deployed file.
   Assembly: GHI.Premium.USBClient (4.2.10.0)  Attaching deployed file.
   Assembly: System (4.2.0.0)  Attaching deployed file.
   Assembly: GHI.Premium.Hardware (4.2.10.0)  Attaching deployed file.
   Assembly: System.IO (4.2.0.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.Net (4.2.0.0)  Attaching deployed file.
   Assembly: GHI.Hardware.G120 (4.2.10.0)  Attaching deployed file.
   Assembly: AlcoaAnodeMeter (2.1.4958.20561)  Attaching deployed file.
   Assembly: GHI.Hardware.EMX (4.2.10.0)  Attaching deployed file.
   Assembly: System.Xml (4.2.0.0)  Resolving.
GC: 1msec 528384 bytes used, 6811284 bytes available
Type 0F (STRING              ):     24 bytes
Type 15 (FREEBLOCK           ): 6811284 bytes
Type 17 (ASSEMBLY            ):  31296 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1E (BINARY_BLOB_HEAD    ): 496512 bytes
Type 28 (MEMORY_STREAM_HEAD  ):     36 bytes
Type 29 (MEMORY_STREAM_DATA  ):    396 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
GC: performing heap compaction...
Ready.
USB Attached
USB Detached
Hibernate
Awaken
Hibernate
Awaken
EXCEPTION 0x06:
  cpsr=0xa1002800
  pc  =0x00005bb2
  lr  =0x00010010
  sp  =0x1000fde8
  r00 =0x00000445
  r01 =0xa097db3c
  r02 =0xfffffff8
  r03 =0x00010010
  r04 =0xa030209c
  r05 =0x00000000
  r06 =0xa097da68
  r07 =0x00000000
  r08 =0xa097dad8
  r09 =0xa0024d18
  r10 =0x00000001
  r11 =0x00000000
  r12 =0x01ce8c4e
EXCEPTION 0x06:
  cpsr=0x00000000
  pc  =0xa097da68
  lr  =0x00000000
  sp  =0x1000fdc8
  r00 =0x00000445
  r01 =0xa097db3c
  r02 =0xfffffff8
  r03 =0x00010010
  r04 =0xa030209c
  r05 =0x00000000
  r06 =0xa097da68
  r07 =0x00000000
  r08 =0xa097dad8
  r09 =0xa0024d18
  r10 =0x00000001
  r11 =0x00000000
  r12 =0xa030209c

And now after a still longer sleep (around 30 minutes) it refuses to wake at all.

@ C-Born -

Hi, thank for your feed back

I just ran code from that link and the result is good. Are you using same that code or different one? if so, can you show us please?

And is it 100% you can reproduce it?
And, one time it happened, how about if you unplug and reconnect again? Does it still work incorrectly or correctly after that?

Start with USB detached
0 USBState: 1
1 USBState: 6
2 USBState: 6
3 USBState: 6
4 USBState: 6
5 USBState: 6
6 USBState: 6
7 USBState: 6
8 USBState: 6
9 USBState: 6
10 USBState: 4
11 USBState: 5 (Connected)
12 USBState: 5 (Connected)
13 USBState: 5 (Connected)
14 USBState: 5 (Connected)
15 USBState: 5 (Connected)
16 USBState: 5 (Connected)
17 USBState: 5 (Connected)
18 USBState: 5 (Connected)
19 USBState: 5 (Connected)
20 USBState: 5 (Connected)
21 USBState: 5 (Connected)
22 USBState: 5 (Connected)
23 USBState: 5 (Connected)
24 USBState: 6
25 USBState: 6
26 USBState: 6
27 USBState: 6
28 USBState: 6
29 USBState: 6
30 USBState: 6
31 USBState: 6
32 USBState: 6
33 USBState: 6
34 USBState: 6
35 USBState: 6
36 USBState: 6
37 USBState: 6
38 USBState: 6
39 USBState: 6
40 USBState: 1
41 USBState: 5 (Connected)
42 USBState: 5 (Connected)
43 USBState: 5 (Connected)
44 USBState: 5 (Connected)
45 USBState: 5 (Connected)
46 USBState: 5 (Connected)
47 USBState: 5 (Connected)
48 USBState: 5 (Connected)
49 USBState: 5 (Connected)
50 USBState: 5 (Connected)
51 USBState: 6
52 USBState: 6
53 USBState: 6
54 USBState: 6
55 USBState: 5 (Connected)
56 USBState: 5 (Connected)
57 USBState: 5 (Connected)
58 USBState: 5 (Connected)
59 USBState: 5 (Connected)
60 USBState: 5 (Connected)
61 USBState: 5 (Connected)
62 USBState: 6
63 USBState: 6
64 USBState: 6
65 USBState: 3
66 USBState: 5 (Connected)
67 USBState: 5 (Connected)
68 USBState: 5 (Connected)
69 USBState: 5 (Connected)
70 USBState: 6
71 USBState: 6
72 USBState: 6
73 USBState: 6
74 USBState: 6
75 USBState: 6
76 USBState: 6
77 USBState: 6
78 USBState: 6
79 USBState: 6
80 USBState: 6
81 USBState: 6
82 USBState: 6
83 USBState: 6
84 USBState: 6
85 USBState: 6
86 USBState: 5 (Connected)
87 USBState: 5 (Connected)
88 USBState: 5 (Connected)
89 USBState: 5 (Connected)
90 USBState: 5 (Connected)
91 USBState: 5 (Connected)
92 USBState: 5 (Connected)
93 USBState: 5 (Connected)
94 USBState: 6
95 USBState: 6
96 USBState: 6
97 USBState: 6
98 USBState: 6
99 USBState: 6
100 USBState: 6
101 USBState: 6
102 USBState: 5 (Connected)
103 USBState: 5 (Connected)
104 USBState: 5 (Connected)
105 USBState: 5 (Connected)
106 USBState: 6
107 USBState: 6
108 USBState: 6
109 USBState: 6
110 USBState: 5 (Connected)
111 USBState: 5 (Connected)
112 USBState: 5 (Connected)
113 USBState: 6
114 USBState: 6
115 USBState: 6
116 USBState: 6
117 USBState: 6
118 USBState: 5 (Connected)
119 USBState: 5 (Connected)
120 USBState: 5 (Connected)
121 USBState: 5 (Connected)
122 USBState: 5 (Connected)
123 USBState: 5 (Connected)
124 USBState: 6
125 USBState: 6
126 USBState: 6
127 USBState: 6
128 USBState: 6
129 USBState: 6
130 USBState: 6

Start with USB attacthed

0 USBState: 1
1 USBState: 5 (Connected)
2 USBState: 5 (Connected)
3 USBState: 5 (Connected)
4 USBState: 5 (Connected)
5 USBState: 5 (Connected)
6 USBState: 5 (Connected)
7 USBState: 6
8 USBState: 6
9 USBState: 6
10 USBState: 6
11 USBState: 6
12 USBState: 5 (Connected)
13 USBState: 5 (Connected)
14 USBState: 5 (Connected)
15 USBState: 5 (Connected)
16 USBState: 5 (Connected)
17 USBState: 5 (Connected)
18 USBState: 5 (Connected)
19 USBState: 5 (Connected)
20 USBState: 5 (Connected)
21 USBState: 5 (Connected)
22 USBState: 5 (Connected)
23 USBState: 5 (Connected)
24 USBState: 5 (Connected)
25 USBState: 5 (Connected)
26 USBState: 5 (Connected)
27 USBState: 6
28 USBState: 6
29 USBState: 6
30 USBState: 6
31 USBState: 6
32 USBState: 6
33 USBState: 6
34 USBState: 6
35 USBState: 6
36 USBState: 6
37 USBState: 5 (Connected)
38 USBState: 5 (Connected)
39 USBState: 5 (Connected)
40 USBState: 5 (Connected)
41 USBState: 5 (Connected)
42 USBState: 5 (Connected)
43 USBState: 5 (Connected)
44 USBState: 5 (Connected)
45 USBState: 5 (Connected)
46 USBState: 5 (Connected)
47 USBState: 5 (Connected)
48 USBState: 5 (Connected)
49 USBState: 5 (Connected)
50 USBState: 5 (Connected)
51 USBState: 6
52 USBState: 6
53 USBState: 5 (Connected)
54 USBState: 5 (Connected)
55 USBState: 5 (Connected)
56 USBState: 5 (Connected)
57 USBState: 5 (Connected)
58 USBState: 5 (Connected)
59 USBState: 5 (Connected)
60 USBState: 5 (Connected)
61 USBState: 5 (Connected)
62 USBState: 5 (Connected)
63 USBState: 5 (Connected)
64 USBState: 6
65 USBState: 6
66 USBState: 6
67 USBState: 6
68 USBState: 6
69 USBState: 6
70 USBState: 5 (Connected)
71 USBState: 5 (Connected)
72 USBState: 5 (Connected)
73 USBState: 5 (Connected)
74 USBState: 5 (Connected)
75 USBState: 5 (Connected)
76 USBState: 6
77 USBState: 6
78 USBState: 6
79 USBState: 6
80 USBState: 6
81 USBState: 6
82 USBState: 6
83 USBState: 6
84 USBState: 6
85 USBState: 6

And I tested on FEZ CorbaII, how about you?

What is that???

@ ianlee74 - I think DAT needs a holiday break :smiley:

It’s looks like morning fingers before coffee has time to work syndrome!! :slight_smile:

It is a big Whale like creature I think :wink: