Reseting Network Interface G120 wifiRS9110

As I’m working with my new G120 card I’m running into the following problem.

Press F5 in VS 2010 to upload and start my program. (Right now I’m simply getting use to working with the Wifi Card).

Program Uploads and starts running.

All program does is initialize Wifi so that I can ping the interface.

The first time I run when there is no code at all on the board (Use MFDeploy “Erase” feature) program works great. Interface comes right up and I can ping away.

Stop the debugger in VS. Of course program keeps running on board and Green Light stays lit on Wifi Card and ping still replies.

Make some changes and reload code on board.

Interface light stays green, setup wifi run’s thru with no errors and reapplies static IP address. However Ping stops replying.

Power Cycle board and then Wifi reinitialize and works.

So I guess my question is there some way that I can “reset” the wifi card every time the program starts so that it does not seem to get confused? Kind of a hassle to unplug and plug in the board every time I make a change.

        

public static GHI.Premium.Net.WiFiRS9110 wifi = new GHI.Premium.Net.WiFiRS9110(SPI.SPI_module.SPI2, GL.G120.Pin.P1_10, GL.G120.Pin.P2_11, GL.G120.Pin.P1_9, 4000);

        //**********************************************************
        //***** Wifi Setup
        //**********************************************************
        private static void WifiSetup()
        {

            if (!wifi.IsOpen)
            {
                wifi.Open();
            }

            wifi.NetworkInterface.EnableStaticIP("216.62.58.6", "255.255.255.0", "216.62.58.34");

            GN.NetworkInterfaceExtension.AssignNetworkingStackTo(wifi);

            GN.WiFiNetworkInfo[] scanResults;

            scanResults = wifi.Scan();

            int ssidIDx = 0;
            for (int cnt = 0; cnt < scanResults.Length; cnt++)
            {
                Debug.Print(cnt.ToString() + "-" + scanResults[cnt].SSID);

                if (scanResults[cnt].SSID == "linksys")
                {
                    ssidIDx = cnt;
                }

            }


            wifi.Join(scanResults[ssidIDx], "danh5258");

            while (!wifi.IsLinkConnected)
            {
                Debug.Print("Not Connected");
                Thread.Sleep(2000);
            }


            while (true)
            {
                Debug.Print(wifi.NetworkInterface.IPAddress);
                Thread.Sleep(2000);

                if (wifi.NetworkInterface.IPAddress != "0.0.0.0")
                {
                    break;
                }
            }

        } // end WifiSetup
        //**********************************************************

Welcome to the forum! First thing first. Make sure you have the latest firmware.

4.2.9.0

See this please http://www.tinyclr.com/forum/topic?id=11074

Welcome to the community.

1 Like

That did it! Thanks for the help!

@ Gus - This is the new link to the answer https://www.ghielectronics.com/community/forum/topic?id=11074

1 Like