S32K312 UART data loss problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K312 UART data loss problem

339 Views
jack_huang1
Contributor III

Dears;

          When we were testing UART serial port reception, we found a problem of data loss during stress testing.

          At present, there are two ways for our serial port to receive data, with an indefinite length. The testing method is for the computer to send 20 bytes to the serial port every 10ms, with a serial port baud rate of 230400. Both DMA and interrupt methods have this issue.

         Serial port receiving method one:

         Get received data in the UartCallback callback

This method does not have data loss issues, but because each byte is called once, it consumes a lot of system resources.

Serial port receiving method 2:

          Use the Uart_GetStatus interface to query the received data. If there is received data, retrieve it.

This method takes up less resources, but due to the use of polling, if there happens to be serial data input during data retrieval, it can easily lead to data loss issues

        Due to the high resource consumption of method one, we hope to use method two. For the polling in method two, using the Uart_GetStatus interface to obtain received data may have a probability of data loss.Please analyze how to solve this problem. 

         Thank you!

 

     

Tags (1)
0 Kudos
Reply
1 Reply

315 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

this seems to be clearly application problem. If a polling cannot ensure servicing incoming data in time, then interrupt or DMA have to be used. If frequent interrupts are issue for application then you have to work with DMA...

You can try to enable RXFIFO if not have already done, this can help with data reception without loosing some. You can also try to change RXWATER mark level and see difference.
You can try to implement circular receive buffer and fill it within interrupt or using DMA and retrieve data upon needs.

BR, Petr

 

0 Kudos
Reply