插上U盘后,可以检测到U盘插入,可以检测到是全速设备,但是在读取设备描述符的时候,就返回USBH_BUSY了,
然后,就没有然后了。。。
是根据官方的库里的例子改的。
仿真调试,因为库里面都是状态机,也不太好找问题,哪位大哥做过这方面东西,知道的话,给我指指路吧?
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;
}
在这个函数里,返回的状态一直处于USBH_BUSY,能进入case CMD_SEND,但是phost->RequestState 得状态值不改变,一直是1,求高手指点啊,拜托啦
在开发板历程中是好用的,能够识别U盘 , 加入了自己项目的工程,就有问题了
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>