The physical layer interface (PHY) of the USB transceiver
has its own power-supply pin VBUS, which affects USBD power-up
sequence.
The nRF5340 device is not able to properly signal its presence to the USB host and handle traffic from
the USB host, unless the PHY power supply is enabled and stable. Turning the PHY power supply
on or off is directly linked to register ENABLE. nRF5340
provides events that help synchronizing software to the various steps during the power-up
sequence.
To make sure that all resources in USBD are available and the dedicated USB voltage regulator
stabilized, the following is recommended:
Enable USBD only after VBUS has been detected
Turn the USB pull-up on after the following events have occurred:
USBPWRRDY
USBEVENT, with the READY condition flagged in EVENTCAUSE
The following sequence chart illustrates a typical handling of VBUS power-up.
Figure 3. VBUS power-up sequence
Upon detecting VBUS removal, it is recommended to wait for ongoing EasyDMA transfers to finish
before disabling USBD (relevant ENDEPIN[n], ENDISOIN, ENDEPOUT[n], or ENDISOOUT events,
see EasyDMA). The USBREMOVED event,
described in USBREG — USB regulator control, signals when the VBUS is removed.
Reading the ENABLE register will return Enabled until USBD is completely disabled.