FEZWiFi example

Debugging the OpenSocket routine in the driver, I find that var a is always “13.82.175.96:0\r\n” which is what causes the exception. My guess is that this string comes from the router.

Sorry, I was not at my PC yesterday, so my reply was not absolutely correct.
Before the command ‘OpenSocket’ returns, the string variable ‘a’ should have a content like this:
“On:52.245.4.70:0” where the part in the middle represents the Ip-Address of the requested url. The last digit represents the socket number which can be between 0 and 7 (should be 0 when the first socket is opened).
Here I see no \r\n. The ‘OpenSocket’ command regulary returns the number of the socket.
When the opening of the socket didn’t work correctly, the driver throws an exception and the application stops.
In my App I changed the driver so that it returns -1 if opening of the socket was not successful. If this is the case I try up to 15 times to open the socket before I give up.

I get errors building your app since the files that are referenced in your resources are missing on my computer.

I went over to store the Credentials for WiFi and Azure Account as resources so I can use .gitignore to prevent that I accidently publish them on GitHup.
If you want, you can comment out the lines using the Resources and hold the credentials directly in the code.
Of course you need an Azure Account (free Test Account) and must create a Storage Account (On Azure you get the credentials).

I took RoSchmi’s suggestion and return -1 if socket was not successful. I tried opening the socket 15 times. The interesting thing is that for the first 8 times the string a was
“13.82.175.96:0\r\n” // first try
“13.82.175.96:1\r\n” // second try

“13.82.175.96:7\r\n” // 8th try

On the 9th try the program hung.

I’m ready to just throw up my hands and put the FEZ board in the junk pile. I believe the wifi chip on the board is misbehaving. It kind of acts like it is in “AT command mode” rather than in “Spi” mode.

Is there no On: in the string before the Ip-Address and really \r\n at the end?

The WiFi module seems call successfully the DNS and resolve GHIs url to the correct IP-Address and it gets the time over ntp. Which firmware version does it show when booting?

The correct start-up message is:
WIND: PowerOn 171117-0328fe3-SPWF04S

Do you have the latest version of GHI examples?
-https://github.com/ghi-electronics/TinyCLR-Samples/tree/master/FEZ/FEZWiFi

No WIND:PowerOn message is shown in Debug output. And yes I am using the latest version of GHI examples.

In my App it can be Seen.

I was right for once! I reloaded the hex file into the wifi part and it fixed my problems. The problem was not in the driver software or the example code but in the wifi chip. Multi-processor systems can be hard to debug.

3 Likes