Skip to content

Commit 5b4577b

Browse files
YaochengerCopilot
andcommitted
Update bsp/gd32/arm/libraries/gd32_drivers/drv_usart.c
Co-authored-by: Copilot <[email protected]>
1 parent ce93b89 commit 5b4577b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bsp/gd32/arm/libraries/gd32_drivers/drv_usart.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ static const struct gd32_uart uart_obj[] = {
453453
GPIOA, GPIO_AF_1, GPIO_PIN_14,
454454
GPIOA, GPIO_AF_1, GPIO_PIN_15,
455455
#else
456-
RCU_GPIOA, RCU_GPIOA, // periph clock, tx gpio clock, rt gpio clock
457-
GPIOA, GPIO_PIN_2, // tx port, tx pin
456+
RCU_GPIOA, RCU_GPIOA, /* periph clock, tx gpio clock, rt gpio clock */
457+
GPIOA, GPIO_PIN_2, /* tx port, tx pin */
458458
RCU_GPIOA, RCU_GPIOA, /* periph clock, tx gpio clock, rt gpio clock */
459459
GPIOA, GPIO_PIN_2, /* tx port, tx pin */
460460
GPIOA, GPIO_PIN_3, /* rx port, rx pin */
@@ -555,7 +555,8 @@ static const struct gd32_uart uart_obj[] = {
555555
GPIOC, GPIO_AF_8, GPIO_PIN_7, /* rx port, rx alternate, rx pin */
556556
#elif defined (SOC_SERIES_GD32H7xx)
557557
GPIOC, GPIO_AF_7, GPIO_PIN_6, // tx port, tx alternate, tx pin
558-
GPIOC, GPIO_AF_7, GPIO_PIN_7, // rx port, rx alternate, rx pin
558+
GPIOC, GPIO_AF_7, GPIO_PIN_6, /* tx port, tx alternate, tx pin */
559+
GPIOC, GPIO_AF_7, GPIO_PIN_7, /* rx port, rx alternate, rx pin */
559560
#elif defined SOC_SERIES_GD32E50x
560561
GPIOC, AFIO_PC6_USART5_CFG, GPIO_PIN_6, /* tx port, tx alternate, tx pin */
561562
GPIOC, AFIO_PC7_USART5_CFG, GPIO_PIN_7, /* rx port, rx alternate, rx pin */
@@ -1152,7 +1153,8 @@ static void GD32_UART_IRQHandler(struct rt_serial_device *serial)
11521153
RT_ASSERT(uart != RT_NULL);
11531154

11541155
/* UART in mode Receiver -------------------------------------------------*/
1155-
if ((usart_interrupt_flag_get(uart->uart_periph, USART_INT_FLAG_RBNE) != RESET))
1156+
if ((usart_interrupt_flag_get(uart->uart_periph, USART_INT_FLAG_RBNE) != RESET) &&
1157+
(usart_flag_get(uart->uart_periph, USART_FLAG_RBNE) != RESET))
11561158
{
11571159
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
11581160
/* Clear RXNE interrupt flag */

0 commit comments

Comments
 (0)