Skip to content

Commit f51a7fa

Browse files
authored
Merge pull request #684 from adafruit/fix-uarte-not-power-down-correctly
Fix uarte not power down correctly
2 parents 3dda52f + 5688870 commit f51a7fa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cores/nRF5/Uart.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,17 @@ void Uart::end()
156156

157157
nrfUart->INTENCLR = UARTE_INTENSET_ENDRX_Msk | UARTE_INTENSET_ENDTX_Msk;
158158

159+
nrfUart->EVENTS_RXTO = 0;
160+
nrfUart->EVENTS_TXSTOPPED = 0;
161+
159162
nrfUart->TASKS_STOPRX = 0x1UL;
160163
nrfUart->TASKS_STOPTX = 0x1UL;
161164

165+
// Wait for TXSTOPPED event and for RXTO event
166+
// This is required before disabling UART to fully power down transceiver PHY.
167+
// Otherwise transceiver will continue to consume ~900uA
168+
while ( !(nrfUart->EVENTS_TXSTOPPED && nrfUart->EVENTS_RXTO) ) yield();
169+
162170
nrfUart->ENABLE = UARTE_ENABLE_ENABLE_Disabled;
163171

164172
nrfUart->PSEL.TXD = 0xFFFFFFFF;

0 commit comments

Comments
 (0)