Associate III
June 4, 2023
Question
HAL_HCD_Disconnect_Callback called usb host stm32f429disco 1
- June 4, 2023
- 3 replies
- 1657 views
Hi community.. I am working with stm32f429disco1 (the one with display) I created the code with cube mx and you can find it here in the attachments.. The usb host function it is not working..
I am able to get just at the beginning one connection
phost->device.is_connected = 1
USBH_StatusTypeDef USBH_Process(USBH_HandleTypeDef *phost)
{
__IO USBH_StatusTypeDef status = USBH_FAIL;
uint8_t idx = 0U;
/* check for Host pending port disconnect event */
if (phost->device.is_disconnected == 1U)
{
phost->gState = HOST_DEV_DISCONNECTED;
}
switch (phost->gState)
{
case HOST_IDLE :
if ((phost->device.is_connected) != 0U)
{
USBH_UsrLog("USB Device Connected");
/* Wait for 200 ms after connection */
phost->gState = HOST_DEV_WAIT_FOR_ATTACHMENT;
USBH_Delay(200U);
(void)USBH_LL_ResetPort(phost);
/* Make sure to start with Default address */
phost->device.address = USBH_ADDRESS_DEFAULT;
phost->Timeout = 0U;
#if (USBH_USE_OS == 1U)
phost->os_msg = (uint32_t)USBH_PORT_EVENT;
#if (osCMSIS < 0x20000U)
(void)osMessagePut(phost->os_event, phost->os_msg, 0U);
#else
(void)osMessageQueuePut(phost->os_event, &phost->os_msg, 0U, 0U);
#endif
#endif
}then if i leave the usb stick without removing i have immediatly the call to this function
/**
* @brief SOF callback.
* @param hhcd: HCD handle
* @retval None
*/
void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd)
{
USBH_LL_Disconnect(hhcd->pData);
}So it seems that i am getting an interrupt that i am removing the usb key..
Can you please help me to understand why always I get the disconnection?
Thanks a lot
