I am using an XBee radio setup to transmit bytes over a distance of approximately .25 miles. For the first 20,000, or so, transmissions it was completely error free. However, once there was a single error, every other transmission became an error. For my project a transmission consists of three bytes, with the third byte being an XOR of the first two. The first byte also has a parity bit. The 1st byte is a sensor number and the second byte is data. In the past I've received a few transmissions with errors detectable through the parity or XOR, but these did not cause an "avalanche effect" of errors. However, yesterday when I was running the radio setup, after ~20,000 transmissions (~60,000 bytes) there was an error, and after that error occurred, all transmissions were detected as containing errors. What I am hypothesizing occurred was that a single byte was dropped in transmission completely throwing off the sequence of bytes for a transmission. For example, the second "data" byte was lost, meaning the next transmission would consist of the first "sensor" byte, the third "XOR" byte, and the next first "sensor" byte. This error would continue to effect all later transmissions. I am operating a baud rate of 9600, with a nominal baud rate that is much lower. For this reason, I do not believe this is an issue with the serial buffer instead of a dropped byte, but I could be wrong. Is it possible that a byte would be dropped given the scenario I explained? If so, how could this be fixed in software/hardware? If it is likely to be a serial buffer issue, can this be solved? I know according to the Arduino core documentation increasing the serial buffer size beyond 256 may cause race conditions.

  • 1
    You need to learn the concept of synchronisation and proper packetisation. – Majenko Nov 24 '16 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.