Skip to main content
MVele.1
Associate II
January 12, 2021
Question

STM32F205 - Value of USART->DR (RDR) register after reading

Hello,

what is the value of USART->DR (RDR) is read twice after receiving a byte? E.g.

  1. Byte 0xFF received, RXNE flag set.
  2. DR is read into variable, RXNE is cleared, the variable contains 0xFF
  3. DR is read into variable, the variable contains ?

Does the DR hold the last received value? I could not find answer in the STM32F205 user manual (UM) what is the expected value. The UM does not explicitly forbids to read it during RXNE = 0.

Martin

PS

Of course, I could test it by myself but such test gives me answer only during one particular use case. In case of random value, I can hit the e.g. 0 and make wrong assumption that the DR is cleared.

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
January 12, 2021

You don't need to know the answer, simply don't read DR if RXNE is not set.

JW