Host 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 host node configuration.
- Write FLEX_US_BRGR.CD and FLEX_US_BRGR.FP to configure the baud rate.
- Write NACT, PARDIS, CHKDIS, CHKTYPE, DLCM, FSDIS and DLC in FLEX_US_LINMR to configure the frame transfer.
- Check that FLEX_US_CSR. TXRDY is set to 1.
- Write FLEX_US_LINIR.IDCHR to send the header.
What comes next depends on the NACT configuration:
- Case 1: NACT = PUBLISH, the USART 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.