How to add a new HID interfaces in super speed?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

   

I add a new HID interface into UVC sample code,

   

(refer the "http://www.cypress.com/?rID=72422")

   

In USB2.0,  it's OK.  (windows device manager has detect a new HID device),

   

But in USB3.0, it's not work. windows device manager can't detect.

   

I only add the descriptor in spuer speed and high speed as below, 

   

Do I need add another descriptor in super speed?  Thanks.

   

--

   

/* Super Speed Configuration Descriptor */

   

#define HID

    /* Configuration Descriptor Type */
    0x09,                           /* Descriptor Size */
    CY_U3P_USB_CONFIG_DESCR,        /* Configuration Descriptor Type */
#ifdef HID
    0xF2,0x00,
    0x03,
#else
    0xD9,0x00,                      /* Length of this descriptor and all sub descriptors */
    0x02,                           /* Number of interfaces */
#endif
    0x01,                           /* Configuration number */
    0x00,                           /* Configuration string index */
    0x80,                           /* Config characteristics - Bus powered */
    //0xFA,                           /* Max power consumption of device (in 2mA unit) : 500mA */
    0x32,             

   

   ...

   

   ...

   

#ifdef HID
    /* New Interface descriptor */
    0x09,
    0x04,
    0x02,
    0x00,
    0x01,
    0x03,
    0x00,
    0x00,
    0x01,
    /* HID descriptor */
    0x09,
    0x21,
    0x01,0x01,
    0x00,
    0x01,
    0x22,
    0x22,0x00,
    /* endpoint descriptor */
    0x07,
    0x05,
    0x85,
    0x03,
    0x40,0x00,
    0x0A
#endif

0 Likes
10 Replies
Anonymous
Not applicable

Hi Cyui,

   

I think you added your HID to both descriptors, the HS and the SS?

   

Did you add the correct value of max packet size in CyFxUSBSSConfigDscr? There you should set max packet size to 1024 for super speed!!!

   

/* UVC Video Streaming Endpoint Packet Size */
#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)  /* 1024 Bytes */
 

   

/* Low Byte - UVC Video Streaming Endpoint Packet Size */
#define CY_FX_EP_BULK_VIDEO_PKT_SIZE_L  (uint8_t)(CY_FX_EP_BULK_VIDEO_PKT_SIZE & 0x00FF)

/* High Byte - UVC Video Streaming Endpoint Packet Size and No. of BULK packets */
#define CY_FX_EP_BULK_VIDEO_PKT_SIZE_H  (uint8_t)((CY_FX_EP_BULK_VIDEO_PKT_SIZE & 0xFF00) >> 😎
 

   

 

   

        /* Endpoint Descriptor for BULK Streaming Video Data */
        0x07,                           /* Descriptor size */
        CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint Descriptor Type */
        CY_FX_EP_BULK_VIDEO,             /* Endpoint address and description */
        CY_U3P_USB_EP_BULK,              /* BULK End point */
        CY_FX_EP_BULK_VIDEO_PKT_SIZE_L,  /* EP MaxPcktSize: 1024B */
        CY_FX_EP_BULK_VIDEO_PKT_SIZE_H,  /* EP MaxPcktSize: 1024B */
        0x01,                           /* Servicing interval for data transfers */
 

   

There is a difference between USB2.0 HS and USB3.0 SS. HS needs max packet size of 512 and SS 1024.

   

regards,

   

lumpi

0 Likes
Anonymous
Not applicable

Hi Cyui,

   

I think you added your HID to both descriptors, the HS and the SS?

   

Did you add the correct value of max packet size in CyFxUSBSSConfigDscr? There you should set max packet size to 1024 for super speed!!!

   

/* UVC Video Streaming Endpoint Packet Size */
#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)  /* 1024 Bytes */
 

   

/* Low Byte - UVC Video Streaming Endpoint Packet Size */
#define CY_FX_EP_BULK_VIDEO_PKT_SIZE_L  (uint8_t)(CY_FX_EP_BULK_VIDEO_PKT_SIZE & 0x00FF)

/* High Byte - UVC Video Streaming Endpoint Packet Size and No. of BULK packets */
#define CY_FX_EP_BULK_VIDEO_PKT_SIZE_H  (uint8_t)((CY_FX_EP_BULK_VIDEO_PKT_SIZE & 0xFF00) >> 😎
 

   

 

   

        /* Endpoint Descriptor for BULK Streaming Video Data */
        0x07,                           /* Descriptor size */
        CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint Descriptor Type */
        CY_FX_EP_BULK_VIDEO,             /* Endpoint address and description */
        CY_U3P_USB_EP_BULK,              /* BULK End point */
        CY_FX_EP_BULK_VIDEO_PKT_SIZE_L,  /* EP MaxPcktSize: 1024B */
        CY_FX_EP_BULK_VIDEO_PKT_SIZE_H,  /* EP MaxPcktSize: 1024B */
        0x01,                           /* Servicing interval for data transfers */
 

   

