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

soelen:

GET / HTTP/1.1

This is the line you want to extract. (Except when you send the form it will look different.)

I try to save all what I get into a string and I want to regular express it, but it just doesnt work…

You don't have regular expressions on the Arduino but you might want to look at the [[TextFinder](http://www.arduino.cc/playground/Code/TextFinder) library which can be helpful.

–Philip;

P.S. You might want to delete your Wireless SSID and password from your post too. :)](http://www.arduino.cc/playground/Code/TextFinder)

I’m back!

I sent the board back to Sparkfun, where they evaluated it, and found it defective. In the interim, I purchased an Arduino Uno to continue this project. The new WiFly board came in the other day, but this is the first chance I’ve had to sit down and work with it.

I’m now working with two computers, both running Arduino v.21. My primary computer is running Windows 7, my secondary computer is running Windows XP. Both computers are using TeraTerm and Multi Terminal (available from Sourceforge.net). I’m trying the troubleshooting techniques with both systems.

The Arduino UNO board is being powered by an external power brick, to make sure that the board and shield are supplied with enough power.

The WiFly shield is plugged directly into the Arduino Uno.

I am now still trying to get the WiFly board into command mode. This time, whenever I hit any key, while in the TeraTerm (or Multi Terminal) terminal mode, the red activity light on the WiFly shield illuminates for a split second. However, I do not appear to be getting any characters back from the WiFly module other than the initial string:

WiFly Shield Terminal Routine

Bridge initialized successfully!

Attempting to enter the

$$$

command does not yield anything, unless I wait approximately 3-5 minutes. Then I get the following:

WiFly Shield Terminal Routine

Bridge initialized successfully!

¯—7hnñ1i±æ1Î^'.g.@îg—a®1Îg‡×¶ ‡± ÈG7Þyg9gNÎg7vng9f7Ïn7®0Áÿ

These characters seem to come whether I attempt to enter commands, or let the board just sit idle after boot up (I do not have to enter “$$$” to make the characters come up).

The characters seem to be consistent to the computer (The Windows 7 computer seems to output the same characters each time, and the Windows XP computer seems to output the same characters each time, but different characters than the Windows 7 computer). The characters look like the board is trying to send me a message, but at a different baud rate. However, the baud rate is correct for the initialization message.

The board activity lights: The yellow light is blinking at a rate of about two per second. It seems to mostly blink 15 times, and then stop. Occasionally it blinks 7 times and then stops. The Green light is blinking asynchronously with the yellow, at a slower rate. At the end of the yellow light cycle (the 15 or 7 times), the green light stays illuminated for a period, while the yellow light stays dark for a similar period.

I have trouble believing that I have two defective boards. I could almost believe that my last Arduino was damaged or old, or something. But I have a brand new Uno board.

Any thoughts? Any other information that I can provide to help figure things out, just mention it.

Thanks

StaticDet5:
I sent the board back to Sparkfun, where they evaluated it, and found it defective.

Was there any further detail given on the defect?

I’m now working with two computers, both running Arduino v.21.

Assuming it’s configured correctly, using the Arduino IDE Serial Monitor should be enough for your tests.

The Arduino UNO board is being powered by an external power brick, to make sure that the board and shield are supplied with enough power.

Does it make any difference if you use the external brick or not? It shouldn’t be necessary.

¯—7hnñ1i±æ1Î^'.g.@îg—a®1Î`g‡×¶ ‡± ÈG7Þyg9`gNÎg7vng9f7Ïn7®0Áÿ

This certainly has the appearance of a baudrate issue with the module.

The characters look like the board is trying to send me a message, but at a different baud rate. However, the baud rate is correct for the initialization message.

The WiFly module itself does not sent the initialization message. The fact that the initialization message appears suggests that the connection to the SPI UART chip on the board is okay but there’s some problem between it and the WiFly module.

Have you got back in touch with SparkFun technical support?

You could always try the hardware reset procedure for the WiFly module if you felt up to it. Or you could start by changing the baud rate specified in the SpiUart.h file of the library in case the WiFly module has just been configured at the incorrect rate.

–Philip;

Hey follower, thanks for the tip first, speaking of the ssid and possword ^^;

Indeed the textfinder was very helpful! First their were some error messages on textfinder but after your second suggestion using it I gave it anohter try and… it worked! I was able to read and to analyize the GET variables. Thanks a lot for your help, I am pretty sure I wouldnt come that far if you wouldnt helped me at all ^^ I really do appreciate that and I do not know how to thank back for now hehe…

Unfortunately I have now another problem

First you have to know that I am building a robot, i want to give commands wie GET how to move it. This is why I am using another shield for controlling the motors:

http://www.ladyada.net/make/mshield/use.html

with this shield, it is pretty easy to control the motors like that:

motor.run(FORWARD);      // turn it on going forward
  delay(1000); // wait one second

  Serial.print("tock");
  motor.run(BACKWARD);     // the other way
  delay(1000); // wait one second
  
  Serial.print("tack");
  motor.run(RELEASE);      // stopped
  delay(1000); // wait one second, repeat because it is in loop

Now I have the problem that delay is not working anymore after using

WiFly.begin();

if I remove WifLy.begin();, the motors are working again (the wifly of course not anymore)

so this is what happened with the wifly on it:

motor.run(FORWARD);      // nothing happened
  delay(1000); //wait one second
Serial.println("something is written heere after a second");
  Serial.print("tock");
  motor.run(BACKWARD);     // nothing happened

  delay(1000); // wait one second
  Serial.println("something is written heere after a second");
  Serial.print("tack");
  motor.run(RELEASE);      // nothing happened
  delay(1000); // wait one second
Serial.println("something is written heere after a second");
motor.run(FORWARD); // it moves forward, forever

Do you have any idea what the problem could be? I am all out of ideas again…

regards, Soelen

Is the WiFly pin broken out on the shield? Looking at the schematics, I don’t see where it is broken out. Heck, I can’t even see the pins.

I tried modifying the code like you suggested, but the board kept hanging.

Just to be thorough, I tried taking the shield off the arduino, just to see what would happen.

Exactly as expected, the Serial Monitor shows that the bridge can’t be initialized.

I haven’t contact SFE tech support yet. I’m trying to exhaust the experts in the subject (You folks).

Are there any indicators on the actual WiFly board itself?

Honestly, have you folks have the experience that you plug the shield into the Arduino, and it just “works”?

@StaticDet5

Well no, but because I just started with arduino and I never tried c++ before. The functionality of my hardware were ok.

If you think your hardware / pins are for some reason broken, why dont you check continuity? Maybe you already did or it isnt such a helpful tipp after all… anyway here’s an explanation how to check with a multimeter:

http://www.ladyada.net/learn/multimeter/continuity.html

Regards, Soelen

StaticDet5:
Is the WiFly pin broken out on the shield? Looking at the schematics, I don’t see where it is broken out. Heck, I can’t even see the pins.

I don’t understand what you mean by “is the WiFly pin broken out on the shield”, could you please explain in more detail.

I haven’t contact SFE tech support yet. I’m trying to exhaust the experts in the subject (You folks).

It’s worth keeping them in the loop as they can do things we can’t and may have additional information. :slight_smile:

Are there any indicators on the actual WiFly board itself?

Indicators of what?

Honestly, have you folks have the experience that you plug the shield into the Arduino, and it just “works”?

Yes. :slight_smile: I’ve got a number of WiFly boards I use for developing the WiFly library with and they all “just worked” (well, with the library written, at least :slight_smile: ). (Although early on I did have one board which was the earliest revision stop working–seemingly something to do with SPI UART–but since then haven’t had any problems with that.)

–Philip;

My apologies for my horribly edited email.

Are there any indicators on the WiFly board itself (not the yellow, green, blue, and red on the shield)?

Is the WiFly board’s reset pin broken out on the shield? It doesn’t look like it on the schematic, and I can’t see any way to get to it with the board mounted to the shield.

I’ll compose a summary to SFE tech support after I perform continuity checks with my DMM. After the last board, I’m becoming an expert at that. :slight_smile:

Thanks again, folks. Happy Thanksgiving to you all!

You too staticdet5

But it seems like follower overlooked my post ^^;

viewtopic.php?p=114079#p114079

I’m not really good with c++ and of course I hope you know what I have to do!

regards, Soelen

Hi guys, I have a question about the WiFly shield, apologies if this is the wrong place to post, but this seemed like the most active WiFly related place.

I was wondering if it is possible to have the WiFly connect to a server through telnet or ssh?

What I would be hoping for it to do would be to connect to a laptop (macbook) and run a and launch an application.

Anyone able to shed any light on this?

Cheers,

Phil.

StaticDet5:
Are there any indicators on the WiFly board itself (not the yellow, green, blue, and red on the shield)?

Ah, no, not as far as I know.

Is the WiFly board’s reset pin broken out on the shield? It doesn’t look like it on the schematic, and I can’t see any way to get to it with the board mounted to the shield.

The most recent version breaks out the reset pin–there will be a date on the underside of the PCB if it’s the latest version.

–Philip;

pzgordon:
I was wondering if it is possible to have the WiFly connect to a server through telnet or ssh?

Through telnet, yes. Through SSH, probably not. (Unless you could port a SSH library to the AVR. :slight_smile: )

What I would be hoping for it to do would be to connect to a laptop (macbook) and run a and launch an application.

You could also write a custom server that performed a similar task if you didn’t want to use telnet.

–Philip;

soelen:
if I remove WifLy.begin();, the motors are working again (the wifly of course not anymore)

Do you have any idea what the problem could be? I am all out of ideas again…

Looking at these, you might have a clash with the pins that are being used:

http://shieldlist.org/adafruit/motor

http://shieldlist.org/sparkfun/wifly

I haven’t had any experience with the Motor Shield you have so I can’t give you any specific advice. If you can’t work it out you could try asking on the adafruit forums if it’s possible to have both motor control and SPI operating at the same time.

–Philip;

Quick update on my end.

I’ve performed continuity tests on the board, from the header pins to the chip pins. Those seem to be intact and correct.

I’ve sent a message to SFE tech support a couple of days ago. I’m hoping to hear from them today.

Still no joy getting any response from the WiFly itself.

I’ll let you folks know what SFE says.

I have the same issues as the previous poster.

I have the WiFly Shield, plugged into the Arduino Uno.

I am using the default Arduino development environment.

I have tried to connect the WiFly using the Alpha Library WebClient, because the module does not support 64bit WEP, I am unable to associate to my O2 Access point, however, with an invalid combination of ssid and passkey, I get neither the “Association Failed” or “Connecting…” string, the code hangs when calling WiFly.join, which in turn locks up at line sendCommand("join ", true);

I am assuming this line is not returning, its waitForResponse("Listen on ") and never getting a response from the WiFly.

So I thought I would try the WiFly_Terminal, It loads fine, and the following is reported to the terminal.

WiFly Shield Terminal Routine

Bridge initialized successfully!

I can try typing anything, for example $$$, or CMD, with any combination of CR/LF, NL etc … and I get no response from the WiFly. I cannot get it into command mode.

When I type something I get a very quick flash of the red led.

At all other times (other than reset or loading) the green led flashes constantly, and the yellow led flashes slightly slower.

Any advice on steps I can take to get this module into a command state?

I have the 14MHz clock, and have checked the code is configured for this.

Thanks

Amigo!

It’s so nice to know I’m not the only guy with this problem!

Please let me know if you get anywhere with this. I’ll make a point of posting anything troubleshooting suggestions from SFE tech support

croyles:
I have tried to connect the WiFly using the Alpha Library WebClient, because the module does not support 64bit WEP, I am unable to associate to my O2 Access point, however, with an invalid combination of ssid and passkey, I get neither the “Association Failed” or “Connecting…” string, the code hangs when calling WiFly.join, which in turn locks up at line sendCommand("join ", true);

I am assuming this line is not returning, its waitForResponse("Listen on ") and never getting a response from the WiFly.

The code to detect connection failure hasn't been written--the code is just hanging because it's not getting the expected response. If it gets as far as the join method call then I would think it is actually communicating with the module okay.

My suggestion is to remove the call to join entirely and just let the code fall through to the loop(). At that point you should be able to send commands directly from the serial console.

Also, to make things easier to track I suggest unpowering the Arduino and WiFly shield after uploading a sketch until you sort things out.

–Philip;

Wow, thanks for the fast response.

As a seperate check I used zterm (Mac) to access the Arduino, but that did not work either. $$$ resulted in nothing coming back. On a completely seperate topic, I found another WiFLy terminal test harness, but it uses stdio.h, which is not in my library list, or appears to be installed. Do I need to download this?

See http://www.youtube.com/watch?v=RhJK3Bd1oX4

@Static, if I make progress I will keep you posted.

@Philip, thanks for the quick response!

follower:
The code to detect connection failure hasn’t been written–the code is just hanging because it’s not getting the expected response. If it gets as far as the join method call then I would think it is actually communicating with the module okay.

Good point, if it does not receive the "Associated!" command its going to run until it get to EOM. Would that not return a false to :join() and fall through?

follower:
My suggestion is to remove the call to join entirely and just let the code fall through to the loop(). At that point you should be able to send commands directly from the serial console.

I will try this, its interesting you note this, as the module should be in ‘command mode’. Does the module remain in command mode across reboots?

follower:
Also, to make things easier to track I suggest unpowering the Arduino and WiFly shield after uploading a sketch until you sort things out.

Sorry not sure what you mean by ‘unpowered’, it needs to be powered in order to send serial commands? Do you have suggestions on how to track this, I have been using simple Serial.print messages to debug, are there other approaches?

Thanks, Chris

Update

I have successfully associated with a WiFi network (WPA) without modification to the library, it just worked. I have all examples pairing successfully.

All examples in the alpha library work as designed.

BUT

I am still unsuccessful in getting the WiFly into Command Mode outside of source code. The reason I want to get into command mode, is I want to extend the library so I can handle more ‘get xxx’ methods to understand more about the configuration. To do that I need to know what is returned ‘verbose’ from the WiFly so I can start coding the waitForResponse(“<”); methods.

e.g. writing another WiFly::ip() method, that returns WiFly::everything(), if you see the logic.

Its not clear how the WiFly_Autoconnect_Terminal example functions?

Should this enable transparent serial comms to the WiFly in command mode?

I am looking for an example that puts the WiFly into Command mode, and then allows commands to be sent over Serial across to the WiFly, an the results to be printed into the Serial console. Preferably tested and working with the default Arduino SDK.

Thanks :slight_smile:

Just a couple of comments that might help others

I’ve also tried the Transparent Terminal sketch without much luck … but the Alpha 1 driver set seems to work quite well! I used it with various Ethernet web server examples and it seem to work fine (in general).

I did however find various $$$ exit command repeated at the end of many web pages (I’m using it as a web server)

I manged to get rid of it by modifying void Client::stop() in Client.cpp

// _WiFly.switchToCommandMode(); // Commented this out and replaced it with the code below

delay(400);

_WiFly.uart.flush();

_WiFly.uart.print(“$$$”);

delay(400);

It came from the Roving Networks spec sheet where it indicates a 1 second delay before and after a $$$ is required to switch to command mode. For me 400ms worked fine. If you modify the subsections of of switchToCommandMode, more specifically WiFlyDevice::attemptSwitchToCommandMode() in WiFly.cpp then I don’t seem to be able to connect to the WiFi network (Not too worried why)

Obviously this won’t retry like the original code but you get the idea