Add debugger asm::wfi workaround
@@ -16,6 +16,17 @@ fn main() -> ! {
let dp = pac::Peripherals::take().unwrap();
let mut flash = dp.FLASH.constrain();
+
+ // This is a workaround, so that the debugger will not disconnect
+ // imidiatly on asm::wfi();
+ // https://github.com/probe-rs/probe-rs/issues/350#issuecomment-740550519
+ dp.DBGMCU.cr.modify(|_, w| {
+ w.dbg_sleep().set_bit();
+ w.dbg_standby().set_bit();
+ w.dbg_stop().set_bit()
+ });
+ dp.RCC.ahbenr.modify(|_, w| w.dma1en().enabled());
+
let mut rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.freeze(&mut flash.acr);
