Timing issues between XBee S2 and Photon

I’m trying to set up a remote display application.

Communication between two XBee S2’s is working fine, transparent mode (AT), when I test PC to PC. However when interfacing with a Photon microcontroller, even at 9600 or 19200 baud, I am losing characters if I send strings vs individual bytes. I tried adding an extra stop bit with ATNB=3, to no avail.

If I send one byte at a time, I get fully reliable transmission. However my application is fairly timing-critical and I need fairly short latency. Any help / pointers is welcome…

What is your RO command set to? The default is 3 character times of silence on the UART.

If you need very short timings and do not need Mesh, then you may need to look at using the XBee 802.15.4 modules instead. All mesh protocols are by nature slow as there are rout discoveries that need to occur.

I’ve set RO to zero - hoping to send each byte immediately.

My application is to help a car driver park accurately, so a display update rate of a few Hz is enough.

The timing I’m referring to is the time interval between bytes in the serial link between XBee and Photon. Adding a mark parity bit (effectively equivalent to a 2nd stop bit) wasn’t enough to have reliable serial transmission. I’d hate to have to program a delay between each transmitted byte.

Sounds like you need to work on your code for sending/reading the serial buffers on your Photon processor. I would suggest using API mode with API frames and hardware flow control. That should solve the issue of only being able to receive one byte at a time.


I have eventually achieved reliable communication @ 4800 baud, with mark parity to simulate an extra stop bit, and with improved error handling in the Photon code.