When UCIREN is set, the IrDA encoder and decoder are enabled and provide hardware bit shaping for IrDA communication.

IrDA EncodingThe encoder sends a pulse for every zero bit in the transmit bitstream coming from the UART (see Figure 36-7). The pulse duration is defined by UCIRTXPLx bits specifying the number of one-half clock periods of the clock selected by UCIRTXCLK.


To set the pulse time of the 3/16 bit period required by the IrDA standard, the BITCLK16 clock is selected with UCIRTXCLK = 1, and the pulse length is set to six one-half clock cycles with UCIRTXPLx = 6 – 1 = 5. When UCIRTXCLK = 0, the pulse length tPULSE is based on BRCLK and is calculated as:

UCIRTXPLx = tPULSE × 2 × fBRCLK – 1 When UCIRTXCLK = 0, the Prescaler UCBRx must be set to a value greater or equal to 5.

IrDA Decoding

The decoder detects high pulses when UCIRRXPL = 0. Otherwise, it detects low pulses. In addition to the analog deglitch filter, an additional programmable digital filter stage can be enabled by setting UCIRRXFE. When UCIRRXFE is set, only pulses longer than the programmed filter length is passed. Shorter pulses are discarded. The equation to program the filter length UCIRRXFLx is:

UCIRRXFLx = (tPULSE − tWAKE) × 2 × fBRCLK – 4


tPULSE = Minimum receive pulse width

tWAKE = Wake time from any low-power mode. Zero when the device is in active mode.