From 66d70cd146b44a2b3115d306cc9a785d84b45288 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 16 Oct 2021 03:14:47 +0200 Subject: [PATCH] nrf/uarte: do not use WFE on drop. - It disturbs other stuff that uses WFE/SEV in the system. I ran into issues with this. - It needs the irq handler to check for RXTO/TXSTOPPED errors, which makes it slower. --- embassy-nrf/src/uarte.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 024a86c9..63bbe5a7 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs @@ -187,13 +187,6 @@ impl<'d, T: Instance> Uarte<'d, T> { s.endtx_waker.wake(); r.intenclr.write(|w| w.endtx().clear()); } - - if r.events_rxto.read().bits() != 0 { - r.intenclr.write(|w| w.rxto().clear()); - } - if r.events_txstopped.read().bits() != 0 { - r.intenclr.write(|w| w.txstopped().clear()); - } } } @@ -208,15 +201,9 @@ impl<'a, T: Instance> Drop for Uarte<'a, T> { info!("did_stoprx {} did_stoptx {}", did_stoprx, did_stoptx); // Wait for rxto or txstopped, if needed. - r.intenset.write(|w| w.rxto().set().txstopped().set()); while (did_stoprx && r.events_rxto.read().bits() == 0) || (did_stoptx && r.events_txstopped.read().bits() == 0) - { - info!("uarte drop: wfe"); - cortex_m::asm::wfe(); - } - - cortex_m::asm::sev(); + {} // Finally we can disable! r.enable.write(|w| w.enable().disabled());