WiFly + sparkfun RN-XV WiFly

03 May 2012

Hello,

I am trying to connect a RN-XV WiFly to my mbed. For now I am just trying to connect to my network. So I did this :

#include "mbed.h"
#include "Wifly.h"

Serial pc(p9, p10);

/* wifly object where:
*     - p9 and p10 are for the serial communication
*     - p17 is for the reset pin
*     - "mbed" is the ssid of the network
*     - "password" is the password
*     - true means that the security of the network is WPA
*/

Wifly wifly(p27, p28, p36, "---", "---", true);


int main() {

    char recv[129];
     printf("ok!\r\n");
    // join the network specified in the constructor
    while (!wifly.join()) {
        printf("cannot to join the network, will retry!\r\n");
        wifly.reset();
    }
    
    printf("network joined!\r\n");
    
    //print all received messages
    while(1)
    {
        if(wifly.readable()) {
            wifly.read(recv);
            printf("read: %s\r\n", recv);
        }
        wait(0.2);
    }
}

Then I connected the pins like this: mbed -> wifly, p27 -> 3, p28 -> 2, p36 -> 5, 3.3V Vout -> 1, GND -> 10.

I thinks everything is ok but I got on my putty : pinmap not found. What am I doing wrong? To find out the pins I used the datasheet of the wifly :

/media/uploads/RFID/pins.png

03 May 2012

If you look here you see that this error means that the Wifly library expects some special pin functions, which are not provided by the pins you specified. In your case, you mixed up RX and TX pins (P27 is the RX pin on the mbed, but the library wants to use it as TX).

03 May 2012

Thank you for your reply,

unfortunatly, I tried both without success. I still don't know what is wrong.

03 May 2012

Th

Hermann Helmholz wrote:

unfortunatly, I tried both without success. I still don't know what is wrong.

This is because P36 is also special (actually its not available as GPIO at at all), because its the Ethernet RD- pin.

Please look at the pinout

04 May 2012

I am using the mbed NXP LPC11U24. Maybe that is the problem?

04 May 2012

If configure my wifly like this

Wifly wifly(p9, p10, p21, "---", "---", true);

the lighst don't blink anymore but I don't have UART anymore to communicate with my pc. Is there a solution?

04 May 2012

Hermann Helmholz wrote:

I am using the mbed NXP LPC11U24. Maybe that is the problem?

Yes. According to the mbed11U24 pinout it has only a single serial port, that's why you can only use P9+P20. And yes, if you connect the Wifly to this, you will loose your serial connection (the Serial pc(p9,p10) line in your code), since it uses the same port. But you should be able to do printf() even without that line (at least I did it always this way), or route it via USB.

05 May 2012

Thank you for your reply. I tested both of your solutions but everytime I insert this line of code :

Wifly wifly(p9, p10, p21, "---", "---", true);

I cannot use printf() directly and I cannot route via USB. I am missing something?

I found a post in the forum by Gernot Fattinger on 14 Feb 2012 reporting similar behavior :

http://mbed.org/forum/helloworld/topic/1211/?page=1#comment-16244

05 May 2012

Since I have a LPC1768 mbed, I cannot really help here - for me it works :-). But I think this is a separate question - how to use a serial port together with debug printf() statements.

Did you read the debug and serial-to-PC help pages? When I understand you right, you had your serial port connected to P9/P10 - but when you route it via USB, you need to connect your terminal to a different serial port on your PC. Maybe the FAQ might also help.

06 May 2012

Thanks Hendrik fro your advices.

With many help from other members of the mbed community, I have now a working software serial interface. You can find the code here: http://mbed.org/forum/mbed/topic/3503/?page=1#comment-17663. It is more or less the same idea that was already proposed by Chag here : http://mbed.org/users/chag/libraries/SoftwareSerial/m704bt

Now I can use p9 and p10 to communicate with the WiFly and output information in terminal using a software serial connection on pin p25 and p26.

So far so good. Next problem. I tried the hello world example : http://mbed.org/cookbook/wifly and it just does not connect ( I get the message : cannot to join the network, will retry! ).

Here is my code

#include "mbed.h"
#include "Wifly.h"
#include "SoftSerial.h"

SoftSerial soft(p25,p26);
Wifly wifly(p9, p10, p21, "---", "---", false);


int main() {
    char recv[129];

    soft.baud(19200);
    soft.printf("d\n\r");
    
    wait(0.01);
    soft.printf("Voila!\n\r");


    // join the network specified in the constructor
    while (!wifly.join()) {
        soft.printf("cannot to join the network, will retry!\r\n");
        wifly.reset();
    }
    
    soft.printf("network joined!\r\n");
    
    //print all received messages
    while(1)
    {
        if(wifly.readable()) {
            wifly.read(recv);
            soft.printf(recv);
        }
        wait(0.2);
    }
}

I am using a DLINK DIR 615 router (WPA). Had anyone ever try to connect to this router using WiFly? Any hint?

p9 pin3, p10 pin2, vdd pin1, gnd pin10

thanks.

06 May 2012

When I configure my router without security mode it works. Well, it is better then nothing...

14 May 2012

weee

15 May 2012

/media/uploads/GregMartin/wiflyhints.doc Here are some hints which may shed light on the problem. I can post a WiFly config file if you like which works for my WEP configured router.

24 Jun 2012

Hello,

I am using an RN-XV module as a web server. At the moment I have my web browser successfully communicating with the RN-XV and loading a web page from the RN-XV. I am still working on the code but here it is what I have until the moment. http://mbed.org/users/arhpoon/programs/RN-XV_simple_server/mc4jvk I am new on this so I am open to suggestions and/or corrections. Good luck,