AnsweredAssumed Answered

Full Duplex USB Audio with KDS 2.0

Question asked by Andrew DeLiso on Jun 23, 2016
Latest reply on Oct 13, 2016 by isaacavila

Hello All,

 

I am trying to implement a USB Audio full duplex device.  I have the MIC function working fine based off the composite hid audio example.  I am trying to get the Speaker function to work and I am unable to configure the USB setup correctly.  The descriptor is correct, my Linux host has no issues with it and using wireshark I can see the packets being sent and they are being accepted.

 

Here is the snippets of the relevant code.

/* Audio generator stream endpoint information */ /* Direction from HOST view */ usb_device_endpoint_struct_t g_UsbDeviceAudioGeneratorEndpoints[USB_AUDIO_STREAM_ENDPOINT_COUNT] = {     /* Audio generator ISO IN pipe */     {         USB_AUDIO_STREAM_ENDPOINT | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),         USB_ENDPOINT_ISOCHRONOUS, FS_ISO_IN_ENDP_PACKET_SIZE,     },   /* Audio generator ISO OUT pipe */   {      USB_AUDIO_STREAM_OUT_ENDPOINT | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),      USB_ENDPOINT_ISOCHRONOUS, FS_ISO_IN_ENDP_PACKET_SIZE,   }, };   /* Audio generator control endpoint information */ usb_device_endpoint_struct_t g_UsbDeviceAudioControlEndpoints[USB_AUDIO_CONTROL_ENDPOINT_COUNT] = {     {         USB_AUDIO_CONTROL_ENDPOINT | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),         USB_ENDPOINT_INTERRUPT, FS_INTERRUPT_IN_PACKET_SIZE,     }, };   /* Audio generator entity struct */ usb_device_audio_entity_struct_t g_UsbDeviceAudioEntity[] = {     {         0x01, USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_INPUT_TERMINAL, 0U,     },     {         0x02, USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_INPUT_TERMINAL, 0U,     },     {         0x06, USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_OUTPUT_TERMINAL, 0U,     },     {         0x07, USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_OUTPUT_TERMINAL, 0U,     }, };   /* Audio generator entity information */ usb_device_audio_entities_struct_t g_UsbDeviceAudioEntities = {     g_UsbDeviceAudioEntity, sizeof(g_UsbDeviceAudioEntity) / sizeof(usb_device_audio_entity_struct_t), };   /* Audio generator control interface information */ usb_device_interface_struct_t g_UsbDeviceAudioControInterface[] = {{     0U,     {         USB_AUDIO_CONTROL_ENDPOINT_COUNT, g_UsbDeviceAudioControlEndpoints,     },     &g_UsbDeviceAudioEntities, }};   /* Audio generator stream interface information */ usb_device_interface_struct_t g_UsbDeviceAudioStreamInterface[] = {     {         0U,         {             0U, NULL,         },         NULL,     },     {         1U,         {             USB_AUDIO_STREAM_ENDPOINT_COUNT, g_UsbDeviceAudioGeneratorEndpoints,         },         NULL,     },   {   2U,   {   USB_AUDIO_STREAM_ENDPOINT_COUNT, g_UsbDeviceAudioGeneratorEndpoints,   },   NULL,   } };   /* Define interfaces for audio generator */ usb_device_interfaces_struct_t g_UsbDeviceAudioInterfaces[USB_AUDIO_GENERATOR_INTERFACE_COUNT] = {     {         USB_AUDIO_CLASS,                   /* Audio class code */         USB_SUBCLASS_AUDIOCONTROL,         /* Audio control subclass code */         USB_AUDIO_PROTOCOL,                /* Audio protocol code */         USB_AUDIO_CONTROL_INTERFACE_INDEX, /* The interface number of the Audio control */         g_UsbDeviceAudioControInterface,   /* The handle of Audio control */         sizeof(g_UsbDeviceAudioControInterface) / sizeof(usb_device_interfaces_struct_t),     },     {         USB_AUDIO_CLASS,                  /* Audio class code */         USB_SUBCLASS_AUDIOSTREAM,         /* Audio stream subclass code */         USB_AUDIO_PROTOCOL,               /* Audio protocol code */         USB_AUDIO_STREAM_INTERFACE_INDEX, /* The interface number of the Audio control */         g_UsbDeviceAudioStreamInterface,  /* The handle of Audio stream */         sizeof(g_UsbDeviceAudioStreamInterface) / sizeof(usb_device_interfaces_struct_t),     },     {         USB_AUDIO_CLASS,                  /* Audio class code */         USB_SUBCLASS_AUDIOSTREAM,         /* Audio stream subclass code */         USB_AUDIO_PROTOCOL,               /* Audio protocol code */         USB_AUDIO_STREAM_OUT_INTERFACE_INDEX, /* The interface number of the Audio control */         g_UsbDeviceAudioStreamInterface,  /* The handle of Audio stream */         sizeof(g_UsbDeviceAudioStreamInterface) / sizeof(usb_device_interfaces_struct_t),     } };

