cancel
Showing results for 
Search instead for 
Did you mean: 

CDC host cannot goes into CDC_InterfaceInit

kqian
Associate II
Posted on January 29, 2014 at 20:30

I am writing the cdc host code on the discover board. The program can detect the device is connected but it cannot get the device description and go to the CDC_InterfaceInit function . Any one has the idea what's wrong?

Thanks
1 REPLY 1
kqian
Associate II
Posted on January 30, 2014 at 19:23

I found in the below code, when call

 URB_Status = HCD_GetURB_State(pdev , phost->Control.hc_num_out); 

it always return 0. so the program never goes to ''if(URB_Status == URB_DONE)''

Any one know why?

Thanks

''USBH_Status USBH_HandleControl (USB_OTG_CORE_HANDLE *pdev, USBH_HOST *phost)

{

  uint8_t direction; 

  static uint16_t timeout = 0;

  USBH_Status status = USBH_OK;

  URB_STATE URB_Status = URB_IDLE;

 

  phost->Control.status = CTRL_START;

 

  switch (phost->Control.state)

  {

  case CTRL_SETUP:

    /* send a SETUP packet */

    USBH_CtlSendSetup     (pdev,

                    phost->Control.setup.d8 ,

                    phost->Control.hc_num_out); 

    phost->Control.state = CTRL_SETUP_WAIT; 

    break;

   

  case CTRL_SETUP_WAIT:

   

   

URB_Status = HCD_GetURB_State(pdev , phost->Control.hc_num_out);

 

    /* case SETUP packet sent successfully */

    if(URB_Status == URB_DONE)

    {

      direction = (phost->Control.setup.b.bmRequestType & USB_REQ_DIR_MASK);