ip4347
驱动牛犊
驱动牛犊
  • 注册日期2004-03-04
  • 最后登录2010-10-31
  • 粉丝0
  • 关注0
  • 积分36分
  • 威望5点
  • 贡献值0点
  • 好评度3点
  • 原创分0分
  • 专家分0分
阅读:2157回复:27

[求助]关于usbn9603开发中设备枚举问题

楼主#
更多 发布于:2004-04-06 17:20
我目前再开发usbn9603的固件,由于刚学,所以困难重重。现在遇到的问题是,usb设备在处理主机请求的时候采用的是中断方式,但是主机发送标准设备请求时,usbn9603总是给予alt的状态相应,没有触发rx0,tx0事件。不知为什么,我用的固件是该网站提供的usbn9604固件,部分代码如下,清高手帮忙看看,不胜感激!!
int main_usb(void)
{
  ... ...
  
  
  USBN9603_init();
  
  while(1)
  {
       ... ...

  }
  

  return 0;

}
void USBN9603_init(void)
{
     ////初始化9603///
    write_usb(CCONF, CLKDIV_SLOW-1);
    
    /* Give a software reset, then set ints to active high push pull */
    write_usb(MCNTRL, SRST)      ;

    /* Wait for end of the initiated reset */
    while(read_usb(MCNTRL) & SRST);    
    
    write_usb(MCNTRL, INT_H_P | VGE);

    /*mask all USB node events*/
     DISABLE_NODE_INTS                    //write MAMSK


     /* Set up interrupt masks */
    ENABLE_NAK_INTS(NAK_OUT0)   /* NAK OUT FIFO 0 evnt */  
    
    ENABLE_TX_INTS(TX_FIFO0|TX_FIFO1|TX_FIFO2|TX_FIFO3) //
    ENABLE_RX_INTS(RX_FIFO0|RX_FIFO1)            
    ENABLE_ALT_INTS(ALT_SD3|ALT_RESET)          
                                                           //can indicates the suspend state,reset can make into opstate
     /* Enable all below interrupts */
    ENABLE_NODE_INTS(INTR_E|RX_EV|NAK|TX_EV|ALT)
    reset_usb();
    GOTO_STATE(OPR_ST)              
     ATTACH_NODE                                  
     for (i = 0; i < 0xffff; i++);

}


void reset_usb(void)
{

     /*      set default address for endpoint 0*/
     SET_EP_ADDRESS(EPC0, 0x0)
    /*set usb default device address (FAR register)*/
     SET_USB_DEVICE_ADDRESS(0x0)
   /*enable USB device address (FAR register)*/
     USB_DEVICE_ADDRESS_ENABLE
    
     /*enable responce to the default address
     regardless to the value of the EPC0 and FAR registers*/

/*      Reset all endpoints */
/*      for (i=1; i<MAX_NUM_OF_ENDPOINTS; i++)
     {
           if (uja_dev_endpoints != NULL)
                 usb_dev_disable_ep(uja_dev_endpoints);
     }
*/
     FLUSHTX0 //ep0
     FLUSHTX1 //ep1
     FLUSHTX3 //ep5

     FLUSHRX0 //ep0
     FLUSHRX1 //ep2

    /* Global initalizations */
     clear_control_buffer(&control_send_buffer);
     clear_control_buffer(&control_receive_buffer);
     endpoint_status_init();
     direct_send_active = 0;
     wating_rx_data = 0;

/*      Enable the receiver */
    ENABLE_RX0      
    
}
/*中断处理函数*/
void usb_node_handler(void)
{
     byte usbn_event;
    
     // Clear the interrupt of gpio for usb
     dev_irq_control->IRQ_MASK&=(~IRQ_GPIO);

     while( (usbn_event = (read_usb(MAEV) & read_usb(MAMSK))) )
     {
           if (usbn_event & RX_EV)
           {      
                 USBN9603_rx_event_handler();
           }
           if (usbn_event & ALT)
                 USBN9603_alt_event_handler();
           if (usbn_event & TX_EV)      
                 USBN9603_tx_event_handler();
           if (usbn_event & NAK) {
                 if (read_usb(NAKEV) & 0x10)
                 {//NAK OUT
                       FLUSHTX0;
                       FLUSHRX0;
                       //re enable receving
                       DISABLE_TX(ENDPOINT_0);
                       ENABLE_RX(ENDPOINT_0);
                 }
           }
     }
}
我觉得在中断处理函数中,不应该用while的大循环了吧?
leadphone
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2008-09-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2004-04-07 09:58
看一下中断enable是否设正确了,在我的系统中,9603/9604被attach_node之后就会不停的中断,如果这个时候usb cable还没连上,那这些中断都是alt中的reset中断。而一旦连上,主机监测到设备发出get_desc的时候,设备响应得中断就是rx0了。

