Skip to main content
NBoga
Visitor II
November 16, 2021
Question

I2C flag RXNE automatically clear before read register

  • November 16, 2021
  • 1 reply
  • 933 views

I initiate reception from the microcircuit for stm32h723. However, the code hangs while waiting for the RXNE flag. In the debug, step by step, you can see that the flag is set after START, but is immediately reset to zero in the next step, before checking the flag. What could be the problem?

LL_I2C_SetTransferRequest(I2C3, LL_I2C_REQUEST_READ); 
LL_I2C_SetTransferSize(I2C3, 1); 
LL_I2C_GenerateStartCondition(I2C3); 
// Flag set and clear there. "while" always true.
while(!LL_I2C_IsActiveFlag_RXNE(I2C3));
 
recieveData = LL_I2C_ReceiveData8(I2C3);
 
LL_I2C_GenerateStopCondition(I2C3);

                 

This topic has been closed for replies.

1 reply

TDK
November 16, 2021

> In the debug, step by step, you can see that the flag is set after START, but is immediately reset to zero in the next step, before checking the flag. What could be the problem?

Reading RXDR in the debugger will clear the flag.

"If you feel a post has answered your question, please click ""Accept as Solution""."