From 4b0839bd7b394224902e58079343ff87a622c2c9 Mon Sep 17 00:00:00 2001 From: guochuangjian <465469791@qq.com> Date: Wed, 1 Aug 2018 00:35:42 +0800 Subject: [PATCH 1/3] update uart isr ore-flag handle error bug. --- bsp/stm32f10x/drivers/usart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/stm32f10x/drivers/usart.c b/bsp/stm32f10x/drivers/usart.c index 898a0135c8..65a05c3afe 100644 --- a/bsp/stm32f10x/drivers/usart.c +++ b/bsp/stm32f10x/drivers/usart.c @@ -270,7 +270,7 @@ static void uart_isr(struct rt_serial_device *serial) { } if (USART_GetFlagStatus(uart->uart_device, USART_FLAG_ORE) == SET) { - stm32_getc(serial); + USART_ReceiveData(uart->uart_device); } } From 650f06aa1943d439ac049f6bc276b216999e6a56 Mon Sep 17 00:00:00 2001 From: guochuangjian <465469791@qq.com> Date: Wed, 1 Aug 2018 00:40:58 +0800 Subject: [PATCH 2/3] fix usRcvBufferPos == MB_SER_PDU_SIZE_MAX assert --- components/net/freemodbus/modbus/rtu/mbrtu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/net/freemodbus/modbus/rtu/mbrtu.c b/components/net/freemodbus/modbus/rtu/mbrtu.c index c023c92654..ae5e0325c1 100644 --- a/components/net/freemodbus/modbus/rtu/mbrtu.c +++ b/components/net/freemodbus/modbus/rtu/mbrtu.c @@ -153,7 +153,7 @@ eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ) eMBErrorCode eStatus = MB_ENOERR; ENTER_CRITICAL_SECTION( ); - assert_param( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ); + assert_param( usRcvBufferPos <= MB_SER_PDU_SIZE_MAX ); /* Length and CRC check */ if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN ) From 63a13906cc0673b2bc42ca5641d523c9be5e4887 Mon Sep 17 00:00:00 2001 From: guochuangjian <465469791@qq.com> Date: Sun, 5 Aug 2018 15:25:31 +0800 Subject: [PATCH 3/3] fix uart ore-flag clear bug --- bsp/stm32f107/drivers/usart.c | 4 ++-- bsp/stm32f40x/drivers/usart.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bsp/stm32f107/drivers/usart.c b/bsp/stm32f107/drivers/usart.c index 6380f03bdf..89528d54bc 100644 --- a/bsp/stm32f107/drivers/usart.c +++ b/bsp/stm32f107/drivers/usart.c @@ -184,7 +184,7 @@ void USART1_IRQHandler(void) } if (USART_GetFlagStatus(uart->uart_device, USART_FLAG_ORE) == SET) { - stm32_getc(&serial1); + USART_ReceiveData(uart->uart_device); } /* leave interrupt */ rt_interrupt_leave(); @@ -221,7 +221,7 @@ void USART2_IRQHandler(void) } if (USART_GetFlagStatus(uart->uart_device, USART_FLAG_ORE) == SET) { - stm32_getc(&serial2); + USART_ReceiveData(uart->uart_device); } /* leave interrupt */ diff --git a/bsp/stm32f40x/drivers/usart.c b/bsp/stm32f40x/drivers/usart.c index 0838d214e2..03d8c23235 100644 --- a/bsp/stm32f40x/drivers/usart.c +++ b/bsp/stm32f40x/drivers/usart.c @@ -310,7 +310,7 @@ static void uart_isr(struct rt_serial_device *serial) } if (USART_GetFlagStatus(uart->uart_device, USART_FLAG_ORE) == SET) { - stm32_getc(serial); + USART_ReceiveData(uart->uart_device); } }