Ensuring byte-alignment for ASYNC over RF Ensuring byte-alignment for ASYNC over RF

Ensuring byte-alignment for ASYNC over RF

When using ASYNC communications over an RF link it is often difficult to ensure that the receiver is properly syncronized at the byte level. If the receiver isn't syncronized you will see framing errors, invalid characters, or both.

Note: this discussion is based on the following constraints and asssumptions.

First, we want to transmit a continuous alternating sequence of 0's and 1's to condition the receiver and set up the bit-level syncronization. We can do so by repeatedly transmitting the byte value 0x55 as a preamble. This works because we send:

START BIT (0)
bit 0 (1)
bit 1 (0)
.
.
.
bit 6 (1)
bit 7 (0)
STOP BIT (1)

The receiving UART will nicely sync on this, but of course it could be misaligned byte wise. There are 5 possible conditions:

Now we have to come up with a way to convert the unaligned cases to the aligned case by taking advantage of the way the UART detects framing errors. We do this by transmitting a 0 data bit where the UART expects a stop bit (a 1). We carefully pick values to send so that the framing errors that we cause results in the UART translating the cases B, C, D and E to case A, sometimes through several steps.

So, in summary, the transmitter could send:

And now we know we have the correct byte syncronization!

Comments:

Questions:

Comments:

Scott Lee Says:

Great idea in general. But why not just use a single byte that will correct all four byte alignment problems? 0xF0 seems to work great for me. In addition, 0xF0 is balanced unlike the four bytes you propose. Also if the data that follows is manchester encoded then the receive routine can assume a sync (reset the receive buffer) in the event of a FERR or a 0xF0 (or a single byte that is not valid manchester if you prefer).