Skip to content

Commit 6f31229

Browse files
r-vlaar0xc0170
authored andcommitted
Workaround to reset UARTE peripheral to be able to go into deep sleep
1 parent 764cdcf commit 6f31229

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/serial_api.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,21 @@ void serial_free(serial_t *obj)
10091009
if (nordic_nrf5_uart_state[instance].usage_counter == 0) {
10101010

10111011
nrf_uarte_disable(nordic_nrf5_uart_register[instance]);
1012+
1013+
/* Turn NRF_UARTE0_BASE or NRF_UARTE1_BASE power off and on to reset peripheral. */
1014+
if (instance == 0) {
1015+
*(volatile uint32_t *)0x40002FFC = 0;
1016+
*(volatile uint32_t *)0x40002FFC;
1017+
*(volatile uint32_t *)0x40002FFC = 1;
1018+
}
1019+
#if UART1_ENABLED
1020+
else {
1021+
*(volatile uint32_t *)0x40028FFC = 0;
1022+
*(volatile uint32_t *)0x40028FFC;
1023+
*(volatile uint32_t *)0x40028FFC = 1;
1024+
}
1025+
#endif
1026+
10121027
}
10131028
}
10141029
}

0 commit comments

Comments
 (0)