Merge pull request #11790 from 0xc0170/master-rob

nrf52: reset UARTE peripheral in serial_free
pull/11871/head
Martin Kojtal 2019-11-14 10:42:08 +01:00 committed by GitHub
commit 699372421a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -1009,6 +1009,21 @@ void serial_free(serial_t *obj)
if (nordic_nrf5_uart_state[instance].usage_counter == 0) {
nrf_uarte_disable(nordic_nrf5_uart_register[instance]);
/* Turn NRF_UARTE0_BASE or NRF_UARTE1_BASE power off and on to reset peripheral. */
if (instance == 0) {
*(volatile uint32_t *)0x40002FFC = 0;
*(volatile uint32_t *)0x40002FFC;
*(volatile uint32_t *)0x40002FFC = 1;
}
#if UART1_ENABLED
else {
*(volatile uint32_t *)0x40028FFC = 0;
*(volatile uint32_t *)0x40028FFC;
*(volatile uint32_t *)0x40028FFC = 1;
}
#endif
}
}
}