So I’ve been trying to transmit data between 2 Arduino Unos using http://www.digikey.com/product-detail/e … -ND/935965 Xbee module. Transmission works at 9600 BAUD rate. Both Arduinos can communicate with the computer at other rates as well, including 115200 BAUD. I’ve tried changing the XBee module rate to 115200 on both modules using the ATBD7 command, and received an “OK” response, indicating that the setting was successfully changed. However, after the setting change, no data is successfully transmitted, either with the Arduinos at 115200 or with them at 9600 (indicating that the problem isn’t simply that the BD command failed). However, changing the rate back to 9600 fixes the problem. Why won’t my XBee transmission work at all at the higher rate? Does anyone have any experience with this? Thanks!
At the higher Baud rates the XTAL frequency match between the XBee’s and the Arduino become very critical.
And also due to the fact the most of the XTAL freqeuncies do not divide evenly to the higher Baud rates, or in other works the higher Baud rates have a much larger frequency error. This has been documented as an issue with XBees at 115.2kBaud.
One trick that may work is to send two STOP bits. This allows the UART receiver and extra bit time to re-synchronize on the next byte sent. Or insert a short delay between each byte send out the UART from the Arduino.
Another is to drop the Baud rate one step lower to 57.6kBaud.
The Arduino Uno that I looked up has a 16MHz crystal.
You can calculate, or use an easy software tool like “AVRcalc” to show you the baud rate error for 16MHz.
At 115200 baud, the AVR will be in error by 3.55% for a 16MHz crystal.
At 57600 baud, the error is 2.14%
At 9600 baud, the error is 0.16%
If you change the AVR’s crystal or resonator to 14.7456MHz (these are commonly available, cheap), the errors become 0 at all baud rates - because the crystal is a math multiple of the baud rates.
The XBee also has a baud rate error as its oscillator is 8.0MHz. So the XBee error at 115200 plus an AVR error can lead to occasional bit errors. Often, XCTU or a dumb terminal will talk OK to the XBee at the 115200 rate, but the occasional error is high. Or a PC’s serial port with 0% error in rate is OK but not the AVR w/16MHz.
And so on.