STM32F407, SPI RXNE flag does not clear
I have an STM32F407 micro using the SPI. SPI is setup as a master at 1MHZ clock.
I send a group of data (output only) which operates correctly. The SPI does not receive any useful data at this time. After the last byte has been sent out, I loop and wait for the SPI RXNE flag to become set. This is the flag that I use to indicate that the transmission is complete, and data (not useful) is waiting in the receive portion of the DR.
I read the SPI data register to clear the flag (dummy = SPI->DR;). However, the flag does not clear automatically. This is verified by setting a breakpoint immediately past the point where I read the data register, and looking at the RXNE flag in SPI status register.
It is not until that I single step the code that the RXNE flag is cleared.
I was thinking that this may be some sort of debugger HW artifact, but it doesn't appear to be. Later in the code, it blows right through a portion of code that is checking this flag, and it is still set when it should not be.
Two screen snapshots below are shown. The 1st one is where the code has hit the breakpoint right after reading the SPI DR. The RXNE flag in SPI SR should be clear at this point, and it's not. The 2d screen snapshot shows the RXNE flag is SPI SR after the code was single stepped once.
What's up with that ?


