Skip to content

Commit 71930b0

Browse files
committed
[BSP] Fix the interrupt issue in USART driver of STM32F4.
1 parent 950c3a4 commit 71930b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bsp/stm32f40x/drivers/usart.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
8989

9090
/* Enable USART */
9191
USART_Cmd(uart->uart_device, ENABLE);
92-
/* enable interrupt */
93-
USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
9492

9593
return RT_EOK;
9694
}
@@ -107,10 +105,14 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar
107105
case RT_DEVICE_CTRL_CLR_INT:
108106
/* disable rx irq */
109107
UART_DISABLE_IRQ(uart->irq);
108+
/* disable interrupt */
109+
USART_ITConfig(uart->uart_device, USART_IT_RXNE, DISABLE);
110110
break;
111111
case RT_DEVICE_CTRL_SET_INT:
112112
/* enable rx irq */
113113
UART_ENABLE_IRQ(uart->irq);
114+
/* enable interrupt */
115+
USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
114116
break;
115117
}
116118

0 commit comments

Comments
 (0)