XBee and Arduino baud rate conflict

Hello there,

Is there anyone who knows how to make an XBee talk to an Arduino on a baud rate >9600? I tried to but get really weird results. And the wirdest part is that I can make the xbees talkt with 115200 to eachother, and have my Arduino Sketch start with Serial.begin(9600). This is the only way the Arduino is able to read the Xbee data. On any higher rate it will make a mess of my variables.
Any clues?

to change the baud rate on the xbee, use X-TCU. Ladyada has a good tutorial at this link Xbee Adapter - Connecting, Configuring and Upgrading

software can be downloaded here http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=2125

I know how to do this,
That's how I set em on 115200 in the first place :wink:
My problem is the following:

XBee on 115200
Arduino on 115200


Result: variables are a mess

XBee on 115200
Arduino on 9600 (not higher!)


Result: variables come through well,
but I need more baud rate.

Any solutions to get the first setup working?
Even with a simple Serial.read() sketch the variables I send get messed up...

Greetings,
Albert van Andel

I have not seen a setup where two devices talking at different baud dates get any valid results. If i uinderstand waht you are saying, when you set the Xbee to 115200 and theArduino to 9600, transmission is slow, but accurate. is this correct?

Normally, when two devices try to communicate at different baud rates, all you get is garbage on the serial interface.

Result: variables are a mess

I am not quite sure wht you mean by that. On your PC code you would receive the serial data and duim it on a variable. The values in those variables are then used to make a decision and perform a given task. Are you saying that the values in these variables are not what you'd expect?

Hi,

when you set the Xbee to 115200 and theArduino to 9600, transmission is slow, but accurate. is this correct

Yep, weird but true

By variables I mean the following:

I use Max/MSP to send an API packet to the XBEE with a 5 byte payload. I use it to address a motor connected to the arduino and then send a PWM or digital value.
When I send the packet at 115200 over the XBee with the Arduino code addressing the motors running at 9600, it works fine. Changing the XBee baud rates doesnt affect it, but when I raise the Arduino baud rate to anything higher then 9600 it will read false results (@ 19200) only 0's and 224's (@ 28800-57600), or only 0's (@115200). Bollocks in other words.
I'm puzzled, as one might expect that it would only work with similar baud rates.
The problem is not with the receiving code, as I also get the problem when I run the Serial.read() example code from the reference to test the data I receive. It is also not in the max patch, as it also happens when i send a test packet thru XCTU.

So, a hint would be welcome :slight_smile:

Sorry Bud... this one seems a little out of my league... hopefully some other more experienced folks can lend some of their knowledge...

Don't know if you've already done this... but one of the first practical steps in troubleshooting these wireless issues is to first try to connect the two devices witha physical wire and then make sure your serial commuincation works properly there. Perhaps taking this step will help you figure out the issue. Good luck with your project... if i see or hear anything that may be related to this issue i'll send it your way.

Andres

I think your XBee is reseting to its default of 9600 after you remove it from
XCTU. Did you write the baud rate to flash after you set it? Did you try to
use a simple terminal emulator to talk to the XBee after it was set?

It is impossible to read a 115200 baud rate at 9600. The input line is sending 10
times as many bits as you are reading. Something has to be lost.

I do not believe that the XBee can sustain RF transmissions at 115200 bits per second.
Once the input buffer of XBee fills it will stop accepting characters. You would
need to implement flow control to avoid sending characters to the XBee when
the buffer is full.

(* jcl *)