Skip to content

Commit

Permalink
Merge pull request #684 from adafruit/fix-uarte-not-power-down-correctly
Browse files Browse the repository at this point in the history
Fix uarte not power down correctly
  • Loading branch information
hathach committed Aug 18, 2021
2 parents 3dda52f + 5688870 commit f51a7fa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cores/nRF5/Uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f51a7fa

Please sign in to comment.