cancel
Showing results for 
Search instead for 
Did you mean: 

I2C flag RXNE automatically clear before read register

NBoga
Associate

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);

                 

1 REPLY 1
TDK
Guru

> 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".