From 45e322b9a332c41930d3a781830805ecd27e1682 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 22 Aug 2016 09:57:52 +1200 Subject: [PATCH] Handle usart errors. --- src/platforms/stm32/usbuart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platforms/stm32/usbuart.c b/src/platforms/stm32/usbuart.c index 7db5ea1..17d02c1 100644 --- a/src/platforms/stm32/usbuart.c +++ b/src/platforms/stm32/usbuart.c @@ -247,7 +247,10 @@ void usbuart_usb_in_cb(usbd_device *dev, uint8_t ep) */ void USBUSART_ISR(void) { + uint32_t err = USART_SR(USBUSART); char c = usart_recv(USBUSART); + if (err & (USART_SR_ORE | USART_SR_FE)) + return; /* Turn on LED */ gpio_set(LED_PORT_UART, LED_UART);