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

Hi again,

I haven’t forgotten the requests to have a repository for this hosted publicly–unfortunately wheels turn slowly, even when it’s not me turning them. :slight_smile:

I’ll let people know when there’s something accessible.

Thanks for your patience.

–Philip;

Hi Philip & all,

thanks a lot for this library – after a bit of experimentation, it works like a charm.

One thing, though: I’m trying to use the library to download data from a FTP server in passive mode, which requires opening two client connections at once, one control and one data connection. Opening the second connection hangs at Client.connect(). Is it possible that the library supports only one connection at a time? Or am I doing something wrong here?

This is the code snippet:

    Client control(DWD_HOSTNAME, FTP_PORT);
    if(!control.connect()) {
      Serial.println("Could not connect to DWD");
      return false;
    }

    EXPECT("220");    
    
    // login dialog
    SEND("USER " DWD_USERNAME); EXPECT("331");
    SEND("PASS " DWD_PASSWORD); EXPECT("230");

    // open passive-mode connection
    SEND("PASV"); EXPECT("227");
    
    char pasv_ip[20];
    uint16_t pasv_port;
    if(!parsePassive(msg, pasv_ip, pasv_port)) { control.stop(); return false; }
    
    Client data(pasv_ip, pasv_port);
    DEBUG("Trying to connect to "); DEBUG(pasv_ip); DEBUG(":"); DEBUGLN(pasv_port);
    if(!data.connect()) {
      DEBUGLN("Could not connect to passive IP / port");
      control.stop(); return false;
    }
    DEBUGLN("Connected to passive IP / port");

…and this is the relevant console output, with my comments:

Server says: 220 DWD-FTP-Server: ftp-outgoing.dwd.de [141.38.3.180] (4)    
Message from server OK // EXPECT("220") succeeded
Server says: 331 Password required for gds40131
Message from server OK // EXPECT("331") succeeded
Server says: 230 User gds40131 logged in
Message from server OK // EXPECT("230") succeeded
Server says: 227 Entering Passive Mode (141,38,3,180,132,104).
Message from server OK // EXPECT("227") succeeded
141.38.3.180           // IP number for data connection parsed out of the above reply
33896                  // Port number for data connection parsed out of the above reply (132*256+104)
Trying to connect to 141.38.3.180:33896

…and there it hangs…

Any help is much appreciated!

Regards,

Björn

bjoerngiesler:
thanks a lot for this library – after a bit of experimentation, it works like a charm.

Great, thanks for the feedback.

Opening the second connection hangs at Client.connect(). Is it possible that the library supports only one connection at a time?

Unfortunately the library only supports one connection at a time as this is all the module supports.

–Philip;

Encryptic:
Have you considered making this available in a format other than just a zip file? Perhaps a GitHub repository?

The source is now available on GitHub, check out this post for more detail: viewtopic.php?f=32&t=25125

–Philip;

Hi guys,

I got my Wifly Shield for 2 weeks+ already and i’m still figuring out how to get it to work.

I’ve read everything in this forum and downloaded all the alpha libraries. (Currently using the alpha 2)

I have my Wifly Shield mounted on a MEGA 1280 and re-circuited the 10,11,12,and 13 pins to 53,51,50,52.

I’ve tried the WiFly Auto Connect sketch which i got from the SoundBox page and results show that i can’t associate with my network.

and i’ve tried the WiFly library included sketch and still it can’t associate with my network.

My router is using WEP 128 encryption. Changed the “set w a” from 3 to 1, even used the command “set w k” and still it didnt work :frowning:

I noticed that he board LED PIO6 (orange) and PIO4 (lime) both are blinking but PIO6 blinks slower. After i uploaded the autoconnect sketch and run it, PIO6 turned off and PIO4 have rapid blinking even faster than before. What does it mean? But either way, it still didnt get to associate with my network.

CyberPunk:
I got my Wifly Shield for 2 weeks+ already and i’m still figuring out how to get it to work.

Hi, I’ve made a reply [here since your question relates to Alpha 2.

–Philip;](http://forum.sparkfun.com/viewtopic.php?f=32&t=25216&p=116138#p116138)

I have been trying to get the Wifly module to work with an arduino Duemilanove development board. I used one of the examples in the library (WiFly_Autoconnect_Terminal). it seems like the example “freezes” in one of the first lines actually it freezes in the WiFly.begin();

after checking out the library file WiFlyDevice.cpp I found out that the while loop “while (!(uart.available() && (uart.read() == ‘\n’)))” just keeps running forever

void WiFlyDevice::skipRemainderOfResponse() {

/*

*/

while (!(uart.available() && (uart.read() == ‘\n’))) {

// Skip remainder of response

}

}

anyone that has got an idea of what I am not doing right

regards

BMake

Bmake:
it seems like the example “freezes” in one of the first lines actually it freezes in the WiFly.begin();

Please make sure you’re using the alpha 2 release of the library.

Then try the ‘SpiUartTerminal’ sketch and reply with the output from that sketch after you enter command mode and try a command like “scan”.

–Philip;

follower:

Bmake:
it seems like the example “freezes” in one of the first lines actually it freezes in the WiFly.begin();

Please make sure you’re using the alpha 2 release of the library.

Then try the ‘SpiUartTerminal’ sketch and reply with the output from that sketch after you enter command mode and try a command like “scan”.

–Philip;

thanks for the comment Philip :)

First I did not have the alpha 2 release of the library but now I have… now the program does not freeze so that problem is no longer in my way,

but I need the thing to work with a 64bit WEP key, but it seems it only supports 128 BIT WEP…

so my new problem is that I need the WiFly to connect to a router with 64bit WEP key

