HAL HCD Generic Driver
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.
b.
c.
d.
5.
Associate the Upper USB Host stack to the HAL HCD Driver:
a.
6.
Enable HCD transmission and reception:
a.
280/1371
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)
Initialize the related GPIO clocks
Configure HCD pin-out
Configure HCD NVIC interrupt
hhcd.pData = phost;
HAL_HCD_Start();
DocID028236 Rev 2
UM1940
Need help?
Do you have a question about the STM32F2 and is the answer not in the manual?
Questions and answers