中断函数中的那个while是为了将各个中断都处理掉,因为有可能是两个中断同时触发。
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2004-04-07 11:28
我也在使用USBN9603的片子,目前在列举过程中也发生了不少问题。
我的中断到都能收到,但是奇怪的是总是不停的产生ALT中断,而且都是WAKEUP,SD3,SD5中断。但是wakeup中断我没有打开。现在列举过程只到set address 处理后,就是不停的ALT中断(wakeup ,sd3,sd5)。这是怎么回事。
leadphone
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2008-09-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2004-04-07 14:08
9604的中断是你不响应的话,它也会被置上

你set_addr之后要发送一个空包给主机,这样就会收到下一个setup包。而你现在收到很多alt中断大概就是因为你的set_addr没处理完。
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2004-04-07 15:00
谢谢leadphone。
不知道有没有详细的关于列举过程的文章或资料(当然不是简单介绍的那种)给介绍一下。
最好是那种详细的介绍主机和设备间的交互流程,注意事项。
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2004-04-07 15:39
我在set address后发送了一个0长度包,但是还是不行啊。
我把用串口调试打印的信息贴上来,请帮我看看。
哪个过程不对。
下面是串口打印的信息:

end usb init !!!!
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in std dev get desc
in dev desc
/----------------------In TX event-------------------------
/----------------------In RX event------------------------
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in the dev set address
/----------------------In TX event-------------------------
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in std dev get desc
in dev desc
/----------------------In TX event-------------------------
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in std dev get desc
in dev desc
/----------------------In TX event-------------------------
/----------------------In RX event------------------------
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in the dev set address
/----------------------In TX event-------------------------
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in std dev get desc
in dev desc
/----------------------In TX event-------------------------
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in std dev get desc
in dev desc
/----------------------In TX event-------------------------
/----------------------In RX event------------------------
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt setup
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt setup
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in the dev set address
/----------------------In TX event-------------------------
/----------------------In RX event------------------------
/-------------------------RX_FIFO0--------------------------
/---------------------in standard req handler------------------
in std dev get desc
in dev desc
/----------------------In TX event-------------------------
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt sd3
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt sd3
in alt sd3
Xranger
驱动牛犊
驱动牛犊
  • 注册日期2004-04-07
  • 最后登录2004-08-06
  • 粉丝1
  • 关注1
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2004-04-07 15:50
是啊是啊,很想要这样的详细资料,同求!
leadphone
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2008-09-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2004-04-07 16:35
这样的资料查查原来的贴子就会找到

粗略的看了一下那些数据,觉得还是SET_ADDR没做对
0数据包是在函数usbn9604_tx_enable()中发送的,看看TOGGLE_BIT有没有设对

ip4347
驱动牛犊
驱动牛犊
  • 注册日期2004-03-04
  • 最后登录2010-10-31
  • 粉丝0
  • 关注0
  • 积分36分
  • 威望5点
  • 贡献值0点
  • 好评度3点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2004-04-07 19:13
谢谢这位大哥帮忙!
小弟还有一些要问,
1 USB中断不知道是否可以嵌套?
2 ATTACH_NODE前面是否要加上延时的代码
  后面是否也要加上?
