Automatic generation of the LIN
protocol header data stream is supported without CPU interaction. The CPU or the DMA triggers the LIN state machine to generate a message header. A
commander node initiates
header generation on the CPU or DMA writes to the IDBYTE in the LINID register. The header is always
sent by the commander to initiate a LIN
communication and consists of three fields: synchronization break field,
synchronization field, and identification field, as seen in Figure 13-241.
Note: The LIN protocol uses the parity bits in the identifier. The control length bits are optional to the LIN protocol.
- The break field consists of two components:
- The synchronization break (SYNCH BREAK) consists of a minimum of 13 (dominant) low bits to a maximum of 20 dominant bits. The sync break length can be extended from the minimum with the 3-bit SBREAK value in the LINCOMP register.
- The synchronization break delimiter (SDEL) consists of a minimum of 1 (recessive) high bit to a maximum of 4 recessive bits. The delimiter marks the end of the synchronization break field. The sync break delimiter length depends on the 2-bit SDEL value in the LINCOMP register.
- The synchronization field (SYNCH FIELD) consists of one start bit, byte 0x55, and a stop bit. SYNCH FIELD is used to convey Tbit information and resynchronize LIN bus nodes.
- The identifier field ID byte can
use 6 bits as an identifier, with optional length control and two optional bits
as parity of the identifier. The identifier parity is used and checked if the
PARITYENA bit is set. If length control bits are not used, then there can be a
total of 64 identifiers plus parity. If neither length control or parity are
used there can be up to 256 identifiers. See Figure 13-242 for an illustration of the ID field.
Note: Optional Control Length
BitsThe control
length bits only apply to LIN standards prior to LIN 1.3. IDBYTE field
conveys response length information if compliant to standards earlier
than LIN1.3. The SCIFORMAT register stores the length of the response
for later versions of the LIN protocol.
Note: If the LIN module, configured as a
responder in multibuffer mode, is in the process of transmitting data while a new header comes in, the module can end up responding with the data from the previous interrupted response (not the data corresponding to the new ID). To avoid this scenario, the following procedure can be used:
- Check for the Bit Error (BE) during the response transmission. If the BE flag is set, this indicates that a collision has happened on the LIN bus (here because of the new Synch Break).
- In the Bit Error ISR, configure the TD0 and TD1 registers with the next set of data to be transmitted on a TX Match for the incoming ID. Before writing to TD0/TD1 make sure that there was not already an update because of a Bit Error; otherwise, TD0/TD1 can be written twice for one ID.
- Once the complete ID is received, based on the match, the newly configured data is transmitted by the node.