34.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 34-13. 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.
  • The DATA register written to 0x00. This triggers transmission of the break field by hardware. Writing the DATA register with any other value will also result in the transmission of the break field by hardware.
  • The DATA register written to 0x55. The 0x55 value (sync) is transmitted.
  • The 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 (INTFLAG.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.
  • The 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 34-14. LIN Header Generation

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