cancel
Showing results for 
Search instead for 
Did you mean: 

In Rx Polling Mode, HAL_UART_Receive() is stuck in UART_WaitOnFlagUntilTimeout() waiting for the RXNE flag to get set in the UART's Status Register.

RJepp.1
Associate II

I'm using a STM32F407-Disc1 board, and my polled HAL_UART_Receive() is stuck waiting for the RXNE flag to get set in the UART Status register. Ironically, when using the STM32CubeIDE debugger and looking at the SFR registers for my UART, it looks like data does arrive at the DR register, but the RNXE does not assert.

I can transmit in Polled mode, I just can't receive. Any thoughts?

2 REPLIES 2
Karl Yamashita
Lead III

post the HAL_UART_Receive() function call you're waiting for it to timeout.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
gbm
Lead III

Close the debugger view of UART registers. When it's open, the debugger repeatively reads the data from UART's DR and this way RXNE flag gets cleared, so your program gets stuck.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice