Problem with incomplete USB host mode deinitialization
Hello STM-Team,
I use USB OTG with switching between host and device mode (STM32F777 with HAL driver 1.15.0). With the falling ID pin state the device mode is deinitialized and host mode is initialized and vice versa with rising edge.
But there seems to be a problem in the deinitialization of host mode:
The function USBH_LL_DeInit() (generated by CubeMX in usbh_conf.c) is called nowhere
USBH_StatusTypeDef USBH_LL_DeInit(USBH_HandleTypeDef *phost)
{
HAL_StatusTypeDef hal_status = HAL_OK;
USBH_StatusTypeDef usb_status = USBH_OK;
hal_status = HAL_HCD_DeInit(phost->pData);
usb_status = USBH_Get_USB_Status(hal_status);
return usb_status;
}I think the correct place to call this function would be in function USBH_DeInit() in usbh_core.c because prototype for USBH_LL_DeInit is also defined in usbh_core.h
(USBH_LL_Init() is also called in USBH_Init())
USBH_StatusTypeDef USBH_DeInit(USBH_HandleTypeDef *phost)
{
DeInitStateMachine(phost);
if (phost->pData != NULL)
{
USBH_LL_Stop(phost);
}
/* call deinit function here*/
USBH_LL_DeInit(phost)
return USBH_OK;
}After this modification the deinitialization of host mode works perfect and there are no more problems on switching between host and device mode.
Could you check this issue?
Thank you!
