Skip to content

Commit 3cc3d4f

Browse files
dgoodladCryowatt
authored andcommitted
Delay by 25600 cycles after selecting USB PHY
1 parent 01cbc77 commit 3cc3d4f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bus.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,13 @@ impl<USB: UsbPeripheral> usb_device::bus::UsbBus for UsbBus<USB> {
431431
}
432432
}
433433

434+
// Delay a few cycles after selecting PHY before doing a core reset
435+
// https://community.st.com/s/question/0D53W00000znL7jSAE/stm32h745-usbotg-intermittently-fails-to-respond-to-core-reset
436+
#[cfg(not(feature = "cortex-m"))]
437+
for _ in 0..500000 {};
438+
#[cfg(feature = "cortex-m")]
439+
cortex_m::asm::delay(25600);
440+
434441
// Perform core soft-reset
435442
while read_reg!(otg_global, regs.global(), GRSTCTL, AHBIDL) == 0 {}
436443
modify_reg!(otg_global, regs.global(), GRSTCTL, CSRST: 1);

0 commit comments

Comments
 (0)