Wifi Shield stops sending after sometime.

In trying to find the root cause of this problem I ran a network trace, and the trace suggests the problem lies either in the WiFi101 driver, the WiFi Shield firmware, the Arduino Mega 2560 firmware, or any combination of the three. I say that because it is the Arduino that is issuing retry's to the client.

Summary of what I can tell so far:

  • The "freeze" occurs whether use the WiFi101 card as a Web Server or Web Client.
  • The "freeze" happens if I access the card using either of the following methods:
  • Chrome
  • Microsoft Powershell
  • The serial port spews garbage data when the "freeze" occurs
  • Sometimes the sketch stops running, but not always
  • Sometimes the serial port stops running, but otherwise the sketch seems to continue running

Here is what a network trace shows when the failure occurs:
Set up:

  • Arduino Mega 2560 with a WiFi 101 card installed
  • WiFi 101 configured as a server
  • My client was a Windows 2012 Server, running power shell script as admin (script is given further below)
  • I ran NetMon on the server where I was doing the request (For those of you who do a lot of network trace captures, I know running the sniffer on the same machine as the client is not the best practice, but in my case, the server was not busy doing anything else, it has plenty of memory and CPU speed, and under those circumstances I think it was not a bad approach to do the capture)
  • What you see:
  • The trace looks normal for a while,
  • After a few minutes, the WiFi101 card issues a retry (for more information on this, see MSDN explanation)
  • The server resends,
  • The WiFi101 issues a second retry
  • The server responds again.
  • After that, the WiFi 101 goes "silent"

My Powershell Script (client):

$a = 1;
$b = 0;
$web= New-Object Net.Webclient
do
{
        $b = $b+1;
        $b;
        $webstr = $web.downloadString("http://192.168.12.147");
       
        $lines = $webstr;
       
 
  # the lines from here down have nothing to do with the aruduino "freeze"
  # I have just included them for sake of completeness
  # this script "scrapes" the web page served up by the arduino
      
        $dex = $lines.indexof("<p>");
        $lines = $lines.substring($dex);
        #$lines;
        $dex = $lines.indexof("</html");
        $lines = $lines.substring(0,$dex);
        #$lines;
        $lines = $lines.replace("</p>","");
        #$lines;
        $lines = $lines.replace("<p>","");
        #$lines;
       
        $split = $lines.split(",");
 
 
        [regex]$r="[^a-zA-Z]"
        $split | ForEach-Object {$_ -Replace "$r",""}
        $split;
        [regex]$regex = 'RDAQ_ID';
        $nResults = $regex.matches($Split).count;
       
       
        $lastItem = $split.length - 1;
        $strLen = $split[$lastItem].length-2;
        $g = $split[$lastItem];we
        $g = $g.substring(0,$strLen);
        $split[$lastItem] = $g;
       
        $split;      
        start-sleep -s 10;
 
} while ($a -eq 1)

failedPowershell.cap.zip (58.4 KB)