drivers: nrf: uarte: check if RXSTARTED before issue STOPRX
Only issue STOPRX is RX has started. This prevents getting stuck in while loop. Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
This commit is contained in:
parent
5776c82c85
commit
6243557e5f
1 changed files with 8 additions and 4 deletions
|
@ -1403,11 +1403,15 @@ static void uarte_nrfx_set_power_state(struct device *dev, u32_t new_state)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
if (nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) {
|
||||
nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX);
|
||||
while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXTO)) {
|
||||
while (!nrf_uarte_event_check(uarte,
|
||||
NRF_UARTE_EVENT_RXTO)) {
|
||||
/* Busy wait for event to register */
|
||||
}
|
||||
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED);
|
||||
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXTO);
|
||||
}
|
||||
nrf_uarte_disable(uarte);
|
||||
uarte_nrfx_pins_enable(dev, false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue