HAL USB PCD Overview ¶
Introducing USB PCD ¶
- group PCD_Introduction
-
USB Peripheral Controller Driver (PCD) hardware abstraction layer provides all required APIs to interface with the USB instance in device mode. It simplifies the initialization, configuration, and management of the USB depending on the user’s required device function.
This abstraction layer ensures portability and ease of use across different STM32 series. The PCD HAL abstracts different USB hardware instances that can be (depending on the STM32 MCU): USB OTG FS (On-The-GO Full Speed) USB OTG HS (On-The-GO High Speed) USB DRD FS (Dual Role Device Full Speed)
Module and files ¶
The following diagram illustrates the HAL USB PCD module and its associated files.
Component diagram ¶
The following diagram illustrates the software components involved in the HAL USB PCD module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.
Configuration table ¶
The following table lists the configuration defines for the HAL USB PCD module, specifying their locations, default values, and descriptions:
- group PCD_Configuration_Table
-
¶
Configuration inside the USB PCD driver: ¶
Config defines
Description
Default value
Note
USE_ASSERT_DBG_PARAM
from IDE
NA
Enable the parameter assert.
USE_ASSERT_DBG_STATE
from IDE
NA
Enable the state assert.
USE_HAL_PCD_MODULE
from hal_conf.h
1
Enable the HAL USB PCD module.
USE_HAL_PCD_REGISTER_CALLBACKS
from hal_conf.h
0
Enable the register callbacks.
USE_HAL_PCD_USB_EP_TYPE_ISOC
from hal_conf.h
1
Enable support for isochronous endpoints.
USE_HAL_PCD_USB_BCD
from hal_conf.h
0
Enable USB Battery Charging Detection support.
USE_HAL_PCD_USB_LPM
from hal_conf.h
0
Enable USB Link Power Management support.
USE_HAL_PCD_USB_DOUBLE_BUFFER
from hal_conf.h
1
Enable double-buffering for USB transfers.
USE_HAL_PCD_MAX_ENDPOINT_NB
from hal_conf.h
8
Maximum number of USB PCD endpoints.
USE_HAL_PCD_USER_DATA
from hal_conf.h
0
Add user data to the HAL USB PCD handle.
USE_HAL_PCD_GET_LAST_ERRORS
from hal_conf.h
0
Add an error value to the HAL USB PCD handle.
USE_HAL_CHECK_PARAM
from hal_conf.h
0
Enable checking of PCD API parameters at runtime.