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?
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.
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.
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?
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.
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
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!
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.
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!
Well, to tell the truth, I just got started with the Xbee and haven’t connected them to the microcontroller yet. From what i understand from the data sheet, you check CTS to ensure that you aren’t filling the data input buffer and if it is high, then you should stop sending and wait till it goes low to send data to the Xbee again. I will be sending data from the micro to the Xbee intermittently, maybe a 100 bytes at intervals of 10 seconds - this is just an estimate - so i might not need the cts control, though if you guys think its good practice, it might be advisable to do it.
I had a question about connecting the UARTs of the Xbee and the micro: i am using a dsPIC30F3012 which operates at a voltage range of 2.5 to 5.5 V while the Xbee is 3.3V; do i need a voltage level translating chip in between the Xbee and the micro when i connect them? I have seen yes and no answers on the web so far, and was hoping for something definite. the micro will probably be running at 5V; though if i ran it at 3.3V, then i assume i wouldn’t need a translating chip?
I would greatly appreciate it if you could clear this up for me.
If your data rate can ensure that the XBee’s data buffer will never fill then CTS isn’t needed. I use a XBee with a PIC in this manner with success.
You should never exceed the voltage limits of the XBee on any pin. Therefore if your PIC is running at 5V some sort the level translation or over voltage protection is required.
Look at the schematic of Spakefun’s XBee regulated Explorer board for one method.
Also, Microchip has a 3.3V hints & tips for interfacing between IC’s with different voltages.
I think i can clear up the data rate thing - you see, this thread was started by “lupin” who’s sending the large data volume; i saw that his interfacing-components were very similar to mine, and so started posting here. i myself am sending much smaller data volume - the 100 bytes every 10s like i mentioned.
I’ll look for a level translating chip then, as advised. I do have a regulated xbee board (so that i can breadboard it) already, but i think the regulator is for the Vin/Vcc pin and doesn’t apply to the Din pins so those signals still need to be taken down from 5 to 3.3.
Waltr - since you’ve used a PIC and an XBee, i wonder if you can shed some light on this: I am trying to use a dsPIC30F3012 micro to send data to an Xbee for transmission to a PC. I am very new with both PICs and Xbees, so i am still getting used to all this. I was wondering what exactly needed to be configured for setting up UART communication between the dsPIC and the Xbee? I think i understand the setting up of the UART for transmission ok, but was wondering about any Xbee specific configurations - the baud rate register in the PIC is one i can think of, is there anything else? The number of stop bits maybe? I assume the baud and the number of stop bits have to be the same for the PIc and the Xbee?
Also, this may be a silly question, but do i have to worry about setting start bits and stop bits? or are start bits always 0 and stop always 1 and that is taken care of by the PIc and xbee themselves and i don’t have to configure/write to any registers to set those up?