3 Replies Latest reply on Oct 8, 2020 2:36 AM by YiZ_31

    请问如何在SlaveFifoSync例程中添加HID设备枚举?

    user_2841216

      您好,我使用了SlaveFifoSync的32bit模式例程,现在我想在其中添加一个HID的设备(鼠标),程序见附件,我参照了Can EZ-USB FX3 enumerate serial devices and video and video devices at the same time?  中的内容,添加了HID相关的描述符,添加了hid设备的端口配置和DMA通道配置以及hid的线程。但是HID的枚举是失败的(设备管理器中没有出现这个设备),debug中没有print错误,并且原来的Cypress FX3 USB StreamerExample Device的设备也出现了叹号,如果把HID的相关内容删去Cypress FX3 USB StreamerExample Device是可以正常使用的。我slaveFifo采用的端口是0X01和0X81,hid采用的端口是0X87。

      cab18fd52ffa7377e80ae85ab7c1050.png

       

      请问我该如何修改程序?

        • 1. Re: 请问如何在SlaveFifoSync例程中添加HID设备枚举?
          YiZ_31

          Hi,

           

          您可以参考这篇KBA,其中是加入CDC设备的教程,您这种出现感叹号的情况一般就是描述符配置的有问题:

          Adding Communication Device Class Interface to FX3 Firmware - KBA229099

           

          Regards,
          Eddie

          • 2. Re: 请问如何在SlaveFifoSync例程中添加HID设备枚举?
            user_2841216

            我按照您上面的链接进行了描述符的修改,但是还是没有枚举成功

            66960e1c08d805171575d2e7dda5555.png

            如果对FX3更新驱动的话,会显示“windows无法安装FX3”,可能是我的USB描述符还是有问题,您是否能帮我看下?

            下面我贴出了CyFxUSBSSConfigDscr的描述符,slaveFIFO分别使用0x81和0x01端点,HID使用0X84端点

             

             

            /* Standard super speed configuration descriptor */

            const uint8_t CyFxUSBSSConfigDscr[] __attribute__ ((aligned (32))) =

            {

                /* Configuration descriptor */

                0x09,                           /* Descriptor size */

                CY_U3P_USB_CONFIG_DESCR,        /* Configuration descriptor type */

                0x2C + 0x28,0x00,                      /* Length of this descriptor and all sub descriptors */ //这里是总的大小

                0x02,                           /* Number of interfaces : slavefifo + hid*/

                0x01,                           /* Configuration number */

                0x00,                           /* COnfiguration string index */

                0x80,                           /* Config characteristics - Bus powered */

                0x32,                           /* Max power consumption of device (in 8mA unit) : 400mA */

             

             

                /* Interface descriptor */

                0x09,                           /* Descriptor size */

                CY_U3P_USB_INTRFC_DESCR,        /* Interface Descriptor type */

                0x00,                           /* Interface number */

                0x00,                           /* Alternate setting number */

                0x02,                           /* Number of end points */

                0xFF,                           /* Interface class */

                0x00,                           /* Interface sub class */

                0x00,                           /* Interface protocol code */

                0x00,                           /* Interface descriptor string index */

             

             

                /* Endpoint descriptor for producer EP */

                0x07,                           /* Descriptor size */

                CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */

                CY_FX_EP_PRODUCER,              /* Endpoint address and description */

                CY_U3P_USB_EP_BULK,             /* Bulk endpoint type */

                0x00,0x04,                      /* Max packet size = 1024 bytes */

                0x00,                           /* Servicing interval for data transfers : 0 for bulk */

             

             

                /* Super speed endpoint companion descriptor for producer EP */

                0x06,                           /* Descriptor size */

                CY_U3P_SS_EP_COMPN_DESCR,       /* SS endpoint companion descriptor type */

                BURST_LEN-1, /* Max no. of packets in a burst : 0: burst 1 packet at a time */

                0x00,                           /* Max streams for bulk EP = 0 (No streams) */

                0x00,0x00,                      /* Service interval for the EP : 0 for bulk */

             

             

                /* Endpoint descriptor for consumer EP */

                0x07,                           /* Descriptor size */

                CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */

                CY_FX_EP_CONSUMER,              /* Endpoint address and description */

                CY_U3P_USB_EP_BULK,             /* Bulk endpoint type */

                0x00,0x04,                      /* Max packet size = 1024 bytes */

                0x00,                           /* Servicing interval for data transfers : 0 for Bulk */

             

             

                /* Super speed endpoint companion descriptor for consumer EP */

                0x06,                           /* Descriptor size */

                CY_U3P_SS_EP_COMPN_DESCR,       /* SS endpoint companion descriptor type */

                BURST_LEN-1, /* Max no. of packets in a burst : 0: burst 1 packet at a time */

                0x00,                           /* Max streams for bulk EP = 0 (No streams) */

                0x00,0x00,                       /* Service interval for the EP : 0 for bulk */

             

             

                /////////////////////////////////HID///////////////////////////////////////

                /* Configuration Descriptor Type */

                   0x09,                           /* Descriptor Size */

                   CY_U3P_USB_CONFIG_DESCR,        /* Configuration Descriptor Type */

                   0x28,0x00,                      /* Length of this descriptor and all sub descriptors */ //接下来这一块一共40个字节

                   0x01,                           /* Number of interfaces */

                   0x02,                           /* Configuration number */

                   0x00,                           /* Configuration string index */

                   0xc0,                           /* Self powered device. */

                   0x0c,                           /* Max power consumption of device (in 8mA unit) : 96 mA */

             

             

                   /* Interface Descriptor */

                   0x09,                           /* Descriptor size */

                   CY_U3P_USB_INTRFC_DESCR,        /* Interface Descriptor type */

                   0x01,//CY_FX_USB_HID_INTF,             /* Interface number */

                   0x00,                           /* Alternate setting number */

                   0x01,                           /* Number of end points */

                   0x03,                           /* Interface class */

                   0x00,                           /* Interface sub class : None */

                   0x02,                           /* Interface protocol code */ //0:none  1:键盘       2:鼠标   3:HID

                   0x00,                           /* Interface descriptor string index */

             

             

                   /* HID Descriptor (Mouse) */

                   0x09,                           /* Descriptor size */

                   0x21,//CY_FX_USB_HID_DESC_TYPE,        /* Descriptor Type */

                   0x11,0x01,                      /* HID Class Spec 11.1 */

                   0x00,                           /* Target Country */

                   0x01,                           /* Total HID Class Descriptors */

                   0x22,                           /* Report Descriptor Type */

                   0x1C,0x00,                      /* Total Length of Report Descriptor */

             

             

                   /* Endpoint Descriptor (Mouse) */

                   0x07,                           /* Descriptor size */

                   CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint Descriptor Type */

                   CY_FX_HID_EP_INTR_IN,           /* Endpoint address and description 0x84*/

                   CY_U3P_USB_EP_INTR,             /* Interrupt Endpoint Type */

                   0x02,0x00,                      /* Max packet size = 9 bytes */

                   0x05,                           /* Servicing interval is 2 ** (5 - 1) = 16 Intervals = 2 ms. */

             

             

                   /* Super Speed Endpoint Companion Descriptor (Mouse) */

                   0x06,                           /* Descriptor size */

                   48,                           //  CY_FX_SS_EP_COMPN_DSCR_TYPE,    /* SS Endpoint Companion Descriptor Type */

                   0x00,                           /* Max no. of packets in a Burst. */

                   0x00,                           /* No streaming for Interrupt Endpoints. */

                   0x02,0x00                       /* Number of bytes per interval = 2. */

             

             

            };

            • 3. Re: 请问如何在SlaveFifoSync例程中添加HID设备枚举?
              YiZ_31

              从附件的描述符文件中参考#ifdef HID marco下的内容