I'm currently having a lot of troubles with my WiFly Shield. It is the first time I work with Arduino Hardware but I actually need it this time ;-). Well the thing i'm trying to do is simply to connect to my Wifi through javascript:void(0);the WiFly Shield, I can't get it work though.

First question is : how pins have to be connected between the UNO and my Shield ? I put the Shield above the UNO and plugged every pins together with components which look like combs. I don't know the word for that, sorry. Well to sum up, Vin is pluged with Vin, GND with GND, etc.

To use the Wifi, I tried 2 methods. First one, I tried to use the WiFly library and used this code:

/* * based on: * * WiFly Autoconnect Example * Copyright (c) 2010 SparkFun Electronics. All right reserved. * Written by Chris Taylor * * This code was written to demonstrate the WiFly Shield from SparkFun Electronics * * This code will initialise and test the SC16IS750 UART-SPI bridge, and automatically * connect to a WiFi network using the parameters given in the global variables. * * http://www.sparkfun.com */

// Always display a response uninterrupted by typing // but note that this makes the terminal unresponsive // while a response is being received. while(SpiSerial.available() > 0) { Serial.print(SpiSerial.read(), BYTE); }

I'm having the same problem. I've done a bunch of Arduino projects and NEVER had this much trouble getting a component to work. I've tried pretty much everything I can think of, but nothing works. Let's stay with the debugging terminal example that comes with the alpha-2 release of the WiFly library. Here's what I've done:

1. Installed WiFly alpha-2 in the package contents/resources/java/libraries directory. (the README still has the old version number in it, which was very confusing when I was trying to look at them side by side in my text editor)

2. Connected WiFly (RN-131C) breakout to Arduino Duo with a 6 and an 8 pin connectors.

3. Getting the P104 and P106 lights flashing (see the docs for what the flashing means- it's not affecting me directly yet since I haven't connected to an networks).

5. Waited for the TX light to go off, opened the serial monitor, and have been greeted in each attempt with the "locking up" message.

I'm using Arduino 22 on a Mac running 10.6.7, FYI.

I have a feeling that a lot of the documentation and troubleshooting is based around the retired WiFly shield, but I can't be sure. Seems like nothing I try doe any good. Anybody got any ideas? @NNzz, did you ever figure out how to get this working?

i tried to get the example code and the other library going for about 10 minutes, then totally abandoned them.

Instead, I looked at the schematic and the WiFly module's reference documentation, then pulled the code that actually makes the SPI and UART work out of the libraries and put it in one place, there's not very much of it. It's actually pretty simple. You just have to figure out how the SPI and the UART work.

If you look here:

http://roboticcore.com/?p=53

Find the WiFlyGateway and download the code. The file that contains ALL the SPI and UART initialization and manipulation is CommManager.cpp and .h

If you're looking for a "Black Box" solution for the WiFly, I don't think you're going to find it. And for the simple reason that every system that uses a WiFly is going to be a bit different, look at mine... I also connect to additional SPI UARTS, something none of the libraries seem to support. There is also a WiFlySerial library that someone wrote, but it requires the breakout board version of the WiFly, not the shield.

Once you have the WiFly running and in Command Mode on the serial terminal, program it with the particulars for your WiFi network using the instructions in the Reference manual for the module, then use the "save" command to save the new parameters. Then when the WiFly is power cycled, it will auto-associate with the hub and you're ready to connect it to whatever server it's going to.

Take it one step at a time:

1) Get the SPI to work.2) Get the SPI UART to work.3) Get the Serial Monitor to talk to the WiFly.4) Program the WiFly to connect to your WiFi. Remember to use the "save" command.5) Power cycle the Shield and watch it connect.

Linux and Arduino, two great things that go great together!http://www.roboticcore.com

In CommManager.cpp, I got some errors when I compiled the sketch. It was something like "PB1 undeclared in this scope", and after a but of reading, I found that new you have to use PORTB1 etc. instead of PB1. Changed where that PB got declared through lines 160-194, recompiled and got no errors.

Uploaded to the board, and here's the output from the serial monitor:

UART 10 read test (55) = ffUART 9 read test (55) = ff

And then a whole bunch of those umlaut y's and the IDE freezes so I can't enter command mode with the WiFly. Any ideas?

Had exactly the same problem, think I got it fixed - so I thought I'd document my steps.

So, I get a WiFly, and I get the code from GitHub. With the intent to use it on the Arduino MEGA 2560, I resolder D13, D12, D11, D10 on the shield to D52, D50, D51, D53 on the MEGA 2560 as explained in src/WiFly/README.txt. I copy the folder WiFly-Shield/src/WiFly from the code to arduino-0022/libraries; and I decide to try src/WiFly/examples/tools/SpiUartTerminal.pde... and, I experience the freeze on WiFly.begin().

Well, since the main communication between the Arduino and the WiFly is via SPI, I decide to check the SPI pins on an oscilloscope. I would have expected at least the SCLK clock (D13 on Uno, D52 on Mega) to be shown pulsing - but surprisingly, all of the pins showed DC voltage. Then I thought about trying the default SPI examples in arduino-0022, so I chose SPI/examples/BarometricPressureSensor.pde. Immmediately after building and uploading this sketch, I could see SCLK pulses on D52 on the Mega; so my conclusion was, there must be a problem with the SPI initialization in the WiFly library.

Thus, I began a somewhat tedious process of comparing the default SPI library in the Arduino IDE, and the SPI related parts of the WiFly library. My initial guess was, that the SCLK pulses start immediately after a succesful .begin() has been initiated; however, actual pulses (that I could catch on the scope) usually occur when a .transfer() command executing in the loop(). So I made me a small .pde program, to have the same .begin in setup(), and .transfer in loop() implemented through either library for comparison - and I could realize that, as concluded earlier, .begin() from WiFLy simply never returns - here's the test code I used, called it spi_test_wi.pde:

So, I decide to look closer in SpiSerial.begin(); - that function eventually calls SpiUartDevice::initUart, where a comment can be read: "// Lock up if we fail to initialise SPI UART bridge.", this lock up being entering a while(1) loop. So, I basically decide to comment this loop in arduino-0022/libraries/WiFly/SpiUart.cpp:

... and move the running of uartConnected() check in the main .pde code; however, since this function is by default private, it needs to be made public for that - so in arduino-0022/libraries/WiFly/SpiUart.h simply move the uartConnected() and configureUart() above the private keyword:

Finally, with these changes, I could see SCLK pulses immediately after upload; and of course, the entire connection procedure passed - and I could execute the WiFly commands and connect to a wireless router as described in WiFly Tutorial - Wireless SpeakJet Server - SparkFun Electronics. (Note I had to change my router from WEP 64 bit to WEP 128 bit, as that is the only WEP WiFly supports; and then there is difference between key/passphrase command). Here tested telnet wireless access via SpiUartTerminal.pde, worked fine.

With this done, I also tried the Examples/WiFly/WiFly-examples/WiFly_WebServer, which samples analog inputs and sends them to a client over wireless - the good thing is that the above SpiUart.cpp hack seems to propagate to the WiFly class as well; unfortunately, I couldn't measure more than 2.7 kByte/sec transfer speed over wireless, even with specifying WiFly.configure(WIFLY_BAUD, 38400);.

In any case, glad I could get this to run - so hope this writeup would be of use to others ,Cheers!