LIN Error Detection and Confinement

NI-CAN

LIN Error Detection and Confinement

The LIN 2.0 Specification specifies that error detection should be handled by the slave tasks and that monitoring of errors by the master task is not required. The LIN 2.0 Specification does not require handling of multiple errors within one LIN frame or the use of error counters. Upon encountering the first error in a frame, the slave task aborts processing of the frame until the detection of the next Break-Sync sequence (in the next header transmitted by the master). If the log bus errors attribute is set true, a bus error frame is logged into the read queue. If the log bus errors attribute is set false, an error is returned by ncWriteNet or ncWriteNetMult.

LIN also provides for error reporting to the network. The LIN 2.0 Specification defines a Response_Error status bit, which the slave is required to report to the master in one of its transmitted frames. This bit is set whenever a frame received or transmitted by a slave node contains an error in the response field. The bit is cleared after it is transmitted in one of the slaves published responses. The NI-CAN Frame API for LIN does not natively support the Response_Error status bit, but provides the end user with a means to easily implement this functionality at the application level. The procedure is to set the log bus errors attribute equal to one, to enable logging of bus error frames in the read queue. The application can then monitor for a read of a bus error frame with the error code indicating an error in the response. Upon this condition, the application can set a Response_Error status bit in a local variable. The application can then use the NI LIN response entry frame type to update the slave response queue with data containing the Response_Error status bit and then clear the bit in the local variable.