IoT Labs WiFi module

@ munderhill - Mike I see that in Gadgeteer environment it export only K socket. This module can work via SPI ?

@ dobova - The WiFi portion of the board uses the ‘K’ socket. The Flash memory portion uses an ‘S’ socket.

1 Like

@ munderhill - Thank you Mike.

I’m trying some test. I got exception using WebServer() and asking a page “hello.html”. The board is a FEZ Spider.

The generating code:


        void gadgeteerWifi_Connected(object sender, EventArgs e)
        {
            WebServer webserver = new WebServer(gadgeteerWifi, null, 80);
            webserver.ActionRequested += webserver_ActionRequested;
            webserver.ResourceManager = Resources.ResourceManager;
            webserver.AddPage(@ "/hello.html", Resources.StringResources.HelloWorld);
            webserver.Start();

        }
        string webserver_ActionRequested(object sender, string context, Hashtable parameters)
        {
            Debug.Print("Context: " + context);
            return Resources.GetString(Resources.StringResources.HelloWorld);
        }


The event is never reached.
May be I’m doing something wrong …

@ dobova - Set the hostname parameter in the WebServer ctor such as new WebServer(gadgeteerWifi, “myWebServer”, 80);

@ munderhill - oops !
I just noted that if you omit the line defining the event

           
 webserver.ActionRequested += webserver_ActionRequested;

The board keep resetting itself…

@ dobova - Please send me the project via private message

@ munderhill - thanks, ok I will send tomorrow morning

For " board" I mean fez spider.

Hi munderhil, can you tell please how many socket connections this module can operate?

@ alex bilityuk - The module is capable of ~20 TCP connections according to Bluegiga, though I have not tested this limit.

Thank you for information!

@ munderhill - Hi Mike, I’ve worked a bit with new SDK and seems quite reliable. Some bugs are fixed! Nice job!
At what speed is serial sending data to the Bluegiga module ?

The serial connection is 115k, but I did not see any improvement in throughput with increased baud rate. Error rate goes up (not significantly) with hight baud rates.

@ munderhill - Hi Mike,
I still face a Bluegiga module shutdown after 1h (more or less) of response. All the blue leds go off and I need a FEZ board reset to restart the module.
Have you looked if this is some powersaving behaviour ? I checked on two different Wifi AP and the problem shows on both.

@ dobova - I don’t think it is a power saving feature. Please send me your code via a private message. I will take a look at it ASAP.

@ munderhill - Thanks Mike.
Ok I will send you the code tomorrow, but every simple code is enough for exploiting this problem, just connect() to wifi and start WebServer. I’ve now a page refreshing every 10sec and the problem still shows.
This happen to me on a Cerberus board. I will check tomorrow on a Spider. I’ve two bluegiga modules so I will check the other one too.

@ Mike: Some good news, got the gadgeteer wifi module running in plain NetMf using a CerbuinoBee and all in VS2015 8)

The code:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using IotLabs.Hardware.Bluegiga;
using IotLabs.Net;

namespace conWifi
{
    public class Program
    {
        public enum TimeZones : int { CentralEuropeanTime = 1 };
        public const Cpu.Pin resetPin = Cpu.Pin.GPIO_NONE;
        
        private static NativeWifi plainWifi;

        public static void Main()
        {
            plainWifi = new NativeWifi("COM2", (Cpu.Pin)6);
            plainWifi.Connected += new EventHandler(OnConnected);

            plainWifi.Connect("SSID", "THE KEY");
            
            Debug.Print(Resources.GetString(Resources.StringResources.String1));

            // wait forever
            while (true) { Thread.Sleep(1000); }
        }

        private static void OnConnected(object sender, EventArgs e)
        {
            Debug.Print("IP: " + plainWifi.IpAddress.ToString());
            DoYourThing();
        }

        private static void DoYourThing()
        {
            // For a start, get the time
            GetTimeFromSntpServer();
        }

        private static void GetTimeFromSntpServer()
        {
            var sntpClient = new SntpClient(plainWifi, "time-a.nist.gov", 123);
            sntpClient.ResponseReady += new EventHandler(OnSntpResponseReady);
            sntpClient.Get();
        }

        private static void OnSntpResponseReady(object sender, EventArgs e)
        {
            var client = sender as SntpClient;

            // Adjust to local time zone
            DateTime dt = client.UtcDateTime;
            dt = dt.AddHours((double)TimeZones.CentralEuropeanTime);

            Debug.Print("It should be about: " + dt.ToString());

        }
    }
}

And outcome (not related to some secret training program):

Found debugger!

