Skip to content

Commit

Permalink
STM32: set USB initialization delay to 1µs
Browse files Browse the repository at this point in the history
  • Loading branch information
fwolter committed Dec 30, 2024
1 parent 9e34058 commit 306a781
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions embassy-stm32/src/usb/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,8 @@ impl<'d, T: Instance> Driver<'d, T> {
w.set_fres(true);
});

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

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

0 comments on commit 306a781

Please sign in to comment.