2.3.1 CRC Calculation of Diagnostic Frames in LIN 2.x
Diagnostic frames of LIN 2.x use “classic checksum” calculation. Unfortunately, the setting of the checksum mode is enabled when the HEADER is transmitted/received. Usually, in LIN 2.x, the LIN/UART controller is initialized to process “enhanced checksums”. A slave task does not know what kind of frame it will work on before checking the ID.
Work Around
This work around is to be implemented only in the case of transmission/reception of
diagnostic frames.
- Slave task of master node: Before enabling the HEADER, the master must set the appropriate LIN13 bit value in the LINCR register.
- For slave nodes, the work
around is in two parts:
- Before enabling the
RESPONSE, use the following
function:
void lin_wa_head(void) { unsigned char temp; temp = LINBTR; LINCR = 0x00; // It is not a RESET ! LINBTR = (1<<LDISR)|temp; LINCR = (1<<LIN13)|(1<<LENA)|(0<<LCMD2)|(0<<LCMD1)|(0<<LCMD0); LINDLR = 0x88; // If it isn't already done }
- Once the RESPONSE is
received or sent (having RxOK or TxOK as well as LERR), use the
following
function:
void lin_wa_tail(void) { LINCR = 0x00; // It is not a RESET ! LINBTR = 0x00; LINCR = (0<<LIN13)|(1<<LENA)|(0<<LCMD2)|(0<<LCMD1)|(0<<LCMD0); }
- Before enabling the
RESPONSE, use the following
function:
Affected Silicon Revisions
Rev. A | Rev. B | Rev. C |
X | - | - |