From da33b3a4d2fbb188c1c867e9092e7fec10b3a88e Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 20 Jul 2021 09:43:06 +0200 Subject: [PATCH] rp/spi: disable+enable when setting frequency --- embassy-rp/src/spi.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/embassy-rp/src/spi.rs b/embassy-rp/src/spi.rs index 19c9d07c0..959ad9b0f 100644 --- a/embassy-rp/src/spi.rs +++ b/embassy-rp/src/spi.rs @@ -142,10 +142,17 @@ impl<'d, T: Instance> Spi<'d, T> { let (presc, postdiv) = calc_prescs(freq); let p = self.inner.regs(); unsafe { + // disable + p.cr1().write(|w| w.set_sse(false)); + + // change stuff p.cpsr().write(|w| w.set_cpsdvsr(presc)); p.cr0().modify(|w| { w.set_scr(postdiv); }); + + // enable + p.cr1().write(|w| w.set_sse(true)); } } }