RF transmission: Bits Gotta Alternate

related: communication , radio , rf , embedded

When one converts digital data into bouncing particles of air, using “electromagnetic radiation” and the voodoo magic associated with it, one discovers some necessary tricks to make that magic work.  One very important trick:

Bits Gotta Alternate.

There are a bunch of reasons why Bits Gotta Alternate:

Reason 1: Clock Recovery

A radio transmission is serialized data, but, unlike the serial data that often runs between ICs, there’s no room for a clock line.  That means the transmitter and receiver need to synchronize clocks using the data itself.  This is clock recovery.  Basic stuff.

The receiver has a free-running clock, and adjusts it to match the bit transitions in the data it receives.  The more bit transitions it sees, the tighter the clock sync.  The fewer transitions, the more chance for clocks falling out of sync.

If the transmitter sends a really long string of identical bits, say 16 identical bits in a row, the receiver’s clock can (and likely will) drift too far from the transmitter’s clock, and lose track of how many bits have come in.

An example of something that probably won’t work: a 256-byte fixed packet, padded with 0xFF or 0x00 at the end if the data is shorter than 256 bytes.  This is not a terribly uncommon situation for non-radio situations, but if you send a packet with only a few non-padding bytes in it over a radio, the receiver’s clock is likely to give up the ghost when it sees that huge block of identical bits at the end.

Alternatin’ bits are good for clock recovery.  

Reason 2: Bandwidth utilization

Ask an RF engineer.  

The basics: when you transmit data at some frequency, you also hit nearby harmonic frequencies.  You transmit on some center frequency, and also hit a bunch of nearby frequencies.  The range of frequencies around the center frequency make up your frequency bandwidth.

So, and here’s the voodoo magic, the bytes you transmit affect the individual frequencies you hit around the center frequency.  If you send the same values a lot, such as a big ol’ block of 0xFFs, you will have a big power spike on some frequency, and the rest in your channel will be under-utilized.  And that’s bad.  Ask an RF engineer.

Alternating bits, alone, doesn’t necessarily shift your frequency spikes, but alternating bits at varying rates does.  If your data is uniformly distributed across all the possible values, your frequency utilization will be, too. 

Reason 3: DC Bias

DC Bias is the mean DC level of the output signal.  And it’s bad in an radio transmission: a maintained DC voltage can cause filter capacitors (that normally pass AC) to block the signal if the caps saturate.  And other things, ask an RF engineer.  But, the important part is, most radios don’t like transmitting DC.

A big block of 0’s or 1’s is DC.

So alternate your bits.

Reason 4…N!

There are a lot more reasons.  Like Automatic Gain Control, for similar reasons as clock recovery.  If the AGC circuit sees all 1’s for long enough, it may lose its reference, forget what it’s doing and start calling them 0’s.  Or vice versa. 

All of this was just an unnecessarily long lead in to the next posts on how to unlink the transmitted data itself from the periodicity of its bit runs by using certain line coding techniques.