阅读:1255回复:2
SL811问题合集
问题1:SL811初始化 不知道是不是正确的
void SL811Init(void) { Restsl811;//复位SL811 InitSL811;//初始化MCU端口 WriteSL811(IntEna,0x61); // 12.27 11:57更改 WriteSL811(cSOFcnt,0xae);//b1010 1110主机+sof WriteSL811(CtrlReg,0x08);//USB总线复位 WriteSL811(CtrlReg,0x00);//正常 WriteSL811(cSOFcnt,0xae);//重设主机 WriteSL811(CtrlReg,0x08);//USB总线复位 DelayMs(10); WriteSL811(CtrlReg,0x00);//正常 DelayMs(2); WriteSL811(IntEna,0x61); // USB-A, Insert/Remove, USB_Resume. 0110 0001 WriteSL811(IntStatus,0xff);//清中断 } 问题2:SL811设备速度选择 不知道是不是正确的 BYTE speed_detect(void) { BYTE i=0; WriteSL811(cSOFcnt, 0xae); // Set SOF high counter, no change D+/D- 1010 1100 WriteSL811(CtrlReg, 0x08); // Clear SL811H mode and setup normal operation 0100 1000 DelayMs(10); // Delay for HW stablize WriteSL811(CtrlReg, 0); // Disable USB transfer operation and SOF WriteSL811(IntEna,0x61); // USB-A, Insert/Remove, USB_Resume. 0110 0001 WriteSL811(IntStatus,0xff); DelayMs(20); i = ReadSL811(IntStatus); // Read Interrupt Status if(i & BIT6)// { SendCOM1("没有发现设备\r\n",0); WriteSL811(IntStatus,0xff); return false; } if ((i&BIT7)==0) // Checking full or slow speed { SendCOM1("发现低速设备\r\n",0); WriteSL811(cSOFcnt,0xee); // Set up Master and Slow Speed direct and SOF cnt high=0x2e 1110 1110 WriteSL811(cDATASet,0xe0); // SOF Counter Low = 0xe0; 1ms interval WriteSL811(CtrlReg,0x01); // Setup 6MHz and EOP enable 0010 0001 } else { SendCOM1("发现全速设备(1.1或2.0的)\r\n",0); WriteSL811(cSOFcnt,0xae); // Set up Master and full Speed direct and SOF cnt high=0x2e WriteSL811(cDATASet,0xe0); // SOF Counter Low = 0xe0; 1ms interval 0010 0001 WriteSL811(CtrlReg,0x21); // Setup 48MHz and SOF enable 0000 0101//05->01 } WriteSL811(EP0Status, 0x50); //0101 0000 WriteSL811(EP0Counter, 0x00); WriteSL811(EP0Control, 0x01); // start generate SOF or EOP DelayMs(25); // Hub required approx. 24.1mS WriteSL811(IntStatus,0xff); return true; } 问题3:关于SOF 初值设为Reg: cDATASet= 0x0e cSOFcnt=0xae是否正确 问题4:speed_detect()后cDATASet寄存器高位为0x21那个1代表什么?用户手册上说Reserved for slave 问题5:什么时候需要交换D+D-的极性? 问题6:IntStatus的最低位USB-A指的是SL811发送(接收)数据完成中断? 问题7:EP0Control的Arm位 清零是SL811自动完成?他和Enable组和都是什么意思? 问题8:枚举的部分,下次再贴 :cool: |
|
沙发#
发布于:2004-12-30 23:47
我觉得还是直接买个开发板比较方便 我觉得http://devking.51.net/不错 |
|
|
板凳#
发布于:2004-12-30 19:02
版主救命啊~回答问题啊
|
|