There is a difference between USB2.0 HS and USB3.0 SS. HS needs max packet size of 512 and SS 1024.

   

regards,

   

lumpi

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

   

Thanks for reply , but I already set max packet size to 1024 for super speed,

   

and if don't add a new HID interface, UVC works well. (Both SS and HS)

   

When add a new HID interface, HID and UVC will not detected in super speed,

   

But in high speed, HID and UVC can detected.

   

Maybe is HID descriptor incorrect makes FX3 don't work?

0 Likes
Anonymous
Not applicable

Hi Cyui,

   

in superspeed descriptors all enpoint descriptors have a companion descriptor with the max num of packets per burst,...!

   

This is missing in your configuration descriptor of your added HID endpoint. Add this too!

   

#ifdef HID
        ,
        /* New Interface descriptor */
    0x09,
    0x04,
    0x02,
    0x00,
    0x01,
    0x03,
    0x00,
    0x00,
    0x01,

    /* HID descriptor */
    0x09,
    0x21,
    0x01,0x01,
    0x00,
    0x01,
    0x22,
    0x22,0x00,

    /* endpoint descriptor */
    0x07,
    0x05,
    0x85,
    0x03,
    0x40,0x00,
    0x0A
        /* Super Speed Endpoint Companion Descriptor */
        0x06,                           /* Descriptor size */
        CY_U3P_SS_EP_COMPN_DESCR,       /* SS Endpoint Companion Descriptor Type */
        0x0F,                           /* Max number of packets per burst: 16 */
        0x00,                           /* Attribute: Streams not defined */
        0x00,                           /* No meaning for bulk */
        0x00
#endif
 

   

and you also have to change the length from

   

        0xF2,0x00,//242                      /* Length of this descriptor and all sub descriptors */
 

   

to

   

        0xF2+6,0x00,//242                      /* Length of this descriptor and all sub descriptors */

   

regards,

   

lumpi

0 Likes
Anonymous
Not applicable

Hi Lumpi6,

   


Yes, you're right.

   

When I add the SS endpoint companion descriptor,

   

It can be detected, both UVC and HID.

   

But I have modify some value as below,

   


   

/* Super Speed Endpoint Companion Descriptor */
        0x06,                         
        CY_U3P_SS_EP_COMPN_DESCR,     
        0x00,                         
        0x00,                         
        0x00,                         
        0x04

   


Thank you very much~

0 Likes
Anonymous
Not applicable

Hi Cyui,

   

great that it works 😉 you're welcome. I thought about that, that you may setup the values like you are using the descriptor... . It was just an example.

   

regards,

   

lumpi

0 Likes
Anonymous
Not applicable

Hi

   

I need HID Compliant FX3s sample with both read and write endpoints, please help me.

   

I changed mouse sample OUT endpoint and added IN endpoint but it didn't work...!

0 Likes
Anonymous
Not applicable

Cyui:

   

I want a hid interface too,Can you give you code to me,My email is 379039233@qq.com,Thanks a lot!!!

0 Likes
Anonymous
Not applicable

Hi,Cyui:
I use the demo cycx3_uvc_ov5640.
I change the descriptors as follows(just copy yours),but it does not work.Do I need to add some extra code?

   

#define EP_MPU6500_HID
const uint8_t esUVCUSBSSConfigDscr[] =
{
    /* Configuration Descriptor*/
    0x09,                               /* Descriptor Size */
    CY_U3P_USB_CONFIG_DESCR,            /* Configuration Descriptor Type */
#ifdef EP_MPU6500_HID//25+6=31 0x3E+31 = 0x5D
    0x5D, 0x01,
#else
    0x3E, 0x01,                         /* Length of this descriptor and all sub descriptors */
#endif    
    ..................
#ifdef EP_MPU6500_HID
 /* New Interface descriptor */
    0x09,
    0x04,
    0x02,
    0x00,
    0x01,
    0x03,
    0x00,
    0x00,
    0x01,
    /* HID descriptor */
    0x09,
    0x21,
    0x01,0x01,
    0x00,
    0x01,
    0x22,
    0x22,0x00,
    /* endpoint descriptor */
    0x07,
    0x05,
    0x85,
    0x03,
    0x40,0x00,
    0x0A,
        /* Super Speed Endpoint Companion Descriptor */
    0x06,
          CY_U3P_SS_EP_COMPN_DESCR,
          0x00,
          0x00,
          0x00,
          0x04,
#endif   
    ................
};

   

If I comment #define EP_MPU6500_HID,it works,I can see the ov5640 works well through e-CAMView.
Can you give me some advice?
Thanks a lot!

0 Likes

Hello.

You need add modify a gl_probe variables.

0 Likes