When servicing an interrupt, clear the
corresponding flag in the flag register (SCIFLR) before clearing the global
interrupt (LIN_GLB_INT_CLR). The ISR can follow the guidelines below. This prevents
any spurious or duplicate interrupt from occurring.
- Clear the LIN interrupt flag in the SCIFLR register.
- Read the LIN interrupt status register to make sure the flag
is cleared.
- Clear the global interrupt flag bit in LIN_GLB_INT_CLR.
Note: The transmit interrupt is generated before the LIN transmitter is ready to accept new data. Inside of the LIN transmit ISR, the software can wait until the buffer is completely empty before loading the next data. This can be done by polling for the Bus Busy Flag (SCIFLR.BUSY) to be 0.