UART overrun error occurs when set rx fifo watermark

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

UART overrun error occurs when set rx fifo watermark

跳至解决方案
170 次查看
wasdqwerfzxcv
Contributor I

Good morning,

I am developing a project based on MCXA132VFT. I am facing issue that with the configuration below UART overrun error occurs when receiving UART data 

wasdqwerfzxcv_0-1762225587075.png

However, the UART overrun error didnt occurs if I set the RX FIFO watermark to 0. (Even the RX FIFO watermark is just 1 instead of 3 UART overrun error still happens) 

Besides, from the reference manual seems like overrun flag is set to 1 when receiving data while RDRF flag is 1.  Since RDRF flag is set to 1 when the number of data in the RX FIFO is greater than the watermark so is this means overrun flag will be triggered even though RX FIFO is not full? 

wasdqwerfzxcv_1-1762225773563.png

wasdqwerfzxcv_2-1762225838886.png

Thank you very much for your time and help.

 

Best regards

 

 

标签 (1)
0 项奖励
回复
1 解答
127 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @wasdqwerfzxcv 

When the RX FIFO watermark (RXWATER) is set higher than 0, the RDRF flag becomes 1 before the FIFO is actually full. If the software does not read out the FIFO fast enough after RDRF=1, new incoming bytes can fill the FIFO completely, and once it’s full, the next received character causes the overrun error.

When you set RXWATER=0, the interrupt triggers earlier—after just one received byte—so your software has more time to read data, preventing FIFO full conditions and avoiding overrun.

Therefore, the overrun flag is not triggered just because RDRF=1, but only when the FIFO is full and another new character arrives. However, setting the watermark too high increases the risk that the FIFO becomes full before your software empties it.

So i think you can Keep RXWATER = 0 if you want earliest interrupt and minimal risk of overrun.

Or, if using RXWATER > 0, ensure:

UART RX interrupt has high priority.

BR

Harry

在原帖中查看解决方案

0 项奖励
回复
1 回复
128 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @wasdqwerfzxcv 

When the RX FIFO watermark (RXWATER) is set higher than 0, the RDRF flag becomes 1 before the FIFO is actually full. If the software does not read out the FIFO fast enough after RDRF=1, new incoming bytes can fill the FIFO completely, and once it’s full, the next received character causes the overrun error.

When you set RXWATER=0, the interrupt triggers earlier—after just one received byte—so your software has more time to read data, preventing FIFO full conditions and avoiding overrun.

Therefore, the overrun flag is not triggered just because RDRF=1, but only when the FIFO is full and another new character arrives. However, setting the watermark too high increases the risk that the FIFO becomes full before your software empties it.

So i think you can Keep RXWATER = 0 if you want earliest interrupt and minimal risk of overrun.

Or, if using RXWATER > 0, ensure:

UART RX interrupt has high priority.

BR

Harry

0 项奖励
回复