3 还不清楚usb cable是什么意思?能否说明一下:)
再次感谢!
tuoxie
驱动牛犊
驱动牛犊
  • 注册日期2004-02-26
  • 最后登录2004-06-03
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
9楼#
发布于:2004-04-07 20:48
case SET_ADDRESS:
                      /*save the new address, but don't actually store*/
                      /*it into FAR until later (when status handshake*/
                      /*completes during tx_0).  Note that the 9602   */
                      /*has a DEF bit in EPC0 designed for this purp- */
                      /*ose, but it only works if the default address */
                      /*is initially in effect.  Therefore it can't   */
                      /*be used for multiple SET_ADDRESS commands in  */
                      /*sequence.  This will work regardless of init- */
                      /*ial address.                                  */
                        setaddr = (usb_buf[2] | AD_EN);
                        break;

我也在搞usbn9603,setaddress的时候不对寄存器操作的,做是在tx0里
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
10楼#
发布于:2004-04-08 10:35
现在SET ADDRESS还没有搞定,toggle位我检查了,0,1交替,没有错误。很奇怪的是,为什么总是出现很多的ALT中断啊。而且系统在几次发送SET ADDRESS请求后,就会进入不停的ALT中断中。有没有什么方法检验SET ADDRESS是否成功。


tuoxie:
    你的代码太少了,我没有太明白,setaddress不对寄存器操作,做是在tx0中,是什么意思。能不能说详细点。

我有USBN9604的源代码,但是我不想直接在上面使用,因为这样即使调过了,好像还有很多地方不清楚。所以我现在希望从头开始做,这样虽然会遇到很多问题,但解决问题的过程也就是理解的过程,希望各位能多多帮助,给予意见。
liumda
驱动小牛
驱动小牛
  • 注册日期2002-01-23
  • 最后登录2012-07-16
  • 粉丝0
  • 关注0
  • 积分76分
  • 威望48点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
11楼#
发布于:2004-04-08 11:01
这个可能和你用的MCU有关系,你用的是51吗?
You Happy,So I Happy!
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
12楼#
发布于:2004-04-08 13:40
用的是ARM7.
leadphone
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2008-09-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
13楼#
发布于:2004-04-08 14:15
谢谢这位大哥帮忙!
小弟还有一些要问,
1 USB中断不知道是否可以嵌套?
2 ATTACH_NODE前面是否要加上延时的代码
  后面是否也要加上?
3 还不清楚usb cable是什么意思?能否说明一下:)
再次感谢!


1:是否嵌套和你的CPU有关吧?
2:加上吧
3:USB CABLE就是USB线
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
14楼#
发布于:2004-04-08 14:17
我把一些地方用串口打印了,比前面的信息多一些。
如下:
2004年03月10日13时56分34秒
start usb init !!!!
end usb init !!!!
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*40*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
in alt event handler
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :00*05*02*00*00*00*00*00*
/---------------------in standard req handler------------------
NUM :5
in the dev set address
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*12*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*40*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :00*05*02*00*00*00*00*00*
/---------------------in standard req handler------------------
NUM :5
in the dev set address
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*12*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset

在上面的语句中,我打印了收到的setup请求包的内容。
分析看,前面的步骤是正确的。
1。首先GET description.注意其包长度字段中的期望值是40。
2。发送完GET description的应答后,host发送set address请求。
检查其包格式也是正确的。地址为2。
3。然后host再次请求get description,这次请求的是具体的设备描述,注意长度字段为0x12,也是我在1中发送过去的值,说明步骤1是正确的,host正确的收到了包。
这里想弄清的是是不是在步骤2进行正确以后才会进行步骤3,并且在步骤3中使用的地址是用默认的地址0,还是步骤2中设置的地址。

还有设置地址时,除了写入FAR寄存器地址值,ENABLE,并且返回一个零长度应答包,外还有什么要注意的吗。
leadphone
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2008-09-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
15楼#
发布于:2004-04-08 14:21
9604提供的FW中SET ADDR部分对寄存器操作了,将AD_EN和HOST分配的地址一起写入FAR寄存器,然后进入TX0发一个空包。空包发完之后SET ADDR才算OK。
如果有枚举过程中有ALT中断,那么就是某一步没有搞对。你不会是在ARM7上连ICE单步走得吧?调USB不能单步执行的。
另外,你还是仔细消化消化9604的FW,然后修改。完全从头来的话会很累。9604的FW全部理解下来也不是非常困难,加点信心。

