2022-02-26 08:37 AM
I am trying to send 1023 bytes every 1 ms using isochronous channel, but the maximum I can achieve is 512 bytes. If I try to increase to 1023 I see in wireshark only 199 bytes, but until 512 bytes it works fine. Does anyone know how to configure to get the maximum out? My descriptor is configured like this:
USBD_AUDIO_CfgDesc[index++] = 0x09; /* bLength */
USBD_AUDIO_CfgDesc[index++] = 0x02; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = ((USB_AUDIO_CONFIG_DESC_SIZ) & 0xff); /* wTotalLength */
USBD_AUDIO_CfgDesc[index++] = ((USB_AUDIO_CONFIG_DESC_SIZ) >> 8);
USBD_AUDIO_CfgDesc[index++] = 0x02; /* bNumInterfaces */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bConfigurationValue */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* iConfiguration */
USBD_AUDIO_CfgDesc[index++] = 0x80; /* bmAttributes BUS Powered*/
USBD_AUDIO_CfgDesc[index++] = 0x32; /* bMaxPower = 100 mA*/
/* USB Microphone Standard interface descriptor */
USBD_AUDIO_CfgDesc[index++] = 9; /* bLength */
USBD_AUDIO_CfgDesc[index++] = USB_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bInterfaceNumber */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bAlternateSetting */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bNumEndpoints */
USBD_AUDIO_CfgDesc[index++] = USB_DEVICE_CLASS_AUDIO; /* bInterfaceClass */
USBD_AUDIO_CfgDesc[index++] = AUDIO_SUBCLASS_AUDIOCONTROL; /* bInterfaceSubClass */
USBD_AUDIO_CfgDesc[index++] = AUDIO_PROTOCOL_UNDEFINED; /* bInterfaceProtocol */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* iInterface */
/* USB Microphone Class-specific AC Interface Descriptor */
USBD_AUDIO_CfgDesc[index++] = 9; /* bLength */
USBD_AUDIO_CfgDesc[index++] = AUDIO_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_CONTROL_HEADER; /* bDescriptorSubtype */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* 1.00 *//* bcdADC */
USBD_AUDIO_CfgDesc[index++] = 0x01;
USBD_AUDIO_CfgDesc[index++] = 0x25 + Channels; /* wTotalLength = 37+AUDIO_CHANNELS*/
USBD_AUDIO_CfgDesc[index++] = 0x00;
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bInCollection */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* baInterfaceNr */
/* USB Microphone Input Terminal Descriptor */
USBD_AUDIO_CfgDesc[index++] = AUDIO_INPUT_TERMINAL_DESC_SIZE; /* bLength */
USBD_AUDIO_CfgDesc[index++] = AUDIO_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_CONTROL_INPUT_TERMINAL; /* bDescriptorSubtype */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bTerminalID */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* wTerminalType AUDIO_TERMINAL_USB_MICROPHONE 0x0201 */
USBD_AUDIO_CfgDesc[index++] = 0x02;
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bAssocTerminal */
USBD_AUDIO_CfgDesc[index++] = Channels; /* bNrChannels */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* wChannelConfig 0x0000 Mono */
USBD_AUDIO_CfgDesc[index++] = 0x00;
USBD_AUDIO_CfgDesc[index++] = 0x00; /* iChannelNames */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* iTerminal */
/* USB Microphone Audio Feature Unit Descriptor */
USBD_AUDIO_CfgDesc[index++] = 0x07 + Channels + 1; /* bLength */
USBD_AUDIO_CfgDesc[index++] = AUDIO_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_CONTROL_FEATURE_UNIT; /* bDescriptorSubtype */
USBD_AUDIO_CfgDesc[index++] = 0x02; /* bUnitID */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bSourceID */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bControlSize */
USBD_AUDIO_CfgDesc[index++] = (FEATURE_VOLUME | FEATURE_GRAPHIC_EQ);
USBD_AUDIO_CfgDesc[index++] = 0x00;
USBD_AUDIO_CfgDesc[index++] = 0x00; /* iTerminal */
/*USB Microphone Output Terminal Descriptor */
USBD_AUDIO_CfgDesc[index++] = 0x09; /* bLength */
USBD_AUDIO_CfgDesc[index++] = AUDIO_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_CONTROL_OUTPUT_TERMINAL; /* bDescriptorSubtype */
USBD_AUDIO_CfgDesc[index++] = 0x03; /* bTerminalID */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* wTerminalType AUDIO_TERMINAL_USB_STREAMING 0x0101*/
USBD_AUDIO_CfgDesc[index++] = 0x01;
USBD_AUDIO_CfgDesc[index++] = 0x00;
USBD_AUDIO_CfgDesc[index++] = 0x02;
USBD_AUDIO_CfgDesc[index++] = 0x00;
/* USB Microphone Standard AS Interface Descriptor - Audio Streaming Zero Bandwith */
/* Interface 1, Alternate Setting 0 */
USBD_AUDIO_CfgDesc[index++] = 9; /* bLength */
USBD_AUDIO_CfgDesc[index++] = USB_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bInterfaceNumber */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bAlternateSetting */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bNumEndpoints */
USBD_AUDIO_CfgDesc[index++] = USB_DEVICE_CLASS_AUDIO; /* bInterfaceClass */
USBD_AUDIO_CfgDesc[index++] = AUDIO_SUBCLASS_AUDIOSTREAMING; /* bInterfaceSubClass */
USBD_AUDIO_CfgDesc[index++] = AUDIO_PROTOCOL_UNDEFINED; /* bInterfaceProtocol */
USBD_AUDIO_CfgDesc[index++] = 0x00;
/* USB Microphone Standard AS Interface Descriptor - Audio Streaming Operational */
/* Interface 1, Alternate Setting 1 */
USBD_AUDIO_CfgDesc[index++] = 9; /* bLength */
USBD_AUDIO_CfgDesc[index++] = USB_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bInterfaceNumber */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bAlternateSetting */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bNumEndpoints */
USBD_AUDIO_CfgDesc[index++] = USB_DEVICE_CLASS_AUDIO; /* bInterfaceClass */
USBD_AUDIO_CfgDesc[index++] = AUDIO_SUBCLASS_AUDIOSTREAMING; /* bInterfaceSubClass */
USBD_AUDIO_CfgDesc[index++] = AUDIO_PROTOCOL_UNDEFINED; /* bInterfaceProtocol */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* iInterface */
/* USB Microphone Audio Streaming Interface Descriptor */
USBD_AUDIO_CfgDesc[index++] = AUDIO_STREAMING_INTERFACE_DESC_SIZE; /* bLength */
USBD_AUDIO_CfgDesc[index++] = AUDIO_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_STREAMING_GENERAL; /* bDescriptorSubtype */
USBD_AUDIO_CfgDesc[index++] = 0x03; /* bTerminalLink */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bDelay */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* wFormatTag AUDIO_FORMAT_PCM 0x0001*/
USBD_AUDIO_CfgDesc[index++] = 0x00;
/* USB Microphone Audio Type I Format Interface Descriptor */
USBD_AUDIO_CfgDesc[index++] = 0x0B; /* bLength */
USBD_AUDIO_CfgDesc[index++] = AUDIO_INTERFACE_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_STREAMING_FORMAT_TYPE; /* bDescriptorSubtype */
USBD_AUDIO_CfgDesc[index++] = AUDIO_FORMAT_TYPE_I; /* bFormatType */
USBD_AUDIO_CfgDesc[index++] = Channels; /* bNrChannels */
USBD_AUDIO_CfgDesc[index++] = 0x02; /* bSubFrameSize */
USBD_AUDIO_CfgDesc[index++] = 16; /* bBitResolution */
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bSamFreqType */
USBD_AUDIO_CfgDesc[index++] = samplingFrequency & 0xff; /* tSamFreq 8000 = 0x1F40 */
USBD_AUDIO_CfgDesc[index++] = (samplingFrequency >> 8) & 0xff;
USBD_AUDIO_CfgDesc[index++] = samplingFrequency >> 16;
/* Endpoint 1 - Standard Descriptor */
USBD_AUDIO_CfgDesc[index++] = AUDIO_STANDARD_ENDPOINT_DESC_SIZE; /* bLength */
USBD_AUDIO_CfgDesc[index++] = 0x05; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_IN_EP; /* bEndpointAddress 1 in endpoint*/
USBD_AUDIO_CfgDesc[index++] = 0x05; /* bmAttributes */
USBD_AUDIO_CfgDesc[index++] = (1023) & 0xFF; /* wMaxPacketSize */
USBD_AUDIO_CfgDesc[index++] = (1023) >> 8;
USBD_AUDIO_CfgDesc[index++] = 0x01; /* bInterval */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bRefresh */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bSynchAddress */
/* Endpoint - Audio Streaming Descriptor*/
USBD_AUDIO_CfgDesc[index++] = AUDIO_STREAMING_ENDPOINT_DESC_SIZE; /* bLength */
USBD_AUDIO_CfgDesc[index++] = AUDIO_ENDPOINT_DESCRIPTOR_TYPE; /* bDescriptorType */
USBD_AUDIO_CfgDesc[index++] = AUDIO_ENDPOINT_GENERAL; /* bDescriptor */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bmAttributes */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* bLockDelayUnits */
USBD_AUDIO_CfgDesc[index++] = 0x00; /* wLockDelay */
USBD_AUDIO_CfgDesc[index++] = 0x00;