I am experiencing difficulties with package loss and data overlapping (mixing of packages from several units) with UART.
- Because of low power consumption, the slaves wake up (at random intervals), perform their tasks and send the data to the master. The communication is therefore iniated by the slave.
- The master receives the data and sends an acknowledgement to the slave. The slaves attempts to send the data again for 20 times while no acknowledge is received.
- Slaves all send to the master, and do not receive each others data.
- The master sends to all slaves that are listening on that moment, programmatically I filter which slave should actually parse the message (The first two characters are the ID for which the message is ment for).
So far so good. But... I have package loss because of great distances. To overcome the affect of package loss I let the slaves sent their request/data again when the server does not acknowledge the data. No acknowledgement means noise in the line of communication.
I am using XBee (Zigbee) units (1 coordinator, the other two are end devices).
I use 9600 baud, even parity, 8 data bits, 1 stop bit and XON XOFF handshaking. RTS and CTS are not available (by default) on the XBee module (arduino shield), so no hardware handshaking in my case.
Most important question: How to prevent data packages to get mixed up. By mixing up I mean, unit 1 sends, but before all the bytes were sent, unit 2 send in the middle of it.
Thanks in advance. Hopefully I made myself clear, I want to keep it a relatively short post.
0 · ·