UART/IrDA/CIR Basic Programming Model
19.4.2 IrDA Programming Model
19.4.2.1 SIR Mode
19.4.2.1.1 Receive
The following programming model explains how to program the module to receive an IrDA frame with
parity forced to 1, baud rate = 112.5KB, FIFOs disabled, 2 stop-bits, and 8-bit word length:
1. Disable the UART before accessing the UARTi.UART_DLL and UARTi.UART_DLH registers:
Set the UARTi.UART_MDR1[2:0] MODE_SELECT bit field to 0x7.
2. Grant access to the UART_DLL and UART_DLH registers (the UART_LCR[7] DIV_EN bit = 1):
UARTi.UART_LCR = 0x80 (Data format is unaffected by the use and settings of the
UARTi.UART_LCR register in IrDA mode.)
3. Load the new baud rate (115.2 kbps):
UARTi.UART_DLL = 0x1A
UARTi.UART_DLH = 0x00
4. Set SIR mode:
UARTi.UART_MDR1[2:0] MODE_SELECT = 0x1
5. Disable access to the UART_DLL and UART_DLH registers and switch to register operational mode:
UARTi.UART_LCR = 0x00.
6. Optional: Enable the RHR interrupt:
UARTi.UART_IER[0] RHR_IT = 0x1
19.4.2.1.2 Transmit
The following programming model explains how to program the module to transmit an IrDA 6-byte frame
with no parity, baud rate = 112.5 kbps, FIFOs disabled, 3/16 encoding, 2 stop-bits, and 7-bit word length:
1. Disable the UART before accessing the UARTi.UART_DLL and UARTi.UART_DLH registers:
Set the UART_MDR1[2:0] MODE_SELECT bit field to 0x7.
2. Grant access to the UART_EFR register:
UARTi.UART_LCR = 0xBF
3. Enable the enhanced features (the UART_EFR[4] ENAHNCED_EN bit = 1):
Set the UARTi.UART_EFR register value to 0x10.
4. Grant access to the UART_DLL and UART_DLH registers (the UART_LCR[7] DIV_EN bit = 1):
UARTi.UART_LCR = 0x80 (Data format is unaffected by the use and settings of the
UARTi.UART_LCR register in IrDA mode.)
5. Load the new baud rate (115.2 kbps):
UARTi.UART_DLL = 0x1A
UARTi.UART_DLH = 0x00
6. Set SIR mode (the UART_MDR1[2:0] MODE_SELECT bit field = 0x1):
UARTi.UART_MDR1 = 0x01
7. Disable access to the UART_DLL and UART_DLH registers and switch to register operational mode:
UARTi.UART_LCR = 0x00.
8. Force DTR output to active:
UARTi.UART_MCR[0] DTR = 1
9. Optional: Enable the THR interrupt:
UARTi.UART_IER[1] THR_IT = 1
10. Set transmit frame length to 6 bytes:
UARTi.UART_TXFLL = 0x06
11. Set 7 starts of frame transmission:
UARTi.UART_EBLR = 0x08
12. Optional: Set SIR pulse width to be 1.6 us:
UARTi.UART_ACREG[7] PULSE_TYPE = 1
13. Load the UART_THR register with the data to be transmitted.
3502
Universal Asynchronous Receiver/Transmitter (UART)
SPRUH73H – October 2011 – Revised April 2013
Copyright © 2011–2013, Texas Instruments Incorporated