Skip to content

Commit 3a5f8cf

Browse files
committed
Wait for TX completed in usart_disable()
1 parent 51d2d9e commit 3a5f8cf

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • STM32F1/cores/maple/libmaple

STM32F1/cores/maple/libmaple/usart.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ void usart_disable(usart_dev *dev) {
7070
/* FIXME this misbehaves (on F1) if you try to use PWM on TX afterwards */
7171
usart_reg_map *regs = dev->regs;
7272

73+
while(!rb_is_empty(dev->wb))
74+
; // wait for TX completed
7375
/* TC bit must be high before disabling the USART */
7476
while((regs->CR1 & USART_CR1_UE) && !(regs->SR & USART_SR_TC))
7577
;

0 commit comments

Comments
 (0)