I am working with UART communication using LPUART on S32K322 and encountering an issue when receiving more than 14 characters. Specifically, when calling Lpuart_Uart_Ip_GetReceiveStatus I get the error LPUART_UART_IP_STATUS_RX_OVERRUN
Could you please provide insights into:
Any guidance related to this issue would be greatly appreciated.
Hi
The driver changes UartState->ReceiveStatus to LPUART_UART_IP_STATUS_RX_OVERRUN if the flag OR = 1 in the STAT register.
Refer to Lpuart_Uart_Ip_ErrIrqHandler() in Lpuart_Uart_Ip.c
This flag is set when STAT[RDRF] = 1, and the driver fails to read the data before another byte is received, the data register overflows.
I don't know how many bytes you sent and what argument you pass as the RxSize parameter in Lpuart_Uart_Ip_AsyncReceive().
If you send more bytes than what was passed to the AsyncReceive() function, the overrun can be avoided by using this API of the Uart_Ip driver: Lpuart_Uart_Ip_SetRxBuffer()
Refer to this example: Lpuart_Ip_Set_Tx_Buffer_Example_S32K344_S32DS35_RTD400_P24
In the callback, check for LPUART_UART_IP_EVENT_RX_FULL and update the buffer using Lpuart_Uart_Ip_SetRxBuffer().
If you use the interrupt mode, I would recommend using a higher priority for the RX interrupt so that the core can read the LPUART RX FIFO in time.
If the length of data to be received is not fixed and varies time to time, then it is recommended to refer to Uart_Idle_S32K344_LLD_RTD400.zip attached in DMA UART IDLE
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------