How to send break field, delimiter, and Sync byte using UART to implement LIN master. Means how we are going to send data with UART because need to send 13 dominant bits for sync break, however in uart we have 8 bit limit (and 1 start bit and 1 stop). If any one know the answer please share the information step by step process of break field, delimiter, and Sync byte.
Please help me to find the solution
Thanks in advance
Solved! Go to Solution.
Hi,
LIN Driver/Stack is free and part of SDK/RTM driver in S32Design studio.
If using RTD drivers, stack need to be added from https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=SW32K1-REFSW-D
MCAl driver is available as well, refer device web page.
BR, Petr
Thank you for your response,
How will I get the Lin Stack/ Driver, Is it open source or its need any license required, If license require please send me those details.
Hi,
LIN Driver/Stack is free and part of SDK/RTM driver in S32Design studio.
If using RTD drivers, stack need to be added from https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=SW32K1-REFSW-D
MCAl driver is available as well, refer device web page.
BR, Petr
Thank you very much for the information.
Hi,
the way to send break is described in chapter 53.4.3.1 Send break and queued idle of the device RM.
The code to send LIN header could be
void LIN_SendHeader(uint8_t PID) { while((LPUART0->STAT & LPUART_STAT_TDRE_MASK) == 0); /* Wait until Transmit data buffer become empty */ LPUART0->CTRL |= LPUART_CTRL_SBK_MASK; /* SBK=1: Queue break character(s) to be sent */ LPUART0->CTRL &= ~LPUART_CTRL_SBK_MASK; /* SBK=0: Normal transmitter operation */ while((LPUART0->STAT & LPUART_STAT_TDRE_MASK) == 0); /* Wait until Transmit data buffer become empty */ LPUART0->DATA = 0x55; /* Transmit Sync Byte */ while((LPUART0->STAT & LPUART_STAT_TDRE_MASK) == 0); /* Wait until Transmit data buffer become empty */ LPUART0->DATA = PID; /* transmit PID */ while((LPUART0->STAT & LPUART_STAT_TC_MASK) == 0); /* transmission activity complete */ }
If interesting in SDK code then you can refer to lin_master_baremetal demo included in the S32Design Studio, which shows the usage of the LIN driver in master mode.
BR, Petr