mcu: stm32f407zg 用stm32cube 官方的 usb otg host 读取u盘的工程原码, 插入U盘后 ,USB host 状态一直是HOST_ENUMERATION 。枚举一直不OK!
case HOST_ENUMERATION:
/* Check for enumeration status */
if ( USBH_HandleEnum(phost) == USBH_OK)
{
/* The function shall return USBH_OK when full enumeration is complete */
USBH_UsrLog ("Enumeration done.");
phost->device.current_interface = 0;
if(phost->device.DevDesc.bNumConfigurations == 1)
{
USBH_UsrLog ("This device has only 1 configuration.");
phost->gState = HOST_SET_CONFIGURATION;
}
else
{
phost->gState = HOST_INPUT;
}
}
起初我以为是 OTG_ID引脚没接造成的,我把OTG_ID强制拉GND后,情况一样;接下来我看到原工程中,已经将 OTG强制设为 HOST,模式,此时已经不用考虑 OTG_ID引脚的状态。问题迷茫中。
|