From 0c0026029f8c0acec6802f3aaed63e09d78efd7b Mon Sep 17 00:00:00 2001 From: ChristofR Date: Thu, 7 Jun 2018 15:51:57 +0200 Subject: [PATCH] Bug Fix: UART IRQ Freezing It was found that receiving UART data too rapidly would completely brick the UART peripheral (no further UART IRQs would be generated). To brick the peripheral all of the following needs to be true. 1. A BLE connection is active 2. Serial speed is set fast enough (>= 115,200) 3. A continuous stream of Serial data needs to be received Since interrupt timing is no longer guaranteed when the SoftDevice has an active BLE connection it is much more likely for UART data to be received when inside the UART IRQ. Clearing nrfUart->EVENTS_RXDRDY at the end of the IRQ increases the likelyhood of the system setting a pending IRQ before the current IRQ loop has cleared nrfUart->EVENTS_RXDRDY. If this occurs then the UART IRQ will be called again, but nrfUart->EVENTS_RXDRDY will be 0. Since nrfUart->RXD is no longer being cleared overruns start occuring and for some unknown reason the UART IRQ stops trigerring. --- cores/nRF5/Uart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/nRF5/Uart.cpp b/cores/nRF5/Uart.cpp index 3801f50c..7d2cd4f4 100644 --- a/cores/nRF5/Uart.cpp +++ b/cores/nRF5/Uart.cpp @@ -193,7 +193,7 @@ void Uart::IrqHandler() { if (nrfUart->EVENTS_RXDRDY) { - nrfUart->EVENTS_RXDRDY = 0x0UL; + nrfUart->EVENTS_RXDRDY = 0x0UL; rxBuffer.store_char(nrfUart->RXD); }