drivers: nrf: avoid UARTE pm infinite loop
If there is a UARTE receive error (e.g. framing or break), the RXTO event may never come. Check error event too, to avoid an infinite loop. Signed-off-by: Jim Paris <jim@jim.sh>
This commit is contained in:
parent
2368aeae61
commit
e729e6db10
1 changed files with 5 additions and 2 deletions
|
@ -642,7 +642,8 @@ static int uarte_nrfx_init(const struct device *dev)
|
|||
*/
|
||||
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) &&
|
||||
!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ERROR)) {
|
||||
/* Busy wait for event to register */
|
||||
}
|
||||
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED);
|
||||
|
@ -1845,7 +1846,9 @@ static void uarte_nrfx_set_power_state(const struct device *dev,
|
|||
#endif
|
||||
nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX);
|
||||
while (!nrf_uarte_event_check(uarte,
|
||||
NRF_UARTE_EVENT_RXTO)) {
|
||||
NRF_UARTE_EVENT_RXTO) &&
|
||||
!nrf_uarte_event_check(uarte,
|
||||
NRF_UARTE_EVENT_ERROR)) {
|
||||
/* Busy wait for event to register */
|
||||
}
|
||||
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue