[187] USBD: USB cannot be enabled

This anomaly applies to IC Rev. Rev 1, build codes QIAA-Cx0, CKAA-Cx0.

It was inherited from the previous IC revision Engineering C nRF52840.

Symptoms

After writing to NRF_USBD->ENABLE, no EVENTS_USBEVENT is triggered, and USB->EVENTCAUSE is not updated.

Conditions

Most recent reset type is soft reset or CPU lockup reset, or after a new firmware update to flash.

Consequences

USB is not working.

Workaround

Implement code similar to the following around the USB enabling:

*(volatile uint32_t *)0x4006EC00 = 0x00009375;
*(volatile uint32_t *)0x4006ED14 = 0x00000003;
*(volatile uint32_t *)0x4006EC00 = 0x00009375;

/* Enable the peripheral */
NRF_USBD->ENABLE = USBD_ENABLE_ENABLE_Enabled<< USBD_ENABLE_ENABLE_Pos;

/* Waiting for peripheral to enable, this should take a few ┬Ás */
while (0 == (NRF_USBD->EVENTCAUSE & USBD_EVENTCAUSE_READY_Msk))
{
    /* Empty loop */
}
NRF_USBD->EVENTCAUSE &= ~USBD_EVENTCAUSE_READY_Msk;

*(volatile uint32_t *)0x4006EC00 = 0x00009375;
*(volatile uint32_t *)0x4006ED14 = 0x00000000;
*(volatile uint32_t *)0x4006EC00 = 0x00009375;
nRF5 SDK version 15 will include this workaround.