aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-10-16 03:14:47 +0200
committerDario Nieuwenhuis <[email protected]>2021-10-16 03:14:47 +0200
commit66d70cd146b44a2b3115d306cc9a785d84b45288 (patch)
tree6f1e84cd008de5a70f148312067997beb5740fa6
parent05bc4d198e558a153d78e0fa07228c73023c4b5b (diff)
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.
-rw-r--r--embassy-nrf/src/uarte.rs15
1 files changed, 1 insertions, 14 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index 024a86c91..63bbe5a77 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -187,13 +187,6 @@ impl<'d, T: Instance> Uarte<'d, T> {
187 s.endtx_waker.wake(); 187 s.endtx_waker.wake();
188 r.intenclr.write(|w| w.endtx().clear()); 188 r.intenclr.write(|w| w.endtx().clear());
189 } 189 }
190
191 if r.events_rxto.read().bits() != 0 {
192 r.intenclr.write(|w| w.rxto().clear());
193 }
194 if r.events_txstopped.read().bits() != 0 {
195 r.intenclr.write(|w| w.txstopped().clear());
196 }
197 } 190 }
198} 191}
199 192
@@ -208,15 +201,9 @@ impl<'a, T: Instance> Drop for Uarte<'a, T> {
208 info!("did_stoprx {} did_stoptx {}", did_stoprx, did_stoptx); 201 info!("did_stoprx {} did_stoptx {}", did_stoprx, did_stoptx);
209 202
210 // Wait for rxto or txstopped, if needed. 203 // Wait for rxto or txstopped, if needed.
211 r.intenset.write(|w| w.rxto().set().txstopped().set());
212 while (did_stoprx && r.events_rxto.read().bits() == 0) 204 while (did_stoprx && r.events_rxto.read().bits() == 0)
213 || (did_stoptx && r.events_txstopped.read().bits() == 0) 205 || (did_stoptx && r.events_txstopped.read().bits() == 0)
214 { 206 {}
215 info!("uarte drop: wfe");
216 cortex_m::asm::wfe();
217 }
218
219 cortex_m::asm::sev();
220 207
221 // Finally we can disable! 208 // Finally we can disable!
222 r.enable.write(|w| w.enable().disabled()); 209 r.enable.write(|w| w.enable().disabled());