This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB descriptor for stereo recorder

Hi all,

I am implementing a stereo recroder application. The application should send the recorded data
over USB to host application (e.g. Audacity,).
I succeeded to make the recorder to "record" propperly and now I am stuck at USB communcation and specifically at USB descriptor.
I started from the example provided in Audio spec appendix B "USB microphone" (page 105) and I am trying to make it stereo channel and 48KHz but I get at windows I got error code = 10.
Here below the descriptor. Can you tell me where I can find the error?

u8 Descritpr[100] =
{ 0x09, /* bLength */

USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */

LOBYTE(AUDIO_CONFIG_DESC_SIZE), /* wTotalLength */

HIBYTE(AUDIO_CONFIG_DESC_SIZE),

0x02, /* bNumInterfaces */

0x01, /* bConfigurationValue */

0x00, /* iConfiguration */

0x80, /* bmAttributes BUS Powred*/

0x0A, /* bMaxPower = 100 mA*/

/* USB Speaker Standard AC Interface descriptor */

0x09,

0x04,

0x00,

0x00,

0x00,

0x01,

0x01,

0x00,

0x00,

/* Class specific AC interface descriptor */ 0x09,

0x24,

0x01,

0x00,/* bcdADC */

0x01,

0x1E,/* wTotalLength */

0x00,

0x01, /* bInCollection */

0x01, /* baInterfaceNr(1) */

/* Input Terminal Descriptor */

0x0C, /* bLength */

0x24, /* bDescriptorType */

0x02, /* bDescriptorSubType */

0x01, /* bTerminalID */

0x01, /* wTerminalType */

0x02, /* wTerminalType */

0x00, /* bAssocTerminal */

0x01, /* bNrChannels */

0x00, /* wChannelConfig */

0x00, /* wChannelConfig */

0x00, /* iChannelName */

0x00, /* iTerminal */

/* Output Terminal Descriptor */

0x09, /* bLength */

0x24, /* bDescriptorType */

0x03, /* bDescriptorSubType */

0x02, /* bTerminalID */

0x01, /* wTerminalType */

0x01, /* wTerminalType */

0x00, /* bAssocTerminal */

0x01, /* bNrChannels */

0x00, /* wChannelConfig */

/* Standard AS Interface Descriptor (Alt. Set. 0) */

0x09, /* bLength */

0x04, /* bDescriptorType */

0x01, /* bInterfaceNum */

0x00, /* bAlternateSetting */

0x00, /* bNumEndpoints */

0x01, /* bInterfaceClass */

0x02, /* bInterfaceSubClass */

0x00, /* bInterfaceProtocol */

0x00, /* iInterface */

/* Standard AS Interface Descriptor (Alt. Set. 1) */

0x09, /* bLength */

0x04, /* bDescriptorType */

0x01, /* bInterfaceNum */

0x01, /* bAlternateSetting */

0x01, /* bNumEndpoints */

0x01, /* bInterfaceClass */

0x02, /* bInterfaceSubClass */

0x00, /* bInterfaceProtocol */

0x00, /* iInterface */

/* Class specific AS General Interface Descriptor */

0x07, /* bLength */

0x24, /* bDescriptorType */

0x01, /* bDescriptorSubType */

0x02, /* bTerminalLink */

0x01, /* bDelay */

0x01, /* wFormatTag */

0x00, /* wFormatTag */

/* Foramt Type Descriptor */

0x0B,

0x24,

0x02,

0x01,

0x01,

0x02,

0x10,

0x01,

0x40,

0x1F,

0x00,

/* Endpoint Descriptor */

0x09, /* bLength */

0x05, /* bDescriptorType */

0x83, /* bEndpointAddress */

0x01, /* bmAttributes */

0x10, /* wMaxPacketSize */

0x00, /* wMaxPacketSize */

0x01, /* bInterval */

0x00, /* bRefresh */

0x00, /* bSynchAddress */

/* Audio Data Endpoint Descriptor */

0x07,

0x25,

0x01,

0x00,

0x00,

0x00,

0x00,
};

  • /* Input Terminal Descriptor */
    0x0C, /* bLength */
    0x24, /* bDescriptorType */
    0x02, /* bDescriptorSubType */
    0x01, /* bTerminalID */
    0x01, /* wTerminalType */
    0x02, /* wTerminalType */
    0x00, /* bAssocTerminal */
    0x01, /* bNrChannels */      // <---- 0x02,  // two channels
    0x00, /* wChannelConfig */   // <---- 0x03,  // left front / right front
    0x00, /* wChannelConfig */
    0x00, /* iChannelName */
    0x00, /* iTerminal */
    
    
    /* Format Type Descriptor */
    0x0B,
    0x24,
    0x02,
    0x01,
    0x01,     /* bNrChannels */  // <---- 0x02, //Two channels
    0x02
    0x10,
    0x01,
    0x40,
    0x1F,
    0x00,
    
    
    /* Endpoint Descriptor */
    0x09, /* bLength */
    0x05, /* bDescriptorType */
    0x83, /* bEndpointAddress */
    0x01, /* bmAttributes */     // <---- 0x05,  // isoc, Asynchronous
    0x10, /* wMaxPacketSize */   // <---- 0x24,  // 36 bytes (2 bytes/ch * 2 ch * (8 + 1) samples / frame)
    0x00, /* wMaxPacketSize */
    0x01, /* bInterval */
    0x00, /* bRefresh */
    0x00, /* bSynchAddress */
    

    Tsuneo

  • Ah, missed at these requirement,
    > send the recorded data
    > stereo channel and 48KHz

    Ah, recorded data, instead of "real-time" microphone. Then Synchronous is better.

    /* Input Terminal Descriptor */
    0x0C, /* bLength */
    0x24, /* bDescriptorType */
    0x02, /* bDescriptorSubType */
    0x01, /* bTerminalID */
    0x01, /* wTerminalType */
    0x02, /* wTerminalType */
    0x00, /* bAssocTerminal */
    0x01, /* bNrChannels */      // <---- 0x02,  // two channels
    0x00, /* wChannelConfig */   // <---- 0x03,  // left front / right front
    0x00, /* wChannelConfig */
    0x00, /* iChannelName */
    0x00, /* iTerminal */
    
    
    /* Format Type Descriptor */
    0x0B,
    0x24,
    0x02,
    0x01,
    0x01,     /* bNrChannels */  // <---- 0x02, //Two channels
    0x02
    0x10,
    0x01,
    0x40,     /*tSamFreq[0] */   // <---- 0x80,  // 48 kHz
    0x1F,                        // <---- 0xBB,
    0x00,
    
    
    /* Endpoint Descriptor */
    0x09, /* bLength */
    0x05, /* bDescriptorType */
    0x83, /* bEndpointAddress */
    0x01, /* bmAttributes */     // <---- 0x0D,  // isoc, Synchronous
    0x10, /* wMaxPacketSize */   // <---- 0xC0,  // 192 bytes (2 bytes/ch * 2 ch * 48 samples / frame)
    0x00, /* wMaxPacketSize */
    0x01, /* bInterval */
    0x00, /* bRefresh */
    0x00, /* bSynchAddress */
    
    /* Audio Data Endpoint Descriptor */
    0x07,
    0x25,
    0x01,
    0x00,
    0x00, /* bLockDelayUnits */  // <---- 0x02,  // Decoded PCM samples
    0x00,
    0x00,
    

    Tsuneo