AnsweredAssumed Answered

SPI_I2S_GetFlagStatus()-call alters SPIn->SR

Question asked by menecken on Nov 28, 2013
Latest reply on Nov 28, 2013 by Clive One
Hey everybody,

I'm experiencing unexpected behaviour here:
1. Debug point before entering GetFlagStatus(): SPI2-> SR = 3
2. while(SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_RXNE) == RESET) {}
3. Debug point in GetFlagStatus(): SPI2->SR = 2

How can that be? No interrupts are called, as far as I can tell.

Thanks in advance

Edit:
I also tried
while((SPI2->SR & SPI_I2S_FLAG_RXNE) == RESET) {}
But even when a debug point is set at that very line, than  SPI2->SR = 3, when I press F11 nothing happens, when I press F10 the debugger stays in the while loop with SPI2->SR somehow changed to 2. I dont get it...

I also tried
(SPI->SR = 2)
SPI_I2S_SendData(SPI2, byte);
(SPI->SR = 3)
int i = 1;
(SPI->SR = 2)

Outcomes