阅读:842回复:0
用sl811hs做host和U盘通信的timeout问题,急啊。。。
用sl811hs做host和U盘通信;
我初始化如下: SL811Write(EP0Status,0x50); SL811Write(EP0Counter,0); SL811Write(EP0Control,0x01); SL811Write(IntEna,0x21); SL811Write(IntStatus,INT_CLEAR); DelayMs(25); //for full speed; SL811Write(cSOFcnt,0xAE); SL811Write(cDATASet,0xE0); SL811Write(CtrlReg,0x05); 然后枚举, endpoint=0, pid=PID_SETUP, wLen=8, cmd = sDATA0_WR; SL811Write(EP0Status,((usbstack.endpoint&0x0F)|usbstack.pid)); SL811Write(EP0Counter,usbstack.usbaddr); SL811Write(EP0Address,data0); SL811Write(EP0XferLen,xferLen); SL811Write(IntStatus,INT_CLEAR); SL811Write(EP0Control,cmd); 等待中断,读IntStatus(读到是81h,usb a done)再读EP0Status(读到04h,timeout) 然后就不停循环。 有时候IntStatus的数据很不规则,会自动退出,不知道什么原因。头疼啊。。。 知道原因的兄弟姐妹们,帮帮忙。。。或者有一些提示也好。。。 |
|