japaric / stm32f103xx-hal

HAL for the STM32F103xx family of microcontrollers
Apache License 2.0
116 stars 40 forks source link

Impossible to clear USART error states #67

Closed inazarenko closed 6 years ago

inazarenko commented 6 years ago

USART receiver error bits parity/framing/overrun/noise are supposed to be cleared by reading USART_DR register after detecting the error. Currently, the code returns before reading DR, so the error bits are never cleared; after a single overrun, the USART will forever refuse to read data.

See:

https://github.com/japaric/stm32f103xx-hal/blob/897596f396441859003733a24d85ac7d2f4afce0/src/serial.rs#L181

The procedure for clearing error bits is on page 820 of the reference for STM32F103xx.

inazarenko commented 6 years ago

Duplicate of @ #62, and I see there's already a pull request to fix.