Skip to content

Commit 306a781

Browse files
committed
STM32: set USB initialization delay to 1µs
1 parent 9e34058 commit 306a781

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

embassy-stm32/src/usb/usb.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,8 @@ impl<'d, T: Instance> Driver<'d, T> {
305305
w.set_fres(true);
306306
});
307307

308-
#[cfg(feature = "time")]
309-
embassy_time::block_for(embassy_time::Duration::from_millis(100));
310-
#[cfg(not(feature = "time"))]
311-
cortex_m::asm::delay(unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 / 10);
308+
// wait t_STARTUP = 1us
309+
cortex_m::asm::delay(unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 / 1_000_000);
312310

313311
#[cfg(not(usb_v4))]
314312
regs.btable().write(|w| w.set_btable(0));

0 commit comments

Comments
 (0)