Skip to main content
Explorer II
December 15, 2023
Question

Problem with USB Host enumeration using STM32G0B1RET

  • December 15, 2023
  • 1 reply
  • 971 views

Hi all,

 

My application needs to communicate with an external device (Bus Device). The STM32 was configured as a Host using STM32CubeMX.

The device is connected. However, 'Appli_state == APPLICATION_START' is never reached. Appli_state remains in the state 'HOST_USER_CONNECTION (0x04U)' or unknown (0x06U).

During debugging, I noticed that the function 'USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)' returns the value '2' instead of '1' or 'default'.

 

USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)
{
USBH_SpeedTypeDef speed = USBH_SPEED_FULL;

switch (HAL_HCD_GetCurrentSpeed(phost->pData))
{
case 0 :
speed = USBH_SPEED_HIGH;
break;

case 1 :
speed = USBH_SPEED_FULL;
break;

case 2 :
speed = USBH_SPEED_LOW;
break;

default:
speed = USBH_SPEED_FULL;
break;
}
return speed;
}

The function 'HAL_HCD_GetCurrentSpeed >> uint32_t USB_GetHostSpeed(USB_DRD_TypeDef *USBx)' changes the initial configuration to 'USB_DRD_SPEED_LS.' I didn't understand when 'USBx->ISTR' was modified.

 

uint32_t USB_GetHostSpeed(USB_DRD_TypeDef *USBx)
{
if ((USBx->ISTR & USB_ISTR_LS_DCONN) != 0U)
{
return USB_DRD_SPEED_LS;
}
else
{
return USB_DRD_SPEED_FS;
}
}

Could this be the cause of my issue or is the device not responding as it should?

My basic project 'VMPOSHost.rar' is attached for review.

Thanks!

 

    This topic has been closed for replies.

    1 reply

    hgalindoAuthor
    Explorer II
    February 1, 2024

    Hi guys!
    Any alternative for this issue?