I feel that this config is wrong, but a can't find a example of how to configure it for 2 interfaces.  I am not getting any interrupts when the speaker endpoint is called.  Thou in wireshark I see successful transfers.

 

Here is the descriptor:

uint8_t g_UsbDeviceConfigurationDescriptor[USB_DESCRIPTOR_LENGTH_CONFIGURATION_ALL] = {     USB_DESCRIPTOR_LENGTH_CONFIGURE, /* Size of this descriptor in bytes */     USB_DESCRIPTOR_TYPE_CONFIGURE,   /* CONFIGURATION Descriptor Type */     USB_SHORT_GET_LOW(USB_DESCRIPTOR_LENGTH_CONFIGURATION_ALL),     USB_SHORT_GET_HIGH(         USB_DESCRIPTOR_LENGTH_CONFIGURATION_ALL), /* Total length of data returned for this configuration. */     USB_DEVICE_INTERFACE_COUNT,                   /* Number of interfaces supported by this configuration */     USB_COMPOSITE_CONFIGURE_INDEX,                /* Value to use as an argument to the                                                      SetConfiguration() request to select this configuration */     0x00U,                                        /* Index of string descriptor describing this configuration */     (USB_DESCRIPTOR_CONFIGURE_ATTRIBUTE_D7_MASK) |         (USB_DEVICE_CONFIG_SELF_POWER << USB_DESCRIPTOR_CONFIGURE_ATTRIBUTE_SELF_POWERED_SHIFT) |         (USB_DEVICE_CONFIG_REMOTE_WAKEUP << USB_DESCRIPTOR_CONFIGURE_ATTRIBUTE_REMOTE_WAKEUP_SHIFT),     /* Configuration characteristics        D7: Reserved (set to one)        D6: Self-powered        D5: Remote Wakeup        D4...0: Reserved (reset to zero)     */     USB_DEVICE_MAX_POWER, /* Maximum power consumption of the USB                            * device from the bus in this specific                            * configuration when the device is fully                            * operational. Expressed in 2 mA units                            *  (i.e., 50 = 100 mA).                            */       USB_DESCRIPTOR_LENGTH_INTERFACE,   /* Size of this descriptor in bytes */     USB_DESCRIPTOR_TYPE_INTERFACE,     /* INTERFACE Descriptor Type */     USB_AUDIO_CONTROL_INTERFACE_INDEX, /* Number of this interface. */     0x00U,                             /* Value used to select this alternate setting                                           for the interface identified in the prior field */     0x01U,                             /* Number of endpoints used by this                                           interface (excluding endpoint zero). */     USB_AUDIO_CLASS,                   /*The interface implements the Audio Interface class  */     USB_SUBCLASS_AUDIOCONTROL,         /*The interface implements the AUDIOCONTROL Subclass  */     0x00U,                             /*The interface doesn't use any class-specific protocols  */     0x00U,                             /* The device doesn't have a string descriptor describing this iInterface  */       /* Audio Class Specific type of INTERFACE Descriptor */     USB_AUDIO_CONTROL_INTERFACE_HEADER_LENGTH+1,   /* Size of the descriptor, in bytes  */     USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE,      /* CS_INTERFACE Descriptor Type   */     USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_HEADER, /* HEADER descriptor subtype   */     0x00U, 0x01U, /* Audio Device compliant to the USB Audio specification version 1.00  */     0x2A, 0x00U,  /* Total number of bytes returned for the class-specific AudioControl interface descriptor.                      Includes the combined length of this descriptor header and all Unit and Terminal                      descriptors. */     0x02U,        /* The number of AudioStreaming and MIDIStreaming interfaces in the Audio Interface Collection to                      which this AudioControl interface belongs   */     0x01U,        /* The number of AudioStreaming and MIDIStreaming interfaces in the Audio Interface baNumber */   0x02U,        /* The number of AudioStreaming and MIDIStreaming interfaces in the Audio Interface baNumber */       /* Audio Class Specific type of Input Terminal*/     USB_AUDIO_INPUT_TERMINAL_ONLY_DESC_SIZE, /* Size of the descriptor, in bytes  */     USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE,  /* CS_INTERFACE Descriptor Type   */     USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_INPUT_TERMINAL,     /* INPUT_TERMINAL descriptor subtype  */     0x01U,        /* Constant uniquely identifying the Terminal within the audio function. This value is used in all                      requests to address this Terminal.  */     0x01U, 0x01,  /* A USB Streaming.  */     0x00U,        /* This Input Terminal has no association  */     0x02U,        /* This Terminal's output audio channel cluster has 2 logical output channels  */     0x03U, 0x00U, /* Left Front (L) and Right Front (R) */     0x00U,        /* Index of a string descriptor, describing the name of the first logical channel.   */     0x00U,        /* Index of a string descriptor, describing the Input Terminal.   */       /* Audio Class Specific type of Input Terminal*/     USB_AUDIO_INPUT_TERMINAL_ONLY_DESC_SIZE, /* Size of the descriptor, in bytes  */     USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE,  /* CS_INTERFACE Descriptor Type   */     USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_INPUT_TERMINAL,     /* INPUT_TERMINAL descriptor subtype  */     0x02U,        /* Constant uniquely identifying the Terminal within the audio function. This value is used in all                      requests to address this Terminal.  */     0x01U, 0x02,  /* A generic microphone that does not fit under any of the other classifications.  */     0x00U,        /* This Input Terminal has no association  */     0x01U,        /* This Terminal's output audio channel cluster has 1 logical output channels  */     0x00U, 0x00U, /* Mono */     0x00U,        /* Index of a string descriptor, describing the name of the first logical channel.   */     0x00U,        /* Index of a string descriptor, describing the Input Terminal.   */       /* Audio Class Specific type of  Output Terminal */     USB_AUDIO_OUTPUT_TERMINAL_ONLY_DESC_SIZE, /* Size of the descriptor, in bytes  */     USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE,   /* CS_INTERFACE Descriptor Type   */     USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_OUTPUT_TERMINAL,     /* OUTPUT_TERMINAL descriptor subtype  */     0x06,         /* Constant uniquely identifying the Terminal within the audio function*/     0x01U, 0x03U, /* Speaker Interface */     0x00U,        /*  This Output Terminal has no association   */     0x01U,        /* ID of the Unit or Terminal to which this Terminal is connected.   */     0x00U,        /* Index of a string descriptor, describing the Output Terminal.  */       /* Audio Class Specific type of  Output Terminal */     USB_AUDIO_OUTPUT_TERMINAL_ONLY_DESC_SIZE, /* Size of the descriptor, in bytes  */     USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE,   /* CS_INTERFACE Descriptor Type   */     USB_DESCRIPTOR_SUBTYPE_AUDIO_CONTROL_OUTPUT_TERMINAL,     /* OUTPUT_TERMINAL descriptor subtype  */     0x07,         /* Constant uniquely identifying the Terminal within the audio function*/     0x01U, 0x01U, /* A Terminal dealing with a signal carried over an endpoint in an AudioStreaming interface */     0x00U,        /*  This Output Terminal has no association   */     0x02U,        /* ID of the Unit or Terminal to which this Terminal is connected.   */     0x00U,        /* Index of a string descriptor, describing the Output Terminal.  */   // End of Control Section     // Optional Control endpoint....     USB_DESCRIPTOR_LENGTH_AC_INTERRUPT_ENDPOINT, /* Size of this descriptor, in bytes: 9U */     USB_DESCRIPTOR_TYPE_ENDPOINT,                /* ENDPOINT descriptor type */     USB_AUDIO_CONTROL_ENDPOINT | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),     /* Endpoint address */     USB_ENDPOINT_INTERRUPT, /* Transfer type */     USB_SHORT_GET_LOW(FS_INTERRUPT_IN_PACKET_SIZE), USB_SHORT_GET_HIGH(FS_INTERRUPT_IN_PACKET_SIZE),     /* Max Packet Size */     FS_INTERRUPT_IN_INTERVAL, /* Interval */     0, 0,   /* MIC to the Host on the USB Interface */     /* Audio Class Specific INTERFACE Descriptor, alternative interface 0  */     USB_DESCRIPTOR_LENGTH_INTERFACE,  /* Descriptor size is 9 bytes  */     USB_DESCRIPTOR_TYPE_INTERFACE,    /* INTERFACE Descriptor Type   */     USB_AUDIO_STREAM_INTERFACE_INDEX, /* The number of this interface is 1.  */     0x00U,                            /* The value used to select the alternate setting for this interface is 0   */     0x00U,                    /* The number of endpoints used by this interface is 0 (excluding endpoint zero)   */     USB_AUDIO_CLASS,          /* The interface implements the Audio Interface class   */     USB_SUBCLASS_AUDIOSTREAM, /* The interface implements the AUDIOSTREAMING Subclass   */     0x00U,                    /* The interface doesn't use any class-specific protocols   */     0x00U,                    /* The device doesn't have a string descriptor describing this iInterface  */       /* Audio Class Specific INTERFACE Descriptor, alternative interface 1 */     USB_DESCRIPTOR_LENGTH_INTERFACE,  /* Descriptor size is 9 bytes  */     USB_DESCRIPTOR_TYPE_INTERFACE,    /* INTERFACE Descriptor Type  */     USB_AUDIO_STREAM_INTERFACE_INDEX, /*The number of this interface is 1.  */     0x01U,                            /* The value used to select the alternate setting for this interface is 1  */     0x01U,                    /* The number of endpoints used by this interface is 1 (excluding endpoint zero)    */     USB_AUDIO_CLASS,          /* The interface implements the Audio Interface class   */     USB_SUBCLASS_AUDIOSTREAM, /* The interface implements the AUDIOSTREAMING Subclass   */     0x00U,                    /* The interface doesn't use any class-specific protocols  */     0x00U,                    /* The device doesn't have a string descriptor describing this iInterface  */       /* Audio Class Specific CS INTERFACE Descriptor*/     USB_AUDIO_STREAMING_IFACE_DESC_SIZE,            /* Size of the descriptor, in bytes  */     USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE,         /* CS_INTERFACE Descriptor Type  */     USB_DESCRIPTOR_SUBTYPE_AUDIO_STREAMING_GENERAL, /* AS_GENERAL descriptor subtype  */     0x07U,        /* The Terminal ID of the Terminal to which the endpoint of this interface is connected. */     0x00U,        /* Delay introduced by the data path. Expressed in number of frames.  */     0x01U, 0x00U, /* PCM16  */       /* Audio Class Specific type I format INTERFACE Descriptor */     USB_AUDIO_STREAMING_TYPE_I_DESC_SIZE,   /* Size of the descriptor, in bytes  */     USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE, /* CS_INTERFACE Descriptor Type   */     USB_DESCRIPTOR_SUBTYPE_AUDIO_STREAMING_FORMAT_TYPE,     /* FORMAT_TYPE descriptor subtype  */     USB_AUDIO_FORMAT_TYPE_I, /* FORMAT_TYPE_I  */     0x01U,                   /* Indicates the number of physical channels in the audio data stream.  */     0x02U,                   /* The number of bytes occupied by one audio subframe. Can be 1, 2, 3 or 4.   */     0x10U,                   /* The number of effectively used bits from the available bits in an audio subframe.*/     0x01U,                   /* Indicates how the sampling frequency can be programmed:   */     0x40, 0x1F, 0x00U,       /* Sampling frequency 1 in Hz for this isochronous data endpoint.   */       /* ENDPOINT Descriptor */     USB_ENDPOINT_AUDIO_DESCRIPTOR_LENGTH,      /* Descriptor size is 9 bytes  */     USB_DESCRIPTOR_TYPE_ENDPOINT,              /* ENDPOINT Descriptor Type   */     USB_AUDIO_STREAM_ENDPOINT | (USB_IN << 7), /* This is an IN endpoint with endpoint number 2   */     USB_ENDPOINT_ISOCHRONOUS,                  /* Types - Transfer: ISOCHRONOUS */     USB_SHORT_GET_LOW(FS_ISO_IN_ENDP_PACKET_SIZE),     USB_SHORT_GET_HIGH(FS_ISO_IN_ENDP_PACKET_SIZE), /* Maximum packet size for this endpoint is 8 Bytes.  */     ISO_IN_ENDP_INTERVAL, /* The polling interval value is every 1 Frames. If Hi-Speed, every 1 uFrames   */     0x00U,                /* Refresh Rate 2**n ms where n = 0   */     0x00U,                /* Synchronization Endpoint (if used) is endpoint 0   */       /* Audio Class Specific ENDPOINT Descriptor  */     USB_AUDIO_STREAMING_ENDP_DESC_SIZE,      /*  Size of the descriptor, in bytes  */     USB_AUDIO_STREAM_ENDPOINT_DESCRIPTOR,    /* CS_ENDPOINT Descriptor Type  */     USB_AUDIO_EP_GENERAL_DESCRIPTOR_SUBTYPE, /* AUDIO_EP_GENERAL descriptor subtype  */     0x00U,                                   /* Bit 0: Sampling Frequency 0                                                 Bit 1: Pitch 0                                                 Bit 7: MaxPacketsOnly 0   */     0x00U,                                   /* Indicates the units used for the wLockDelay field: 0: Undefined  */     0x00U, 0x00U, /* Indicates the time it takes this endpoint to reliably lock its internal clock recovery                      circuitry */     /* Speaker from the Host on the USB Interface */   /* Audio Class Specific INTERFACE Descriptor, alternative interface 0  */   USB_DESCRIPTOR_LENGTH_INTERFACE,  /* Descriptor size is 9 bytes  */   USB_DESCRIPTOR_TYPE_INTERFACE,    /* INTERFACE Descriptor Type   */   USB_AUDIO_STREAM_OUT_INTERFACE_INDEX, /* The number of this interface is 2.  */   0x00U,                            /* The value used to select the alternate setting for this interface is 0   */   0x00U,                    /* The number of endpoints used by this interface is 0 (excluding endpoint zero)   */   USB_AUDIO_CLASS,          /* The interface implements the Audio Interface class   */   USB_SUBCLASS_AUDIOSTREAM, /* The interface implements the AUDIOSTREAMING Subclass   */   0x00U,                    /* The interface doesn't use any class-specific protocols   */   0x00U,                    /* The device doesn't have a string descriptor describing this iInterface  */     /* Audio Class Specific INTERFACE Descriptor, alternative interface 1 */   USB_DESCRIPTOR_LENGTH_INTERFACE,  /* Descriptor size is 9 bytes  */   USB_DESCRIPTOR_TYPE_INTERFACE,    /* INTERFACE Descriptor Type  */   USB_AUDIO_STREAM_OUT_INTERFACE_INDEX, /*The number of this interface is 2.  */   0x01U,                            /* The value used to select the alternate setting for this interface is 1  */   0x01U,                    /* The number of endpoints used by this interface is 1 (excluding endpoint zero)    */   USB_AUDIO_CLASS,          /* The interface implements the Audio Interface class   */   USB_SUBCLASS_AUDIOSTREAM, /* The interface implements the AUDIOSTREAMING Subclass   */   0x00U,                    /* The interface doesn't use any class-specific protocols  */   0x00U,                    /* The device doesn't have a string descriptor describing this iInterface  */     /* Audio Class Specific CS INTERFACE Descriptor*/   USB_AUDIO_STREAMING_IFACE_DESC_SIZE,            /* Size of the descriptor, in bytes  */   USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE,         /* CS_INTERFACE Descriptor Type  */   USB_DESCRIPTOR_SUBTYPE_AUDIO_STREAMING_GENERAL, /* AS_GENERAL descriptor subtype  */   0x01U,        /* The Terminal ID of the Terminal to which the endpoint of this interface is connected. */   0x00U,        /* Delay introduced by the data path. Expressed in number of frames.  */   0x01U, 0x00U, /* PCM16  */     /* Audio Class Specific type I format INTERFACE Descriptor */   USB_AUDIO_STREAMING_TYPE_I_DESC_SIZE,   /* Size of the descriptor, in bytes  */   USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE, /* CS_INTERFACE Descriptor Type   */   USB_DESCRIPTOR_SUBTYPE_AUDIO_STREAMING_FORMAT_TYPE,   /* FORMAT_TYPE descriptor subtype  */   USB_AUDIO_FORMAT_TYPE_I, /* FORMAT_TYPE_I  */   0x02U,                   /* Indicates the number of physical channels in the audio data stream.  */   0x02U,                   /* The number of bytes occupied by one audio subframe. Can be 1, 2, 3 or 4.   */   0x10U,                   /* The number of effectively used bits from the available bits in an audio subframe.*/   0x01U,                   /* Indicates how the sampling frequency can be programmed:   */   0x40, 0x1F, 0x00U,       /* Sampling frequency 1 in Hz for this isochronous data endpoint.   */     /* ENDPOINT Descriptor */   USB_ENDPOINT_AUDIO_DESCRIPTOR_LENGTH,      /* Descriptor size is 9 bytes  */   USB_DESCRIPTOR_TYPE_ENDPOINT,              /* ENDPOINT Descriptor Type   */   USB_AUDIO_STREAM_OUT_ENDPOINT | (USB_OUT << 7), /* This is an OUT endpoint with endpoint number 2   */   USB_ENDPOINT_ISOCHRONOUS,                  /* Types - Transfer: ISOCHRONOUS */   USB_SHORT_GET_LOW(FS_ISO_IN_ENDP_PACKET_SIZE),   USB_SHORT_GET_HIGH(FS_ISO_IN_ENDP_PACKET_SIZE), /* Maximum packet size for this endpoint is 8 Bytes.  */   ISO_IN_ENDP_INTERVAL, /* The polling interval value is every 1 Frames. If Hi-Speed, every 1 uFrames   */   0x00U,                /* Refresh Rate 2**n ms where n = 0   */   0x00U,                /* Synchronization Endpoint (if used) is endpoint 0   */     /* Audio Class Specific ENDPOINT Descriptor  */   USB_AUDIO_STREAMING_ENDP_DESC_SIZE,      /*  Size of the descriptor, in bytes  */   USB_AUDIO_STREAM_ENDPOINT_DESCRIPTOR,    /* CS_ENDPOINT Descriptor Type  */   USB_AUDIO_EP_GENERAL_DESCRIPTOR_SUBTYPE, /* AUDIO_EP_GENERAL descriptor subtype  */   0x00U,                                   /* Bit 0: Sampling Frequency 0                                                  Bit 1: Pitch 0                                                  Bit 7: MaxPacketsOnly 0   */   0x00U,                                   /* Indicates the units used for the wLockDelay field: 0: Undefined  */   0x00U, 0x00U, /* Indicates the time it takes this endpoint to reliably lock its internal clock recovery                   circuitry */       /* Interface Descriptor */     USB_DESCRIPTOR_LENGTH_INTERFACE, /* Size of this descriptor in bytes */     USB_DESCRIPTOR_TYPE_INTERFACE,   /* INTERFACE Descriptor Type */     0x03,                            /* Number of this interface. */     0x00U,                           /* Value used to select this alternate setting                                         for the interface identified in the prior field */     USB_HID_GAMEPAD_ENDPOINT_COUNT,    /* Number of endpoints used by this                                         interface (excluding endpoint zero). */     USB_HID_GAMEPAD_CLASS,             /* Class code (assigned by the USB-IF). */     USB_HID_GAMEPAD_SUBCLASS,          /* Subclass code (assigned by the USB-IF). */     USB_HID_GAMEPAD_PROTOCOL,          /* Protocol code (assigned by the USB). */     0x00U,                           /* Index of string descriptor describing this interface */       USB_DESCRIPTOR_LENGTH_HID, /* Numeric expression that is the total size of the HID descriptor. */     USB_DESCRIPTOR_TYPE_HID,   /* Constant name specifying type of HID descriptor. */     0x00U, 0x01U,              /* Numeric expression identifying the HID Class Specification release. */     0x00U,                     /* Numeric expression identifying country code of the localized hardware */     0x01U, /* Numeric expression specifying the number of class descriptors(at least one report descriptor) */     USB_DESCRIPTOR_TYPE_HID_REPORT, /* Constant name identifying type of class descriptor. */     USB_SHORT_GET_LOW(USB_DESCRIPTOR_LENGTH_HID_GAMEPAD_REPORT),     USB_SHORT_GET_HIGH(USB_DESCRIPTOR_LENGTH_HID_GAMEPAD_REPORT),     /* Numeric expression that is the total size of the Report descriptor. */     USB_DESCRIPTOR_LENGTH_ENDPOINT, /* Size of this descriptor in bytes */     USB_DESCRIPTOR_TYPE_ENDPOINT,   /* ENDPOINT Descriptor Type */     USB_HID_GAMEPAD_ENDPOINT | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),     /* The address of the endpoint on the USB device        described by this descriptor. */     USB_ENDPOINT_INTERRUPT, /* This field describes the endpoint's attributes */     USB_SHORT_GET_LOW(FS_INTERRUPT_IN_PACKET_SIZE),     USB_SHORT_GET_HIGH(FS_INTERRUPT_IN_PACKET_SIZE), /* Maximum packet size this endpoint is capable of                                                         sending or receiving when this configuration is selected. */     FS_INTERRUPT_IN_INTERVAL,                        /* Interval for polling endpoint for data transfers. */ };

 

Thanks for the help.

Andrew

Outcomes