summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2026-05-08 21:59:40 +0700
committerGitHub <[email protected]>2026-05-08 21:59:40 +0700
commitde112b06a19cebe6e89d8a502dbe43346163d483 (patch)
tree23b6aeec8fd278d472b0ca3f690b8aca81db1817
parentd21fdd98f34241f52a01832e3c4133cd03a94d0a (diff)
parent6af4ee2c50da68a9bca276b69fccbacf96e2b3ce (diff)
Merge pull request #3633 from hathach/fix/nrf5x-hfclk-wait-post-sd
nrf5x: request HFCLK in USB_EVT_READY to fix post-SoftDevice deadlock
-rw-r--r--src/portable/nordic/nrf5x/dcd_nrf5x.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index 6ed5fde8e..befbaa338 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -1049,6 +1049,12 @@ void tusb_hal_nrf_power_event(uint32_t event) {
NVIC_EnableIRQ(USBD_IRQn);
}
+ // Ensure HFCLK is requested in the current context. The hfclk_enable() in
+ // USB_EVT_DETECTED may have been pre-SoftDevice. After Softdevice is
+ // enabled, HFXO is physically off again. So any caller that fires
+ // USB_EVT_READY post-SD would hang here.
+ hfclk_enable();
+
// Wait for HFCLK
while (!hfclk_running()) {}