Main Site Documentation

Please help hook up the hardware


#1

Hello, I am trying to hook up a WiFi serial board ( http://www.sparkfun.com/commerce/product_info.php?products_id=9333) to the Robot Kit.

I made following connections:

GND on the Robot kit to the GND on the WiFi card
3V3 on the Robot kit to the VDD-IN on the WiFi card
RXD on the Robot kit to the TX on the WiFi card
TXD on the Robot kit to the RX on the WiFi card

In the code I opened a serial port on COM2 with 9600N81, sent data and got back a framing error.
I am not sure where to go from here. Any help would be really appreciated.

Here is the photo of the Robot kit board with used slots for reference: http://i.imgur.com/EKXRx.png
Here is the photo of the WiFi board with used slots for reference: http://i.imgur.com/umZnl.png

I’ve looked over the documentation for the WiFi board (see below) and I think I’ve done things right, but I am a complete noob.
Datasheet: http://www.sparkfun.com/datasheets/Wireless/WiFi/rn-131-ds.pdf
Reference Guide: http://www.sparkfun.com/datasheets/Wireless/WiFi/WiFlyGSX-um2.pdf


#2

What do you mean by you got back a framing error? If you’re sending data and it’s sending an error back… then it’s a software error not hardware.

Are you using com2 in your code? It sounds to me like the hardware is connected correctly, can you share your code?


#3

Here is the code. I setup an event handler for the ErrorReceived event and it fires there right after I call SerialPort.Write method.



// class declarations
SerialPort _SerialPort = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One);

public void Start() {
   _SerialPort.DataReceived += new SerialDataReceivedEventHandler(_SerialPort_DataReceived);
   _SerialPort.ErrorReceived += new SerialErrorReceivedEventHandler(_SerialPort_ErrorReceived);
   _SerialPort.Open();

  Write("$$$"); 
}

public void Write(string msg) {
   byte[] buffer = UTF8Encoding.UTF8.GetBytes(data);
   _SerialPort.Write(buffer, 0, buffer.Length);
}

void _SerialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e) {
   // ERROR OCCURS HERE
   // e.EventType = "Frame"
   // e.m_error = 4

   Debug.Print(e.EventType.ToString());  
}

void _SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) {
   byte [] buffer = new byte[_SerialPort.BytesToRead];
   int bytesRead = _SerialPort.Read(buffer, 0, _SerialPort.BytesToRead);

   byte [] usableBuffer = new byte[bytesRead];
   Array.Copy(buffer, usableBuffer, bytesRead);

   string restoredText = new string(Encoding.UTF8.GetChars(buffer));
   Debug.Print(restoredText);
}



#4

Can you try a loopback test? Sometimes the serial port is stupid and throws errors even though it’s sent the data.

Connect RX/TX on the FEZ and see if anything is in your RX buffer.


#5

Loopback test is pretty solid. I do not get errors. That’s why I thought that something might be wrong with the wiring or voltage or perhaps I am misreading the specs of the WiFi card, which is entirely possible since my knowledge of hardware is pretty minimal.


#6

Do you get anything back? or only errors? Maybe you have the wrong baud rate?

Those modules can be controlled by terminal using AT commands. I say create a virtual serial port using CDC and create a gateway to send data from the virtual port to the WiFly board and vise versa. This way you can type the command in to make sure your WiFly is working nicely.

Now, you can also do that with RS232 serial port to your PC, which will be easier in software but you need the hardware.

We have one of those modules but I do not think we got to writing drivers for it. I think Joe was playing with it


#7

I got nothing back. The baud rate is 9600 as per the reference guide (the link in my first post on this thread). I am going to try and rewire everything and start from scratch and report back.


#8

I was going through this with William a while ago… I think you have to enable hardware handshake on the FEZ before you can talk to it… You then can disable hardware handshaking on the wifly and use on three wires…

Cheers Ian