This information applies to the nRF52840 SoC only.
The USB device (USBD) driver includes two layers: the hardware access layer (HAL) and the driver layer (DRV).
The hardware access layer provides basic APIs for accessing the registers of the USBD peripheral. For details, see the API documentation for the USBD HAL.
The driver provides APIs on a higher level than the HAL. For details, see the API documentation for the USB Device raw IP HAL and driver.
Key features of this driver include:
- Support for a single instance only.
- Architecture that is completely event driven. Most of the library processing is handled in interrupts.
- Sixteen bulk endpoints: eight IN and eight OUT.
- Any endpoint size up to 64 B.
- Two isochronous endpoints: one IN and one OUT.
- Any endpoint size up to 1024 B or up to 512 B when both endpoints are in use.
- Setup packet decoding.
- Setup data packets, bulk, and isochronous transfers use a consistent and similar interface.
- Transfers from the flash memory, realized in software transparently.
- Set and forget functionality for long transfers (not for isochronous endpoints).
The driver can have four different states:
- Uninitialized: the driver cannot be used.
- Initialized:
- The event handler is configured.
- HFCLK is requested.
- All endopints size configured to maximum.
- The peripheral is still disabled.
- Enabled:
- The peripheral itself is enabled.
- Peripheral 48 MHz clock is active.
- Interrupts stay disabled.
- USB pins pull-up is disabled.
- Started:
- Fully functional library.
- Interrupts are enabled.
- USB pins pull-up is enabled.
See the following function documentation for more details about the USBD driver states: