Merge pull request #3700 from fwolter/usb-delay

STM32: set USB initialization delay to 1µs
This commit is contained in:
Dario Nieuwenhuis 2024-12-31 11:34:14 +01:00 committed by GitHub
commit 667dfa34b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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));