aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-02-20 01:29:26 +0100
committerDario Nieuwenhuis <[email protected]>2021-02-20 01:29:26 +0100
commit82846d164c3dcb70a493f0f8dc2fb73c25c1fe4e (patch)
tree161afc3dea0745eb421384911b87e258518b4263
parent3b3b1ba346a2841c71500ababd58210db55703e7 (diff)
stm32f4-examples: add workaround for WFI breaking RTT
-rw-r--r--embassy-stm32f4-examples/src/bin/exti.rs7
-rw-r--r--embassy-stm32f4-examples/src/bin/hello.rs8
-rw-r--r--embassy-stm32f4-examples/src/bin/serial.rs7
3 files changed, 22 insertions, 0 deletions
diff --git a/embassy-stm32f4-examples/src/bin/exti.rs b/embassy-stm32f4-examples/src/bin/exti.rs
index 79348777d..d8de33816 100644
--- a/embassy-stm32f4-examples/src/bin/exti.rs
+++ b/embassy-stm32f4-examples/src/bin/exti.rs
@@ -44,6 +44,13 @@ fn main() -> ! {
44 let dp = stm32::Peripherals::take().unwrap(); 44 let dp = stm32::Peripherals::take().unwrap();
45 let cp = cortex_m::peripheral::Peripherals::take().unwrap(); 45 let cp = cortex_m::peripheral::Peripherals::take().unwrap();
46 46
47 dp.DBGMCU.cr.modify(|_, w| {
48 w.dbg_sleep().set_bit();
49 w.dbg_standby().set_bit();
50 w.dbg_stop().set_bit()
51 });
52 dp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled());
53
47 let executor = EXECUTOR.put(Executor::new()); 54 let executor = EXECUTOR.put(Executor::new());
48 executor.run(|spawner| { 55 executor.run(|spawner| {
49 unwrap!(spawner.spawn(run(dp, cp))); 56 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 d62378712..77c544643 100644
--- a/embassy-stm32f4-examples/src/bin/hello.rs
+++ b/embassy-stm32f4-examples/src/bin/hello.rs
@@ -15,6 +15,14 @@ fn main() -> ! {
15 info!("Hello World!"); 15 info!("Hello World!");
16 16
17 let p = stm32f4xx_hal::stm32::Peripherals::take().unwrap(); 17 let p = stm32f4xx_hal::stm32::Peripherals::take().unwrap();
18
19 p.DBGMCU.cr.modify(|_, w| {
20 w.dbg_sleep().set_bit();
21 w.dbg_standby().set_bit();
22 w.dbg_stop().set_bit()
23 });
24 p.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled());
25
18 let gpioa = p.GPIOA.split(); 26 let gpioa = p.GPIOA.split();
19 let gpioc = p.GPIOC.split(); 27 let gpioc = p.GPIOC.split();
20 28
diff --git a/embassy-stm32f4-examples/src/bin/serial.rs b/embassy-stm32f4-examples/src/bin/serial.rs
index f8e7f7f48..2cd1c8c35 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;
20 20
21#[task] 21#[task]
22async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) { 22async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) {
23 dp.DBGMCU.cr.modify(|_, w| {
24 w.dbg_sleep().set_bit();
25 w.dbg_standby().set_bit();
26 w.dbg_stop().set_bit()
27 });
28 dp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled());
29
23 // https://gist.github.com/thalesfragoso/a07340c5df6eee3b04c42fdc69ecdcb1 30 // https://gist.github.com/thalesfragoso/a07340c5df6eee3b04c42fdc69ecdcb1
24 let gpioa = dp.GPIOA.split(); 31 let gpioa = dp.GPIOA.split();
25 let rcc = dp.RCC.constrain(); 32 let rcc = dp.RCC.constrain();