现在SET ADDRESS还没有搞定,toggle位我检查了,0,1交替,没有错误。很奇怪的是,为什么总是出现很多的ALT中断啊。而且系统在几次发送SET ADDRESS请求后,就会进入不停的ALT中断中。有没有什么方法检验SET ADDRESS是否成功。


tuoxie:
    你的代码太少了,我没有太明白,setaddress不对寄存器操作,做是在tx0中,是什么意思。能不能说详细点。

我有USBN9604的源代码,但是我不想直接在上面使用,因为这样即使调过了,好像还有很多地方不清楚。所以我现在希望从头开始做,这样虽然会遇到很多问题,但解决问题的过程也就是理解的过程,希望各位能多多帮助,给予意见。
leadphone
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2008-09-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
16楼#
发布于:2004-04-08 14:24
恭喜你,你的SET_ADDR已经过了,往下走吧。

我把一些地方用串口打印了,比前面的信息多一些。
如下:
2004年03月10日13时56分34秒
start usb init !!!!
end usb init !!!!
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*40*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
in alt event handler
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :00*05*02*00*00*00*00*00*
/---------------------in standard req handler------------------
NUM :5
in the dev set address
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*12*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*40*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :00*05*02*00*00*00*00*00*
/---------------------in standard req handler------------------
NUM :5
in the dev set address
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
/---------------RX_FIFO0,setup request---------------------
the HEX COMMAND :80*06*00*01*00*00*12*00*
/---------------------in standard req handler------------------
NUM :6
in std dev get desc
in dev desc
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 1
/----------------------In TX event-------------------------
---tx ,event ack success
----tx,event additional data
************the tx toggle is 0
/----------------------In TX event-------------------------
---tx ,event ack success
---tx ,event else
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt default
in alt default
in alt default
in alt reset
in alt event handler
in alt default
in alt wkup
in alt default
in alt eop
in alt default
in alt default
in alt reset

在上面的语句中,我打印了收到的setup请求包的内容。
分析看,前面的步骤是正确的。
1。首先GET description.注意其包长度字段中的期望值是40。
2。发送完GET description的应答后,host发送set address请求。
检查其包格式也是正确的。地址为2。
3。然后host再次请求get description,这次请求的是具体的设备描述,注意长度字段为0x12,也是我在1中发送过去的值,说明步骤1是正确的,host正确的收到了包。
这里想弄清的是是不是在步骤2进行正确以后才会进行步骤3,并且在步骤3中使用的地址是用默认的地址0,还是步骤2中设置的地址。

还有设置地址时,除了写入FAR寄存器地址值,ENABLE,并且返回一个零长度应答包,外还有什么要注意的吗。
 
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
17楼#
发布于:2004-04-08 14:35
谢谢leadphone!!!
  
bbiliu
驱动牛犊
驱动牛犊
  • 注册日期2004-02-20
  • 最后登录2005-01-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
18楼#
发布于:2004-04-08 15:55
  还是不能进行下面的列举过程。在进行了set address后,连续进行3次set address,get description过程,但是就是不出现get configuration过程啊。然后就是系统不停的ALT中断。看来我的程序还有地方没有设对。
如果set address对了的话,应该不会再连续发送set address 和get description请求了吧。
leadphone
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2008-09-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
19楼#
发布于:2004-04-08 17:26
SET ADDR应该已经OK,因为你的串口数据已经显示主机发出了80 06 00 01 00 00 12 00的SETUP包,肯定是这后面的请求没有回送正确。才致使HOST又重新枚举
HOST通常是3次枚举,都不成功则放弃。而每次枚举都是从头开始,所以你每次都看到了SET ADDR

不要再怀疑前面的工作了,从长度0X12的回送包开始往后捋,找问题。这一步回送正确了才GET_CONFIG
上一页
游客

返回顶部