SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By lupin
#86535
hi

I am using two XBee modules.
One is connected to an FPGA card one is connected to PC with matlab.
I adjusted the baud rate of both modules to 115200bits/sec.
The problem is that approximately one of each 500 bytes is dropping somehow. The data of the other bytes are transmitted correctly. But the dropping ones can not be captured by software in PC(matlab)
I also tried 57600 baudrate and the same problem still occurs.

Is there anyone having XBee modules communicating at 115200 baud rate?
Is there any buffer problem at that speeds?
By waltr
#86551
I run a pair of series 2 XBees at 57.6kbuad without dropped bytes.

One possibility to check: The XBee's clock doesn't divide perfectly to 115.2kb or 57.6kb.
So if the either the FPGA end or the PC end's UART clocks are off enough in the opposite speed than there may a error periodically.

One solution for dropped bytes I've heard of from the Digi support forum, is to increase the stop bits from one to two. This allows some leeway for correctly detecting the next start bit.

Are you using the RTS & CTS flow control line on the XBee? Also try looking at these with an O'scope to determine if you are over running the buffers.
By stevech
#86581
I don't recommend using 115K unless you are in the Digi binary API mode and not using transparent serial mode. Certainly not if using ZigBee. To run high rates, your implementation of CTS hardware handshaking has to be ideal, in terms of stopping within about 2 bytes of CTS going false.

The net goodput is not much over 100kbps anyway, due to wireless protocol overhead.
By ScottH
#87187
I was trying to get an arduino to send some data back to my desktop at 115200, but I was getting a lot of corrupt data mixed in with stretches of 10-100 good bytes, dropping down to 57600 gives me flawless data transmission.

Does anyone get flawless serial data transmission at 115200?
By lupin
#87190
thanks for all replies

I am currently working on a different part of my project.
As soon as I turn back toXBee I will give you active feedback for sure.
I was checking CTS in my code in order to detect whether or not buffers are free.
The dropping bytes were totally random in my design.
I will make the stop period longer and give you feedback
By lupin
#95246
hi again

After my last post I had not worked on the XBee part of my project again. Then I worked on it a few days ago and here is the last feedback.

When I continiously send data to XBee module in 115.200 bits/sec the bytes continued to drop.
Then I reduced the speed to 57.600bits/sec and the bytes continued to drop. But this time the order of the dropping bytes were fixed. For example when I send 256 bytes of data in 57.600bits/sec 136th byte always dropped.
Then I chatted with some expert from digi and he told me that with older versions of firmware(embedded software on XBee) it was possible to send bytes from source to sender XBee in 115.200bits/sec. But the sender XBee is only capable of sending bytes in 19200bits/sec in air to receiver XBee continiously. He suggested to update the firmware. With the update, the sender is capable of sending bytes in 80.000bits/sec in air to receiver Xbee.

Then I made the firmware update and changed my code so that it sends data in 57.600bits/sec continuously. In my test application, I send 10240bytes in 57.600bits/sec and checked the received bytes in MatLab and all of the bytes were correct.

Just to remark, I am using 2 stop bits in serial communication.
By stevech
#95256
you need flow control. Hardware RTS/CTS if you wire it up and both sides enable/use.
Or some sort of software hanshake for flow control. By a protocol you define.

This is true of any comms channel, esp. wireless.

With XBees, don't run the UARTs at more than 56K unless you know what's happening in detail on the hosts and your protocol. I use Series 1 without DigiMesh at 115K in the API mode, but with a strict protocol to prevent overruns.

Don't expect ANY 802.15.4 radio to sustain more than about 80Kbps net, best case (2.4GHz), without channel contention (CCA) delays
Last edited by stevech on Wed Mar 03, 2010 12:45 pm, edited 1 time in total.
By sterling2
#96491
hi - i am quite new to xbees and just started playing with one this week.

I actually have an interfacing issue which is very similar to what "lupin" on the forum has already done - i am trying to use matlab to read xbee data (one Xbee with PC, the receiver, and the other with a microcontroller, the transmitter, both are series 1).

Since I am new to this, i had a few questions for lupin (since he's already done this) or to anyone willing to help out a bit:

Firstly, I have a USB board to connect the xbee to the PC (through a USB port) but in order to use matlab, i am guessing that the xbee connects to the PC through a serial port and not a USB port?

Secondly, what mode should my Xbees be in order to get data into matlab from the microcontroller? API or AT? this may be a silly question but i am new to this !

Lastly, any help in how to read the incoming (to the PC) xbee data with matlab would be very appreciated. I am transmitting "time, x value, y value" data with the xbee from the microcontroller and simply would like to plot a graph in matlab after receiving the data at the PC end. Again, any help would be greatly appreciated!
By lupin
#96504
hi sterling2

in your work, the xbee will be recognized by your pc as a serial port as you declare
with matlab fread() function is sufficient to read the incoming data then you can plot the received data to check it
if your project is not about networks I recommend you to use the modules in transparent mode. It will make your work easier.
do not forget to check CTS signal with your microcontroller before you send data.
By sterling2
#96524
hi lupin and thanks very much for the reply.

Just to be clear, i was wondering if you used the serial port or the usb port when you connected the xbee to the PC? I am a bit confused about that. Or if you were saying that it is ok to use the usb port and matlab would just recognize that as a serial port object and read from there? right now, I am using a xbee-usb board to connect to the PC through a usb port.
By lupin
#96526
hi again

my XBee connected to PC is on a board that has USB output and it is also connected to one of the USB ports of the PC.
but the module is recognized as serial port in that way.
I know that there are some boards designed for XBees and they have serial output but I have the one with USB output.
Actually it is not important for the programmer since it is recognized as serial in both ways
By sterling2
#96547
Thanks for the quick reply lupin, and for clearing that up. I'll be looking at the microcontroller-Xbee interface today. I'll post any other Xbee questions which i might have when i run into them & I would be very grateful for any help; since i am new at this, i'm still getting the hang of it all!
By stevech
#96548
Are you using CTS?
If the stream is constant, back off to 56K becuase of CTS latency