cancel
Showing results for 
Search instead for 
Did you mean: 

USB Device Composite - Babble Error

candoran
Associate
Posted on June 18, 2015 at 12:09

Hello, i'm trying to develop an usb composite device(MSC+HID classes) on STM32F407 using the USB Device Library that comes with the STM32Cube.

Basically what i've done is importing in import already working codes for standalone MSC and HID classes and create a new layer on the usb calls stack. I've declared a new

USBD_ClassTypeDef  USBD_COMPOSITE =

{

  USBD_Composite_Init,

  USBD_Composite_DeInit,

  USBD_Composite_Setup,

  NULL, /*EP0_TxSent*/

  NULL, /*EP0_RxReady*/

  USBD_Composite_DataIn, /*DataIn*/

  USBD_Composite_DataOut, /*DataOut*/

  NULL, /*SOF */

  NULL,

  NULL,

  NULL,

  USBD_Composite_GetCfgDesc,

  NULL,

  NULL,

};

where each composite function pointer looks like this:

static uint8_t  USBD_Composite_Init (USBD_HandleTypeDef *pdev,

                               uint8_t cfgidx){

    uint8_t ret = 0;

    pdev->pClassData = USBD_malloc(sizeof (USBD_HID_HandleTypeDef)+sizeof (USBD_MSC_BOT_HandleTypeDef));

    if(pdev->pClassData == NULL)

      {

        ret = 1;

      }

     else

      {

    (USBD_HID_CLASS)->Init(pdev, cfgidx);

    (USBD_MSC_CLASS)->Init(pdev, cfgidx);

    ret = 0;

      }

      return ret;

}

In the main the code to start the component looks like:

        USBD_Init(&USBD_Device, &Composite_Desc, 0);

        USBD_RegisterClass(&USBD_Device, &USBD_COMPOSITE);

        USBD_MSC_RegisterStorage(&USBD_Device, &USBD_MSC_F4Memory_fops);

        USBD_Start(&USBD_Device);

As u can see pointers to HID and MSC class functions are not called explictly by the Core functions but accessed trought the struct USBD_COMPOSITE that handle the redirects.

Analizying the behaviour of the component via USBlyzer what happen is

Babbled Error

on a Get Descriptor request my code is able to handle.

Reading the USB 2.0 specification this error is caused by bus activity from the device after the EOF that triggers the hub to disconnect the port from the host.

Does anyone have any suggestion on the nature/cause of this error and how could be possible to solve it?

PS: I'm uploading the eclipse project and the link will be avaible as soon
0 REPLIES 0