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.
  1. Slave task of master node: Before enabling the HEADER, the master must set the appropriate LIN13 bit value in the LINCR register.
  2. For slave nodes, the work around is in two parts:
    1. 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
      }       
      
    2. 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);
      }    
      
The time-out counter is disabled during the RESPONSE when this work around is set.

Affected Silicon Revisions

Rev. ARev. BRev. C
X--