We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
force_reset
1 parent 6ede424 commit dbe0b5aCopy full SHA for dbe0b5a
nrf-hal-common/src/usbd/mod.rs
@@ -707,7 +707,13 @@ impl UsbBus for Usbd<'_> {
707
interrupt::free(|cs| {
708
let regs = self.periph.borrow(cs);
709
regs.usbpullup.write(|w| w.connect().disabled());
710
- // TODO delay needed?
+
711
+ // FIXME: it is unclear how much of a delay is needed here, so we use a conservative 1ms
712
+ // Note that this is very bad for latency-sensitive apps since it happens in a critical
713
+ // section. `force_reset` should be avoided if that is an issue.
714
+ // We run at 64 MHz, so 64k cycles are 1ms.
715
+ cortex_m::asm::delay(64_000);
716
717
regs.usbpullup.write(|w| w.connect().enabled());
718
});
719
0 commit comments