Page 1 of 7

WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Tue Aug 31, 2010 1:34 am
by follower
[Update: See WiFly Shield code library alpha 2 release (also SPI UART) for the latest release.]

Thanks for your feedback on the WiFly Shield code library alpha 0 release.

Mainly due to the support for the new 14MHz crystal frequency I've made an alpha 1 release available for download and testing: http://sparkfun.com/Code/wifly/WiFly-20 ... lpha-1.zip

NOTE: If you have the older 12 MHz crystal board you need to change "USE_14_MHZ_CRYSTAL" value in SpiUart.cpp to 'false'.

(The small rectangular component near Arduino pins 6 & 7 will be engraved with 12.288 if you have the older crystal frequency.) If you have the newer frequency no change is necessary.

The changelog for this release is:
Code: Select all
+ alpha 1 -- 31 August 2010 -- "August Gratitude"

  * Change default crystal speed to match new 14MHz crystal used.
    NOTE: People using the older 12MHz crystal will need to change
          "USE_14_MHZ_CRYSTAL" in SpiUart.cpp to 'false'.

  * Added ability to set baud rate at runtime in SpiUart class.
    (Note: This ability to change the baudrate has not yet been propagated
    to the WiFly class.)

  * Renamed Spi.h to _Spi.h in order to avoid clashes with the other
    library by the same name as the IDE might (and has) mistakenly
    included ours instead of the the other one which results in
    confusing error messages.

  * Changed the case of the 'examples' directory so it gets displayed
    in the IDE correctly.
I'm still in the process of getting the source repository publicly viewable.

Additional functionality will hopefully appear in the next alpha release.

--Philip;

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Sat Sep 04, 2010 7:50 am
by LMas
Thank you very much i am trying this one now.:)

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Wed Sep 08, 2010 12:25 pm
by csbaum
Has any one looked into the option of setting the IP via code? I am thinking of adding the wifly to a set of mobile robots and would like to manually control the ip's that they have. I am more than willing to take a stab at adding the new function, but at the moment, I don't have a wifly to test with.

Sean

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Mon Sep 13, 2010 9:11 am
by LMas
DPontes wrote: After connecting the shield to the Arduino, and having it connected to USB port, should I get any LED to light up?

I was hoping to get some help regarding this...

Thanks in advance.
Yes it is it lights up without any code on arduino (green and yello leds)

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Mon Sep 13, 2010 3:48 pm
by LMas
and 3.3V pins as well.
i think its Vin pin need to be connected not 3.3V pin :)

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Tue Sep 14, 2010 1:29 pm
by LMas
:) glad to be helpful

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Tue Sep 21, 2010 6:32 am
by follower
csbaum wrote:Has any one looked into the option of setting the IP via code? I am thinking of adding the wifly to a set of mobile robots and would like to manually control the ip's that they have. I am more than willing to take a stab at adding the new function, but at the moment, I don't have a wifly to test with.
My intention is to match the Ethernet begin() functionality for setting the IP address etc:
Code: Select all
Ethernet.begin(mac, ip); 
Ethernet.begin(mac, ip, gateway); 
Ethernet.begin(mac, ip, gateway, subnet); 
You can't specify the MAC address with the WiFly though so that would require removing that value from the parameters (I'd like to be able to make it 100% compatible but I think that makes it unnecessarily complicated for WiFly users):
Code: Select all
WiFly.begin(ip); 
WiFly.begin(ip, gateway); 
WiFly.begin(ip, gateway, subnet); 
Without having looked at it too closely, implementing it should be fairly straightforward and would require disabling DHCP and then using the "set ip ..." commands.

For reasons of compatibility the method of supplying the address should be the same as the Ethernet library.

It would be nice if there was someway to indicate Auto-IP and/or Ad Hoc network setup also but I haven't considered the details for that.

--Philip;

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Wed Sep 22, 2010 6:27 am
by racine_20
Greating people,

Could you implement most functions to use Wifly with UDP protocol for the next release please ?
Existant functions are for TCP protocol ....

Another idea if you want, Try to use another method for getting IP and other parameters from Wifly , because, to use parsed *char is very very slow ....

Thx for your next release ;)

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Thu Sep 30, 2010 9:22 am
by faquin
Hello,
I've been using the Library1 alpha1 to read a sensor temperature and update a webpage every 5 minutes.
It's working great but after sometime it's stopping. Using some Serial.print() as debugger, I found that the issue is inside the function WiFlyDevice::waitForResponse. The board has difficulties to connect (my signal il quite poor) and the Wifly doesn't send the *OPEN*. The issue is that there is no way out, the Arduino will die in this loop.
It may be great in a Alpha 2 to have some timeout in strategic functions. I tried to implement it but to no avail. Do you have any plan for such improvement?

