diff --git a/cores/nRF5/Uart.cpp b/cores/nRF5/Uart.cpp index ac952f5b..9b598219 100644 --- a/cores/nRF5/Uart.cpp +++ b/cores/nRF5/Uart.cpp @@ -156,9 +156,17 @@ void Uart::end() nrfUart->INTENCLR = UARTE_INTENSET_ENDRX_Msk | UARTE_INTENSET_ENDTX_Msk; + nrfUart->EVENTS_RXTO = 0; + nrfUart->EVENTS_TXSTOPPED = 0; + nrfUart->TASKS_STOPRX = 0x1UL; nrfUart->TASKS_STOPTX = 0x1UL; + // Wait for TXSTOPPED event and for RXTO event + // This is required before disabling UART to fully power down transceiver PHY. + // Otherwise transceiver will continue to consume ~900uA + while ( !(nrfUart->EVENTS_TXSTOPPED && nrfUart->EVENTS_RXTO) ) yield(); + nrfUart->ENABLE = UARTE_ENABLE_ENABLE_Disabled; nrfUart->PSEL.TXD = 0xFFFFFFFF;