Description
This is Issue 971 moved from a Google Code project.
Added by 2012-06-30T11:39:17.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
What steps will reproduce the problem?
- Connect XBee module running at 57600 baud to e.g. pins 8 and 9
- Send data to XBee from e.g. a PC
- Receive data from XBee using SoftwareSerial at 57600 baud
You would expect the data to be properly received in Arduino, but this only works correctly for 1 byte packets. If I send larger packets of data, only the first character is read correctly, the rest of the characters are garbled.
This does not happen when using serial speeds lower than 57600.
This happened to me using Arduino 1.0.1 on Windows 7, with an Arduino Uno (have not tried any other versions of software or hardware).
I do not know if this is just a slight mismatch of the exact speeds, combined with perhaps the XBee not using exactly 57600 baud either (I remember seeing some info on the net saying the XBee serial speeds are also approximations). However, by slightly tweaking the delay constants in SoftwareSerial.cpp I was able to fix the problems. The following settings seemed to work for me:
// baud rxcenter rxintra rxstop tx
{ 57600, 10, 36, 36, 33, },
Someone with an oscilloscope or logic analyzer could perhaps verify these slightly adjusted timings. I would also suggest modifying the debug code in SoftwareSerial to only output a DebugPulse for the stop bit, so the debugging would not mess with the actual timings so much..