stm32f4-examples: add workaround for WFI breaking RTT
This commit is contained in:
parent
3b3b1ba346
commit
82846d164c
3 changed files with 22 additions and 0 deletions
|
@ -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)));
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue