You must be logged in to reply.

Page 1 of 1 out of 5 messages.

wifiRS21.NetworkInterface.Scan() causes reboot

Posted 3yr ago
by SaschaSchwegelbauer | Newbie | 114 exp
Posted 3yr ago
by SaschaSchwegelbauer | Newbie | 114 exp
Hi,

I've got a RS21 WiFi-Interface connected to a Spider via Port 6.
When calling wifiRS21.NetworkInterface.Scan(), the mainboard immediately reboots.
It's reproducable using a completely new Gadgeteer Application (.NETMF 4.3) just with these two lines in code:

public partial class Program
{
	public void ProgramStarted()
	{
		this.wifiRS21.NetworkInterface.Open();
		var scan = this.wifiRS21.NetworkInterface.Scan();
	}
}


This makes the Spider-Board reboot immediately. What am I doing wrong? Firmware and Loader are both at the most current version.
Reply #1 — Posted 3yr ago
by Dave McLaughlin | Legend | 58,471 exp
Reply #1 — Posted 3yr ago
by Dave McLaughlin | Legend | 58,471 exp
I don't use Gadgeteer myself but I think you should create a thread for the WiFi and then inside that to do the scan. Better to keep anything in ProgramStarted to just initialise calls and start threads to do the rest.

See if that sorts out your issues.
Reply #2 — Posted 3yr ago
by Mike | Superhuman | 82,265 exp
Reply #2 — Posted 3yr ago
by Mike | Superhuman | 82,265 exp
@SaschaSchwegelbauer - sounds like a power supply issue. try powering board from a powered USB hub.
Reply #3 — Posted 3yr ago
by SaschaSchwegelbauer | Newbie | 114 exp
Reply #3 — Posted 3yr ago
by SaschaSchwegelbauer | Newbie | 114 exp
@Dave McLaughlin - I've updated the test-code, but it does not help Sad

public partial class Program
{
  private Thread scanThread;

  public void ProgramStarted()
  {
    this.scanThread = new Thread(() =>
    {
      this.wifiRS21.NetworkInterface.Open();
      var scan = this.wifiRS21.NetworkInterface.Scan();
    });

    this.scanThread.Start();
  }
}


@Mike - it's already connected via a powered USB-Hub (made by "Anker")
Reply #4 — Posted 3yr ago (modified)
by RoSchmi | King | 26,846 exp
Reply #4 — Posted 3yr ago (modified)
by RoSchmi | King | 26,846 exp
@SaschaSchwegelbauer - Hi Sacha,
As mike already mentioned rebooting Points on a power issue. I would try to Exchange the Gadgeteer cables of the power module and the WiFi Module.
This code worked for me some months ago:
using GHI.Networking;
.....
.....
public partial class Program
    {
        void ProgramStarted()
        {
            wifiRS21.NetworkUp += wifiRS21_NetworkUp;
            wifiRS21.NetworkDown += wifiRS21_NetworkDown;
            wifiRS21.NetworkInterface.Open();
            wifiRS21.NetworkInterface.EnableDhcp();
            wifiRS21.NetworkInterface.EnableDynamicDns();
            WiFiRS9110.NetworkParameters[] scanResult = wifiRS21.NetworkInterface.Scan();
            for (int i = 0; i < scanResult.Length; i++)
            {
                    if (scanResult[i].Ssid == "MySSID")
                {
                    try
                    {
                        wifiRS21.NetworkInterface.Join(scanResult[i].Ssid, "MyPassword");
                    }
                    catch (WiFiRS9110.JoinException e)
                    {
                        Debug.Print("Error Message: " + e.Message);
                    }
                    break;
                }
            }
            while (wifiRS21.NetworkInterface.IPAddress == "0.0.0.0")
            {
                Thread.Sleep(500);
            }
            Debug.Print("Ip-Address = " + wifiRS21.NetworkInterface.IPAddress);
        }
        void wifiRS21_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Network is down!");
        }
        void wifiRS21_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Network is up!");
            
        }

Page 1 of 1 out of 5 messages.

You must be logged in to reply.