10 years, 2 months ago.

Cannot connect to WiFly module via mBed

I'm pulling my hair out trying to connect my SparkFun WiFly module https://www.sparkfun.com/products/9954 to my mBed. As far as I'm aware, all that is necessary to connect the two is just the RX and TX line of the mBed + WiFly module and powering the WiFly module which is being powered from the mBed board, and the mBed board being powered over USB to the computer.

I am trying to get into the configuration mode which involves sending a '$$$' command to the module over serial RX/TX. I am sending this command over a program called TeraTerm with a baud of 9600,

I can verify that the module IS working as I've been able to get a response from it using an Arduino Mega 2560 (this communication however, was done over SPI).

I would really appreciate any ideas/thoughts that could be wrong, I have exhausted a lot of the user submitted problems that already exist on the mBed forum page for WiFly.

2 Answers

10 years, 2 months ago.

@David Evans, the module https://www.sparkfun.com/products/9954 does not support the current WiFly libs using RX/TX serial ports. It features an SC16IS750 SPI-to-UART bridge that needs to be connected to an mbed SPI port and then needs to be configured before you can use it. I am working on a driver for the SPI-UART bridge, but things are going slow since it is a rather complex beast and lots of testing is needed.

Accepted Answer

My understanding is, that using the above code I should be able to get into the configuration mode using TeraTerm, does this involve using the RX/TX lines (Pin 9+10), or does it involve using other pins 11-13/14 if I remember correctly.

Also, I assume I can use this module to send data from the mBed over WiFi to another device, if this is the case, can the RX+TX lines be used, or will this involve the SPI-UART bridge? I would like to get to a point where I can configure the WiFly module with ease and then move onto trying to send information with it.

I really appreciate you getting back to me by the way!

posted by David Evans 27 Jan 2014

You can NOT use the mbed RX/TX with the above module. All communication needs to go through the onboard SPI-to-UART bridge. Your options are: wait for my driver code, write your own driver code (use the sparkfun arduino example code for inspiration), rip out the SPI-to-UART bridge device and hack new wiring (not for beginners...) or get the WiFly only shield.

posted by Wim Huiskamp 27 Jan 2014

Can I still transmit data from the mBed via the SPI-to-UART bridge?

posted by David Evans 27 Jan 2014
10 years, 2 months ago.

David,

Looking at this circuit /media/uploads/dflet/wifly_shield-v17.pdf I cannot see a uart connection only SPI.

The code I'm trying to run is reading is this

#include "mbed.h"
 
Serial pc(USBTX, USBRX);
Serial wifi(p9,p10);
 
int main() {
    
    pc.printf("Test Wifly!\r\n");
 
    while (1) 
    {
        if (pc.readable())
        {
            wifi.putc(pc.getc());
        }
        if (wifi.readable())
        {
            pc.putc(wifi.getc());
        }
    }
}
posted by David Evans 27 Jan 2014

Did you look at the circuit I posted above, it is for the wifly shield you posted? if it is, then you will need to use SPI not uart.

posted by David Fletcher 27 Jan 2014

Yes that circuit appears in the documentation I found online for my board. What I find odd is, the person who posted that code appears to have been using the exact same mBed and WiFi module I'm using.

posted by David Evans 27 Jan 2014

You are confusing the wifly module itself (rectangular metal box with white label) and the sparkfun shield that you have. The wifly module has a serial port and mbed could communicate with it directly using a serial connection and the published wifly library. The sparkfun breakout board on the other hand has a SPI to serial bridge in between the wifly module and the externally accessible pins. There is no way to bypass that without hardware modifications. There is no way to communicate through the bridge without proper initialisation first.

posted by Wim Huiskamp 27 Jan 2014

Thank you very much for your time guys.

posted by David Evans 27 Jan 2014