From 82846d164c3dcb70a493f0f8dc2fb73c25c1fe4e Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 20 Feb 2021 01:29:26 +0100 Subject: [PATCH] stm32f4-examples: add workaround for WFI breaking RTT --- embassy-stm32f4-examples/src/bin/exti.rs | 7 +++++++ embassy-stm32f4-examples/src/bin/hello.rs | 8 ++++++++ embassy-stm32f4-examples/src/bin/serial.rs | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/embassy-stm32f4-examples/src/bin/exti.rs b/embassy-stm32f4-examples/src/bin/exti.rs index 79348777..d8de3381 100644 --- a/embassy-stm32f4-examples/src/bin/exti.rs +++ b/embassy-stm32f4-examples/src/bin/exti.rs @@ -44,6 +44,13 @@ fn main() -> ! { let dp = stm32::Peripherals::take().unwrap(); let cp = cortex_m::peripheral::Peripherals::take().unwrap(); + dp.DBGMCU.cr.modify(|_, w| { + w.dbg_sleep().set_bit(); + w.dbg_standby().set_bit(); + w.dbg_stop().set_bit() + }); + dp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); + let executor = EXECUTOR.put(Executor::new()); executor.run(|spawner| { unwrap!(spawner.spawn(run(dp, cp))); diff --git a/embassy-stm32f4-examples/src/bin/hello.rs b/embassy-stm32f4-examples/src/bin/hello.rs index d6237871..77c54464 100644 --- a/embassy-stm32f4-examples/src/bin/hello.rs +++ b/embassy-stm32f4-examples/src/bin/hello.rs @@ -15,6 +15,14 @@ fn main() -> ! { info!("Hello World!"); let p = stm32f4xx_hal::stm32::Peripherals::take().unwrap(); + + p.DBGMCU.cr.modify(|_, w| { + w.dbg_sleep().set_bit(); + w.dbg_standby().set_bit(); + w.dbg_stop().set_bit() + }); + p.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); + let gpioa = p.GPIOA.split(); let gpioc = p.GPIOC.split(); diff --git a/embassy-stm32f4-examples/src/bin/serial.rs b/embassy-stm32f4-examples/src/bin/serial.rs index f8e7f7f4..2cd1c8c3 100644 --- a/embassy-stm32f4-examples/src/bin/serial.rs +++ b/embassy-stm32f4-examples/src/bin/serial.rs @@ -20,6 +20,13 @@ use stm32f4xx_hal::stm32; #[task] async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) { + dp.DBGMCU.cr.modify(|_, w| { + w.dbg_sleep().set_bit(); + w.dbg_standby().set_bit(); + w.dbg_stop().set_bit() + }); + dp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled()); + // https://gist.github.com/thalesfragoso/a07340c5df6eee3b04c42fdc69ecdcb1 let gpioa = dp.GPIOA.split(); let rcc = dp.RCC.constrain();