23 HAL HCD Generic Driver
23.1 HCD Firmware driver registers structures
23.1.1 HCD_HandleTypeDef
Data Fields
HCD_TypeDef * Instance
HCD_InitTypeDef Init
HCD_HCTypeDef hc
HAL_LockTypeDef Lock
__IO HCD_StateTypeDef State
void * pData
Field Documentation
HCD_TypeDef* HCD_HandleTypeDef::Instance
Register base address
HCD_InitTypeDef HCD_HandleTypeDef::Init
HCD required parameters
HCD_HCTypeDef HCD_HandleTypeDef::hc[15U]
Host channels parameters
HAL_LockTypeDef HCD_HandleTypeDef::Lock
HCD peripheral status
__IO HCD_StateTypeDef HCD_HandleTypeDef::State
HCD communication state
void* HCD_HandleTypeDef::pData
Pointer Stack Handler
23.2 HCD Firmware driver API description
23.2.1 How to use this driver
1. Declare a HCD_HandleTypeDef handle structure, for example: HCD_HandleTypeDef
hhcd;
2. Fill parameters of Init structure in HCD handle
3. Call HAL_HCD_Init() API to initialize the HCD peripheral (Core, Host core, ...)
4. Initialize the HCD low level resources through the HAL_HCD_MspInit() API:
a. Enable the HCD/USB Low Level interface clock using the following macros
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
__HAL_RCC_USB_OTG_HS_CLK_ENABLE(); (For High Speed Mode)
__HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE(); (For High Speed
Mode)
b. Initialize the related GPIO clocks
c. Configure HCD pin-out
d. Configure HCD NVIC interrupt
5. Associate the Upper USB Host stack to the HAL HCD Driver:
a. hhcd.pData = phost;
6. Enable HCD transmission and reception:
a. HAL_HCD_Start();