Client Node Configuration
- Write FLEX_US_CR.TXEN and FLEX_US_CR.RXEN to enable both the transmitter and the receiver.
- Write FLEX_US_MR.USART_MODE to select the LIN mode and the client node configuration.
- Write FLEX_US_BRGR.CD and FLEX_US_BRGR.FP to configure the baud rate.
- Wait until FLEX_US_CSR.LINID rises.
- Check LINISFE and LINPE errors.
- Read FLEX_US_RHR.IDCHR.
- Write NACT, PARDIS, CHKDIS, CHKTYPE, DLCM and DLC in FLEX_US_LINMR to configure the frame transfer.
IMPORTANT: If the NACT configuration for this frame is PUBLISH, FLEX_US_LINMR must be written with NACT = PUBLISH even if this field is already correctly configured, in order to set the TXREADY flag and the corresponding write transfer request.
What comes next depends on the NACT configuration:
- Case 1: NACT = PUBLISH, the LIN controller sends the response.
- Wait until FLEX_US_CSR.TXRDY rises.
- Write FLEX_US_THR.TCHR to send a byte.
- If all the data have not been written, repeat the two previous steps.
- Wait until FLEX_US_CSR. LINTC rises.
- Check the LIN errors.
- Case 2: NACT = SUBSCRIBE, the USART receives the response.
- Wait until FLEX_US_CSR.RXRDY rises.
- Read FLEX_US_RHR.RCHR.
- If all the data have not been read, repeat the two previous steps.
- Wait until FLEX_US_CSR.LINTC rises.
- Check the LIN errors.
- Case 3: NACT = IGNORE, the USART is not concerned by the response.
- Wait until FLEX_US_CSR.LINTC rises.
- Check the LIN errors.