!224 修改 stm32 驱动库 usbh 初始化错误

Merge pull request !224 from THEWON/usbh_init
This commit is contained in:
bernard 2021-06-17 00:50:36 +00:00 committed by Gitee
commit 03837384ea
1 changed files with 7 additions and 1 deletions

View File

@ -197,6 +197,8 @@ static struct uhcd_ops _uhcd_ops =
static rt_err_t stm32_hcd_init(rt_device_t device)
{
HAL_StatusTypeDef state;
HCD_HandleTypeDef *hhcd = (HCD_HandleTypeDef *)device->user_data;
hhcd->Instance = USB_OTG_FS;
hhcd->Init.Host_channels = 8;
@ -204,7 +206,11 @@ static rt_err_t stm32_hcd_init(rt_device_t device)
hhcd->Init.dma_enable = DISABLE;
hhcd->Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd->Init.Sof_enable = DISABLE;
RT_ASSERT(HAL_HCD_Init(hhcd) == HAL_OK);
state = HAL_HCD_Init(hhcd);
if (state != HAL_OK)
{
return -RT_ERROR;
}
HAL_HCD_Start(hhcd);
#ifdef USBH_USING_CONTROLLABLE_POWER
rt_pin_mode(USBH_POWER_PIN, PIN_MODE_OUTPUT);