30.6.3.5 LIN Host

LIN host is available with the following configuration:

  • LIN host format (CTRLA.FORM = 0x02)
  • Asynchronous mode (CTRLA.CMODE = 0)
  • 16x sample rate using fractional baud rate generation (CTRLA.SAMPR = 1)

LIN frames start with a header transmitted by the host. The header consists of the break, sync, and identifier fields. After the host transmits the header, the addressed client will respond with 1-8 bytes of data plus checksum.

Figure 30-12. LIN Frame Format

Using the LIN command field (CTRLB.LINCMD), the complete header can be automatically transmitted, or software can control transmission of the various header components.

When CTRLB.LINCMD=0x1, software controls transmission of the LIN header. In this case, software uses the following sequence.

  • CTRLB.LINCMD is written to 0x1
  • DATA register written to 0x00. This triggers transmission of the break field by hardware. Note that writing the DATA register with any other value will also result in the transmission of the break field by hardware.
  • DATA register written to 0x55. The 0x55 value (sync) is transmitted.
  • DATA register written to the identifier. The identifier is transmitted.
Note: It is recommended to use the Data Register Empty flag in the interrupt Flag Status and Clear register (INTFGLAG.DRE) to ensure no extra delay is added during the transmission of the data.

When CTRLB.LINCMD=0x2, hardware controls transmission of the LIN header. In this case, software uses the following sequence.

  • CTRLB.LINCMD is written to 0x2
  • DATA register written to the identifier. This triggers transmission of the complete header by hardware. First the break field is transmitted. Next, the sync field is transmitted, and finally the identifier is transmitted.

In LIN host mode, the length of the break field is programmable using the break length field (CTRLC.BRKLEN). When the LIN header command is used (CTRLB.LINCMD=0x2), the delay between the break and sync fields, in addition to the delay between the sync and ID fields are configurable using the header delay field (CTRLC.HDRDLY). When manual transmission is used (CTRLB.LINCMD=0x1), software controls the delay between break and sync.

Figure 30-13. LIN Header Generation

After header transmission is complete, the client responds with 1-8 data bytes plus checksum.