…any solutions?

Bmake:
First I did not have the alpha 2 release of the library but now I have… now the program does not freeze so that problem is no longer in my way,

Great!

but I need the thing to work with a 64bit WEP key, but it seems it only supports 128 BIT WEP…

so my new problem is that I need the WiFly to connect to a router with 64bit WEP key

…any solutions?

See the reply to your other post for the [list of supported WiFly security protocols, as you observed there is no 64-bit WEP support.

Unfortunately, there is no solution for this issue with the WiFly–WEP is deprecated and 64-bit WEP is pretty close to useless so it’s generally not supported. If you can, I would suggest switching to 128-bit WEP or WPA. Or, switching to an open network if security is of little concern.

–Philip;](http://forum.sparkfun.com/viewtopic.php?p=117705#p117705)

Not sure why but… I can’t even get past the WiFly.begin(). I added several println statements to assist in the debugging. It appears to be getting hung in the “skipRemainderOfResponse” routine asit’s not matching the CMD sent to the uart. I was questioning my solder job for the headers, but I assume the uart is not in any way concerned with the ardunio right? So any ideas what’s going on?

WiFly Shield Terminal Routine

WiFlyDevice::begin

SpiUartDevice::begin

SpiDevice::begin

WiFly::Reboot

…Switch to command mode

WiFlyDevice::switchToCommandMode

WiFlyDevice::attemptSwitchToCommandMode

…uart println ‘’

…uart println exit

…uart flush

…uart print $$$

WiFlyDevice::attemptSwitchToCommandMode

WiFlyDevice::responseMatched

…CMD

WiFlyDevice::responseMatched

…MatchFound: FALSE

…SkipRemainderOfResponse

WiFlyDevice::skipRemainderOfResponse

…skip remainder of response

…skip remainder of response

…skip remainder of response

…skip remainder of response

…skip remainder of response

…skip remainder of response

.

.

.

good bye my hope.

.

.

Anyone had any lucked getting WiFly to reconnect after the WiFi has dropped out?

Thanks for this code library. Im working on a prototype right now that uses the WiFly, so hopefully in the coming months I’ll be able to debug this code. Looking forward to it. :slight_smile:

Hello!

I’m having strangely inconsistent results. At home, where I have an airport express (WPA2), one piece of code worked perfectly (just getting past the connection part), but others did not. That said - my bigger issue is that I am trying the same thing at work where we also have a WPA network, but it doesn’t error out or connect, it just hangs on the .begin(). Any suggestions as to how best to debug or what could be the problem?

Thank you!

Claudia

hi guys,

im having trouble getting the wifly into respond to anything i send.

at the moment i get the following form the board::

Auto-Assoc roving1 chan=0 mode=NONE FAILED

Auto-Assoc roving1 chan=0 mode=NONE FAILED

Auto-Assoc roving1 chan=0 mode=NONE FAILED

Auto-Assoc roving1 chan=0 mode=NONE FAILED

Auto-Assoc roving1 chan=0 mode=NONE FAILED

Auto-Assoc roving1 chan=0 mode=NONE FAILED

if i try to go into command mode $$$ (with or with out CR) i see the boards rx light up but i get no change in response from the board.

ive tried using different terminal programmes but with out luck.

im lost now… has anyone had this issue.

cheers,

David

will this work with the RN-XV WiFly Module?

http://www.sparkfun.com/products/10822

thanks

Hello everyone!

I want to buy a Wifly shield for my Arduino uno, but currently I don’t yet see if that will work for me.

I am creating a project which will use touchOSC on my iphone and hopefully I will be able to control an RGB DMX lamp using arduino and a Wifly without a PC.

The touchOSC is working with the Arduino, I am able to control a single LED.

I still need to buy / create the DMX shield and buy the Wifly.

So can you confirm that I can get this working? I need to send OSC signals to the Wifly board which should then create events on my Arduino, and control

Arduino’s outputs based on the events.

You can also link me tutorials, but I’ve seen the one with sparkfun’s Wifly here.

Thanks for your help.

When I use this code:

  Client client("google.com", 80);

I get this error

“The Client has been renamed as EthernetClient”

Console:

sketch_apr30a.ino:3:2: error: #endif without #if
sketch_apr30a:22: error: no matching function for call to 'Client::Client(byte [4], int)'

As of Arduino 1.0, the Client class in the Ethernet library has been renamed to EthernetClient.
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:7: note: candidates are: Client::Client()
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:7: note:                 Client::Client(const Client&)
sketch_apr30a:22: error: cannot declare variable 'client' to be of abstract type 'Client'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:7: note:   because the following virtual functions are pure within 'Client':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:12: note: 	virtual size_t Client::write(uint8_t)
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:13: note: 	virtual size_t Client::write(const uint8_t*, size_t)
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:14: note: 	virtual int Client::available()
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:15: note: 	virtual int Client::read()
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:17: note: 	virtual int Client::peek()
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:18: note: 	virtual void Client::flush()
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:10: note: 	virtual int Client::connect(IPAddress, uint16_t)
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:11: note: 	virtual int Client::connect(const char*, uint16_t)
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:16: note: 	virtual int Client::read(uint8_t*, size_t)
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:19: note: 	virtual void Client::stop()
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:20: note: 	virtual uint8_t Client::connected()
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Client.h:21: note: 	virtual Client::operator bool()
sketch_apr30a.ino: In function 'void loop()':
sketch_apr30a:53: error: expected `)' before '{' token

I am using a WiFly shield not an EthernetShield, how do I fix This problem?

I hope someone could help me as soon as possible :slight_smile: thanks