Datasheet
www.ti.com
LIN
28.3.4 LIN Configurations
The following list details the configuration steps that software should perform prior to the transmission or
reception of data in LIN mode. As long as SWnRST is held low the entire time that the LIN is being
configured, the order in which the registers are programmed is not important.
• Enable LIN by setting RESET bit.
• Clear SWnRST to 0 before configuring the LIN.
• Configure the LINRX and LINTX pins as SCI functional by setting the RX FUNC and TX FUNC bit.
• Select LIN mode by programming LIN MODE bit.
• Select Master or Slave mode by programming the CLOCK bit.
• Select the desired frame format (checksum, parity, length control) by programming SCIGCR1.
• Select multi-buffer mode by programming MBUF MODE bit.
• Select the baud rate to be used for communication by programming BRSR.
• Set the Maximum baud rate to be used for communication by programming BRSR.
• Set the CONT bit to make LIN not to halt for an emulation breakpoint until its current reception or
transmission is complete (this bit is used only in an emulation environment).
• Set LOOP BACK bit to connect the transmitter to the receiver internally (this feature is used to perform
a self-test).
• Select the receiver enable RXENA bit if data is to be received.
• Select the transmit enable TXENA bit if data is to be transmitted.
• Select the RX ID MASK and the TX ID MASK fields in the LINMASK register.
• Set SWnRST to 1 after the SCI is configured.
• Perform Receive or Transmit data (see Section 28.3.1.9, Section 28.3.1.10, and Section 28.3.4.2).
28.3.4.1 Receiving Data
The LIN receiver is enabled to receive messages if the RX FUNC bit and the RXENA bit are set to 1. If the
RX FUNC bit is not set, the LINRX pin functions as a general purpose I/O pin rather than as an SCI/LIN
function pin.
ID RX flag is set after a valid LIN ID is received with RX Match, generated ID interrupt if enabled.
28.3.4.1.1 Receiving Data in Single-Buffer Mode
Single Buffer Mode is selected when MBUF MODE bit is 0. In this mode SCI/LIN sets the RXRDY bit
when it transfers newly received data from SCIRXSHF to RD0. The SCI clears the RXRDY bit after the
new data in RD0 has been read. Also, as data is transferred from SCIRXSHF to RD0, the LIN sets FE,
OE, or PE if any of these error conditions were detected in the received data. These error conditions are
supported with configurable Interrupt capability.
You can read the Received data by:
1. Polling Receive Ready Flag
2. Receive Interrupt
3. DMA
In polling method, software can poll for RXRDY bit and read the data from RD0 byte of LINRD0 register
once RXRDY is set high. CPU is unnecessarily overloaded by selecting Polling mode. To avoid this, you
can use either Interrupt or DMA method. To use interrupt method SET RX INT bit should be set and to
use DMA SET RX DMA bit should be set. Either an Interrupt or a DMA request is generated the moment
RXRDY is set. If checksum scheme is used once Compare Checksum CC bit is set, the checksum will be
compared on the byte that is currently being received, expected to be the checkbyte be enabled during the
last byte of the data. CC bit will be cleared once Checksum is received. A CE will immediately be flagged
if there is a checksum error.
1381
SPNU562–May 2014 Serial Communication Interface (SCI)/Local Interconnect Network (LIN)
Module
Submit Documentation Feedback
Copyright © 2014, Texas Instruments Incorporated