LIN
1648
SPNU563A – March 2018
Copyright © 2018, Texas Instruments Incorporated
Serial Communication Interface (SCI)/ Local Interconnect Network (LIN)
Module
NOTE:
If the BLIN module, configured as Slave in multi-buffer mode, is in the process of
transmitting data while a new header comes in, the module might end up in responding with
the data from the previous interrupted response (not the data corresponding to the new ID).
To avoid this scenario the following procedure could be used:
1.
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).
2.
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 might
be written twice for one ID.
3.
Once the complete ID is received, based on the match, the newly configured data will be
transmitted by the node.
29.3.1.5.1 Event Triggered Frame Handling Proposal
The LIN 2.0 protocol uses event-triggered frames that may occasionally cause collisions. Event-triggered
frames have to be handled in software.
If no slave answers to an event triggered frame header, the master node will set the NRE flag, and a NRE
interrupt will occur if enabled. If a collision occurs, a frame error and checksum error may arise before the
NRE error. Those errors are flagged and the appropriate interrupts will occur, if enabled.
Frame errors and checksum errors depend on the behavior and synchronization of the responding slaves.
If the slaves are totally synchronized and stop transmission once the collision occurred, it is possible that
only the NRE error is flagged despite the occurrence of a collision. To detect if there has been a reception
of one byte before the NRE error is flagged, the BUS BUSY flag can be used as an indicator.
The bus busy flag is set on the reception of the first bit of the header and remains set until the header
reception is complete, and again is set on the reception of the first bit of the response. In the case of a
collision the flag is cleared in the same cycle as the NRE flag is set.
Software could implement the following sequence:
•
Once the reception of the header is done (poll for RXID flag), wait for the bus busy flag to get set or
NRE flag to get set.
•
If bus busy flag is not set before NRE flag, then it is a true no response case (no data has been
transmitted onto the bus).
•
If bus busy flag gets set, then wait for NRE flag to get set or for successful reception. If NRE flag is set,
then in this case a collision has occurred on the bus.
Even in the case of a collision, the received (corrupted) data is accessible in the RX buffers; registers
LINRD0 and LINRD1.