情况是这样的,用
STM32F105作host驱动U盘,用的STM32的MSC库,前面都没有问题 Enumera
tion completed > USBH_USR_UserInput OK. (我只在原库基础上加了串口中断输出调试)
一直卡在USBH_MSC_Handle 里的USBH_MSC_GETMaxLUN 里的USBH_CtlReq等,卡在(case CMD_WAIT)这了,谁知道是什么原因?如何解?
贴码如下:
USBH_Status USBH_CtlReq (USB_OTG_CORE_HANDLE *pdev,
USBH_HOST *phost,
uint8_t *buff,
uint16_t length)
{
USBH_Status status;
status = USBH_BUSY;
switch (phost->RequestState)
{
case CMD_SEND:
/* Start a SETUP transfer */
USBH_SubmitSetupRequest(phost, buff, length);
phost->RequestState = CMD_WAIT;
status = USBH_BUSY;
break;
case CMD_WAIT:
if (phost->Control.state == CTRL_COMPLETE )
{
/* Commands successfully sent and Response Received */
phost->RequestState = CMD_SEND;
phost->Control.state =CTRL_IDLE;
status = USBH_OK;
}
else if (phost->Control.state == CTRL_ERROR)
{
/* Failure Mode */
phost->RequestState = CMD_SEND;
status = USBH_FAIL;
}
else if (phost->Control.state == CTRL_STALLED )
{
/* Commands successfully sent and Response Received */
phost->RequestState = CMD_SEND;
status = USBH_NOT_SUPPORTED;
}
break;
default:
break;
}
return status;
}