summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-12-27 20:18:07 -0800
committerScott Shawcroft <scott@tannewt.org>2019-12-27 20:18:07 -0800
commitcfd71d90234c5a2ec757f905b969637d0bcab226 (patch)
treef8093bfeb943d4453a627daa5d71357ebc4f1638
parent7387f60920c17c3bf920ef66e240ac6f65991819 (diff)
Fix nRF UART reset
disable only turns off ENABLE but doesn't set the init tracking that nrfx uses. uninit hangs if ENABLE is off and is called because it waits forever for TX to stop.
-rw-r--r--ports/nrf/common-hal/busio/UART.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c
index 0579db414..d79b65ff8 100644
--- a/ports/nrf/common-hal/busio/UART.c
+++ b/ports/nrf/common-hal/busio/UART.c
@@ -124,7 +124,7 @@ static void uart_callback_irq (const nrfx_uarte_event_t * event, void * context)
void uart_reset(void) {
for (size_t i = 0 ; i < MP_ARRAY_SIZE(nrfx_uartes); i++) {
- nrf_uarte_disable(nrfx_uartes[i].p_reg);
+ nrfx_uarte_uninit(&nrfx_uartes[i]);
}
}
@@ -171,7 +171,6 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
}
};
- nrfx_uarte_uninit(self->uarte);
_VERIFY_ERR(nrfx_uarte_init(self->uarte, &config, uart_callback_irq));
// Init buffer for rx