25.3.4.3.2 LIN Host

LIN Host mode is enabled by configuring the Frame Format (FORM) bit field to LIN Host (LINHOST) mode. In this mode, the USART can transmit LIN headers with a BREAK, SYNC and Protected Identifier (PID) field. The header can be controlled by software, or fully automated by hardware.

Figure 25-13. LIN Frame Format
Software-controlled header transmission is performed by first using the LIN hardware to transmit a BREAK field, and then to manually transmit the SYNC and PID field. To transmit the header using software, the following sequence must be followed:
  1. Set the LIN Command (LINCMD) bit field in the Command (USARTn.COMMAND) register to BREAK (0x01).
  2. Write any value to the Transmit Data (USARTn.TXDATAL) register to trigger the transmission of the BREAK field.
  3. Write 0x55 to the Transmit Data (USARTn.TXDATAL) register to transmit the SYNC field.
  4. Write the PID value (including parity bits) to the Transmit Data (USARTn.TXDATAL) register.
Automatic header transmission is performed by configuring the mode and writing the identifier to the data register. The BREAK, SYNC and PID are all transmitted automatically. The PID is generated by calculating the parity bits from the identifier. To transmit the header automatically, the following sequence must be followed:
  1. Set the LIN Command (LINCMD) bit field in the Command (USARTn.COMMAND) register to HEADER (0x02).
  2. Write the identifier value to the Transmit Data (USARTn.TXDATAL) register.

In LIN Host mode, the length of the BREAK field is programmable using the Break Length (BRKLEN) bit field in the Control F (USARTn.CTRLF) register. When the automatic header command is used, the delay between the BREAK and SYNC fields is fixed to two bit times. When software controlled transmission is used, software controls the delay between the BREAK and SYNC fields.

Figure 25-14. LIN Header