Create TS.

 Loading start at 8078a04, end 809e990

   Assembly: mscorlib (4.3.1.0)     Assembly: Microsoft.SPOT.Native (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware (4.3.1.0)  
   Assembly: Microsoft.SPOT.Graphics (4.3.1.0)     Assembly: Microsoft.SPOT.TinyCore (4.3.1.0)  
   Assembly: Microsoft.SPOT.IO (4.3.1.0)     Assembly: System.IO (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware.Usb (4.3.1.0) 
    Assembly: Microsoft.SPOT.Hardware.SerialPort (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware.PWM (4.3.1.0)  
Loading Deployment Assemblies.

Attaching deployed file.

   Assembly: IotLabs.Hardware.Bluegiga.Wifi (1.0.0.0)  Attaching deployed file.

   Assembly: IotLabs.Net (1.0.0.0)  Attaching deployed file.

   Assembly: conWifi (1.0.0.0)  Resolving.

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

'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Native.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Graphics.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.TinyCore.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\System.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.Usb.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\IoT Labs\IL-G-WF121 SDK\v4.3\le\IotLabs.Hardware.Bluegiga.Wifi.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\IoT Labs\IL-G-WF121 SDK\v4.3\le\IotLabs.Net.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Users\Peter\Documents\Visual Studio 2015\Projects\CerbuinoBee\conBlink\conWifi\bin\Debug\le\conWifi.exe', Symbols loaded.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
Hello World!
IP: 192.168.39.18
It should be about: 11/14/2014 22:22:14
1 Like

@ PiWi - Awesome!

Ha, it worked on Cerberus as well, basic wifi stuff and using the Sntp as used before with the CerbuinoBee.

So far so good …

So let’s do some usefull stuff and get in the uCloudy source and go do some azure …

Compile it does, deploy, probably, but before (basic wifi and ntp) I had a blinking LED on the Cerberus now I have the LED permanently off, it should light up as a heartbeat, everytime it goes to the cloud it lights up and goes off when complete with or without an error.

Hitting F5 in VS2015 in gives me the following outcome (now there is some secrecy coming in for me)

Found debugger!

Create TS.

 Loading start at 8078a04, end 809e990

   Assembly: mscorlib (4.3.1.0)     Assembly: Microsoft.SPOT.Native (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware (4.3.1.0)  
   Assembly: Microsoft.SPOT.Graphics (4.3.1.0)     Assembly: Microsoft.SPOT.TinyCore (4.3.1.0)  
   Assembly: Microsoft.SPOT.IO (4.3.1.0)     Assembly: System.IO (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware.Usb (4.3.1.0) 
    Assembly: Microsoft.SPOT.Hardware.SerialPort (4.3.1.0)     Assembly: Microsoft.SPOT.Hardware.PWM (4.3.1.0)  
Loading Deployment Assemblies.

Attaching deployed file.

   Assembly: System.Http (4.3.1.0)  Attaching deployed file.

   Assembly: Microsoft.SPOT.Net.Security (4.3.1.0)  Attaching deployed file.

   Assembly: uCloudy (1.0.1.0)  Attaching deployed file.

   Assembly: IotLabs.Hardware.Bluegiga.Wifi (1.0.0.0)  Attaching deployed file.

   Assembly: System.Net.Security (4.3.1.0)  Attaching deployed file.

   Assembly: System (4.3.1.0)  Attaching deployed file.

   Assembly: Microsoft.SPOT.Net (4.3.1.0)  Attaching deployed file.

   Assembly: IotLabs.Net (1.0.0.0)  Attaching deployed file.

   Assembly: wifiOnCerberus (1.0.0.0)  Resolving.

Resolve: unknown type: System.Diagnostics.DebuggerBrowsableState

Error: ff000000

Waiting for debug commands...

The program '[9] Micro Framework application: Managed' has exited with code 0 (0x0).

Adding System.Diagnostics … same error …

It might be that this is what one could get, running on the bleeding edge of things …

Anybody, any ideas ?

@ PiWi - I’ve seen that error before (not in VS2015), can’t remember exactly but it may be a missing assembly. Also if I remember correctly, Azure uses a https connection which is not currently supported by the Bluegiga firmware. They say it will be released by the end of November and it will take me a few weeks after that to update the SDK. I will keep you updated.

@ Mike: Thanks for the info, I’ll wait when the update turns up, I’m not in a rush, maybe I was pushing my luck with VS2015 a bit …

I already reverted back to the basic wifi with simple sntp and that runs, now continue from there to do some multi sockets or so, to see where I get …