Skip to content

Commit de112b0

Browse files
authored
Merge pull request #3633 from hathach/fix/nrf5x-hfclk-wait-post-sd
nrf5x: request HFCLK in USB_EVT_READY to fix post-SoftDevice deadlock
2 parents d21fdd9 + 6af4ee2 commit de112b0

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/portable/nordic/nrf5x/dcd_nrf5x.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,12 @@ void tusb_hal_nrf_power_event(uint32_t event) {
10491049
NVIC_EnableIRQ(USBD_IRQn);
10501050
}
10511051

1052+
// Ensure HFCLK is requested in the current context. The hfclk_enable() in
1053+
// USB_EVT_DETECTED may have been pre-SoftDevice. After Softdevice is
1054+
// enabled, HFXO is physically off again. So any caller that fires
1055+
// USB_EVT_READY post-SD would hang here.
1056+
hfclk_enable();
1057+
10521058
// Wait for HFCLK
10531059
while (!hfclk_running()) {}
10541060

0 commit comments

Comments
 (0)