Thanks

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Sun Oct 10, 2010 5:17 am
by faquin
Hello,
I implemanted a very dirty timeout in WiFlyDevice::responseMatched(). After 500ms in the while (!uart.available()), we reboot the Wifly, and then the Arduino (using void (*softReset_OPEN) (void) = 0;).
It improved globally the stability but there are still issues in WiFlyDevice::skipRemainderOfResponse(), where the Arduino is sometimes blocked.

I have a poor Wifi signal in the room, that's why sometimes the Wifly can't connect properly. Isn't there a way to handle such errors in a better way?

thanks

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Mon Oct 11, 2010 12:41 am
by follower
faquin wrote:The board has difficulties to connect (my signal il quite poor) and the Wifly doesn't send the *OPEN*. The issue is that there is no way out, the Arduino will die in this loop.
It may be great in a Alpha 2 to have some timeout in strategic functions. I tried to implement it but to no avail. Do you have any plan for such improvement?
Yeah, I acknowledge that error/side cases aren't handled at all (aside from hanging). I was keen to at least get the working case working. :)
faquin wrote:After 500ms in the while (!uart.available()), we reboot the Wifly, and then the Arduino
It shouldn't be necessary to reboot the WiFly and definitely not the Arduino.
I have a poor Wifi signal in the room, that's why sometimes the Wifly can't connect properly. Isn't there a way to handle such errors in a better way?
When manually making connections I've occasionally had similar issues before. In those cases it was enough to repeat the open request and the connection was made (with the appropriate "*OPEN*" response). My suggestion would be, rather than rebooting things, monitor for the timeout, clear the response buffer and then attempt to connect again.

--Philip;

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Mon Oct 11, 2010 12:43 am
by follower
racine_20 wrote:Could you implement most functions to use Wifly with UDP protocol for the next release please ?
Existant functions are for TCP protocol ....
Did you have anything specific in mind? And do you know if the WiFly module is capable of it?
Another idea if you want, Try to use another method for getting IP and other parameters from Wifly , because, to use parsed *char is very very slow ....
Can you please explain this request further?

Thanks for your feedback.

--Philip;

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Mon Oct 11, 2010 3:59 am
by faquin
Hi Philip,
Thanks for your answer. I know that the dirty reset is not a great solution, juste looking around.
Resending the Open command is a good idea, but how to know the status of the Wifly? Is there a way to sniff the communication Arduino/Wifly without interfering with the sketch running?
I guess I can't telnet the Wifly since only one connexion at the same time is possible...
I'll try to write the timeout that resend the command after a while.
Any target date for Alpha2?

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Tue Oct 12, 2010 1:08 am
by faquin
Hello,
So I implemented a timeout that exits after 200ms if the expected answer was not received. The command is resent.
I still had issues with the OPEN, and I found that when I sent this command, Wifly reply like this:
Code: Select all
<2.21>*OPEN*
But actually between the <2.21> and the *OPEN* there is a slight delay, and thus we exit the skipRemainderOfResponse() to enter the responseMatched() but a \n is sent, and we exit again. So the *OPEN* is trashed.
It's not always the case so I guess the delay depends of how long is it to get the connection to website.
I modified skipRemainderOfResponse() in order to wait 20ms when there is no more data available on the uart, and check again if the \n was not received.

It's been on for around 16 hours now, polling every 5min.

I also added a check if the Wifly is connected to the SSID before sending the OPEN command. My reception is poor so I'd better make sure it's still connected. I used the "show net" and look for the "Assoc=" which returns OK or FAIL.

Hope this can help for future revisions.
Thanks for your help yesterday.

Re: WiFly Shield code library alpha 1 release (also SPI UART)

Posted: Tue Oct 12, 2010 8:28 am
by StaticDet5
I posted this on the Arduino forums as well. Follower suggested that I try here.
I'm following the Sparkfun tutorial:
http://www.sparkfun.com/commerce/tutori ... als_id=158
I'm getting stuck trying the Transparent Terminal Sketch (Search the page for it, and it will come up as the 2nd hit).

I'm trying to execute the paragraph right after that. I'm trying to send the command "$$$" (no quotes) to enter the command mode of the WiFly.

When I hook up the system, I'm getting (In the Arduino Serial Monitor, TeraTerm, and Multi Terminal from Sourceforge):
WiFly Shield Terminal Routine
Bridge initialized successfully!

At this point I've tried entering the "$$$" command, and nothing else happens.

I've tried the other tutorials, and have not made progress with this shield (I can't get the system to associate with wireless access points yet).
Once again, I'm worried I'm missing something basic.

I've tried both crystal settings (even though the crystal is clearly marked 14.7456).

It really seems to me that the Arduino is not interfacing correctly with the WiFly module. I'm not getting any information back from the WiFly.

I'm using an Arduino Diecimila with an external power brick (Thank you Michelle, SF Tech, for pointing me in the right direction on that one). I've tried two different computers, both running version 0021 of the Arduino IDE. Both computers with all three terminal programs.