I believe there is a bug in the WiFi programming for SimpleIDE and the terminal output
idbruce
Posts: 6,197
in Propeller 1
I have attached a sample program which demonstrates what I believe is a bug, but I could be wrong and I may not being doing something properly. The sample program retrieves text from a web page on the internet. The text from the web page is the word "SUCCESS", which is 7 letters long. After retrieving the response from the website, the program breaks the response down to the content of the webpage, which as I said is 7 letters long. The program then determines the length of the content (7 letters) and outputs this number to the terminal.
Problem #1: The program is an endless loop, but only runs 7 times.
Problem #2: An extra square character is added to the front of the output occassionally.
Problem #1: The program is an endless loop, but only runs 7 times.
Problem #2: An extra square character is added to the front of the output occassionally.
Comments
The handle you got when you started the connection needs to be closed otherwise it doesn't know to release it.
You need to call wifi_disconnect(handle) to release the connection back to the pool of 5 connections.
Mike
I tried that function before I posted my new thread
The following code produces the same result.
EDIT: And that is why I am testing string length instead of the string itself I believe it is a BUG
A possible third bug is associated with pin 0. Pin 0 outputs a short pulse about once every few seconds.
Using the tcp connect command cause a connection to be allocated from the pool but if there is a DNS error or connection error this pooled connection gets orphaned. After 5 bad connection attempts the pool is exhausted and no further connections are possible.
In sscp-tcp.c there should be sscp_close_connection(c); added before returning an error code to the calling application.
That is being worked on. I don't have this issue since I patched my version of the board already.
An easy way to check if this is happening is to watch the handle that come back from the connect command. If it changes on each connect there is a problem. Also there is a debug web page that shows a lot of good information about what is going on.
Mike
The handle remains the same with every iteration.
This is really disappointing to have this problem. I bought the WiFi module specifically for this task.
EDIT: It won't even run an endless loop. If I had just burnt my money, at least I would not have had several hours of aggravation.
So far the answer is there.
Also you need to do "pCharacterPointer = strstr(chResponse,"\r\n\r\n");" to find the end of the Header data.
Mike
The garbage character you are seeing is from the code disabling the serial port when it runs the "wifi_scan" code. It doesn't need to do this but it does. This is outside the WiFi data though and does not show up in the data.
Here is some revised code that worked for me:
Mike
After changing the DO and DI pins, I ran your revised code, but the terminal screen doesn't show anything but a blinking cursor.
However, your TestPrint function has given me an idea that is worth checking.
EDIT: Additionally, moving wifi_start outside of the loop did allow the program to continue. Thank you for that. I appreciate it.
It runs 24x7 with no problem so yours should have no issues as well.
Mike
I am finally getting to the bottom of this, with your help of course. I sincerely thank you for your time and effort that you have put into assisting me.
Of course I could still be wrong, but the bug now appears to be in the communication with the SimpleIDE terminal and not in the WiFi module or the response or the actual content.
The program below does an actual comparison of the known string, in this case, the word "SUCCESS". If the comparison is equal, I instruct the terminal to output "It is equal". If the comparison is unequal, I instruct the terminal to output "It is unequal". When running the program, the output is always "It is equal", so the data is indeed intact, however the pesky little square still remains, and is output every other line.
I agree completely. I don't know what I was thinking
Thanks for that catch David, I appreciate it.
This is putting the input pin into high mode causing the serial driver to input a bunch of 0xff characters into the terminal connection. They don't effect the data coming from the WiFi module so all is good.
I guess this is a bug since the variable "wifi_comSelectPin" is never changed and is always zero.
Mike
Now that we have gotten to the bottom of this problem, mostly you , hopefully Parallax will fix it, which will help prevent future users of the WiFi module from going "BONKERS" and wasting time on a futile endeavor.
Thanks Mike