diff --git a/FreeModbus/port/portserial.c b/FreeModbus/port/portserial.c index 62bf50a..1013980 100644 --- a/FreeModbus/port/portserial.c +++ b/FreeModbus/port/portserial.c @@ -178,6 +178,11 @@ void prvvUARTRxISR(void) void USART1_IRQHandler(void) { rt_interrupt_enter(); + //溢出错误 + if (USART_GetFlagStatus(USART1, USART_FLAG_ORE) == SET) + { + prvvUARTRxISR(); + } //接收中断 if (USART_GetITStatus(USART1, USART_IT_RXNE) == SET) { diff --git a/FreeModbus/port/portserial_m.c b/FreeModbus/port/portserial_m.c index 461228a..863e912 100644 --- a/FreeModbus/port/portserial_m.c +++ b/FreeModbus/port/portserial_m.c @@ -179,6 +179,11 @@ void prvvUARTRxISR(void) void USART2_IRQHandler(void) { rt_interrupt_enter(); + //溢出错误 + if (USART_GetFlagStatus(USART2, USART_FLAG_ORE) == SET) + { + prvvUARTRxISR(); + } //接收中断 if (USART_GetITStatus(USART2, USART_IT_RXNE) == SET) {