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

IN/OUT streaming interfaces.

Could you help teach me, how to add a microphone input to this usb audio code.

MCB1700 Sample Code Bundle for LPC17xx Peripherals using Keil's MDK-ARM V2.00 (Jan 10, 2011)
ics.nxp.com/.../mcb1700.code.bundle.lpc17xx.keil.zip

Could we start with the usbuser.c file and the changes that must be made,

thankyou.

Parents
  • /* Interface 1, Alternate Setting 1, Audio Streaming - Operational */
      USB_INTERFACE_DESC_SIZE,              /* bLength */
      USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
      0x01,                                 /* bInterfaceNumber */
      0x01,                                 /* bAlternateSetting */
      0x01,                                 /* bNumEndpoints */
      USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
      AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
      AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
      0x00,                                 /* iInterface */
    /* Audio Streaming Interface */
      AUDIO_STREAMING_INTERFACE_DESC_SIZE,  /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_STREAMING_GENERAL,              /* bDescriptorSubtype */
      0x01,                                 /* bTerminalLink */
      0x00,                                 /* bDelay */
      WBVAL(AUDIO_FORMAT_PCM),              /* wFormatTag */
    /* Audio Type I Format */
      AUDIO_FORMAT_TYPE_I_DESC_SZ(1),       /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_STREAMING_FORMAT_TYPE,          /* bDescriptorSubtype */
      AUDIO_FORMAT_TYPE_I,                  /* bFormatType */
      0x01,                                 /* bNrChannels */
      0x02,                                 /* bSubFrameSize */
      16,                                   /* bBitResolution */
      0x01,                                 /* bSamFreqType */
      B3VAL(32000),                         /* tSamFreq */
      /* Endpoint - Standard Descriptor */
      AUDIO_STANDARD_ENDPOINT_DESC_SIZE,    /* bLength */
      USB_ENDPOINT_DESCRIPTOR_TYPE,         /* bDescriptorType */
      USB_ENDPOINT_OUT(3),                  /* bEndpointAddress */
      USB_ENDPOINT_TYPE_ISOCHRONOUS,         /* bmAttributes */
      WBVAL(66),                            /* wMaxPacketSize */
      0x01,                                 /* bInterval */
      0x00,                                 /* bRefresh */
      0x00,                                 /* bSynchAddress */
    /* Endpoint - Audio Streaming */
      AUDIO_STREAMING_ENDPOINT_DESC_SIZE,   /* bLength */
      AUDIO_ENDPOINT_DESCRIPTOR_TYPE,       /* bDescriptorType */
      AUDIO_ENDPOINT_GENERAL,               /* bDescriptor */
      0x00,                                 /* bmAttributes */
      0x00,                                 /* bLockDelayUnits */
      WBVAL(0x0000),                        /* wLockDelay */
    
      /* Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith
      USB_INTERFACE_DESC_SIZE,              /* bLength */
      USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
      0x02,                                 /* bInterfaceNumber */
      0x00,                                 /* bAlternateSetting */
      0x00,                                 /* bNumEndpoints */
      USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
      AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
      AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
      0x00,                                 /* iInterface */
      /* Interface 1, Alternate Setting 1, Audio Streaming - Operational
      USB_INTERFACE_DESC_SIZE,              /* bLength */
      USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
      0x02,                                 /* bInterfaceNumber */
      0x01,                                 /* bAlternateSetting */
      0x01,                                 /* bNumEndpoints */
      USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
      AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
      AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
      0x00,                                 /* iInterface */
      /* Audio Streaming Interface */
      AUDIO_STREAMING_INTERFACE_DESC_SIZE,  /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_SUBCLASS_AUDIOCONTROL,          /* bDescriptorSubtype */
      0x05,                                 /* bTerminalLink */      (output terminal microphone)
      0x01,                                 /* bDelay */
      WBVAL(AUDIO_FORMAT_PCM),              /* wFormatTag */
      /* Audio Type I Format */
      AUDIO_FORMAT_TYPE_I_DESC_SZ(1),       /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_SUBCLASS_AUDIOSTREAMING ,          /* bDescriptorSubtype */
      AUDIO_FORMAT_TYPE_I,                  /* bFormatType */
      0x01,                                 /* bNrChannels */
      0x02,                                 /* bSubFrameSize */
      16,                                   /* bBitResolution */
      0x01,                                 /* bSamFreqType */
      B3VAL(32000),                         /* tSamFreq */
      /* Endpoint - Standard Descriptor */
      AUDIO_STANDARD_ENDPOINT_DESC_SIZE,    /* bLength */
      USB_ENDPOINT_DESCRIPTOR_TYPE,         /* bDescriptorType */
      USB_ENDPOINT_IN(3),                  /* bEndpointAddress */
      USB_ENDPOINT_TYPE_ISOCHRONOUS,         /* bmAttributes */
      WBVAL(66),                            /* wMaxPacketSize */
      0x01,                                 /* bInterval */
      0x00,                                 /* bRefresh */
      0x00,                                 /* bSynchAddress */
      /* Endpoint - Audio Streaming */
      AUDIO_STREAMING_ENDPOINT_DESC_SIZE,   /* bLength */
      AUDIO_ENDPOINT_DESCRIPTOR_TYPE,       /* bDescriptorType */
      AUDIO_ENDPOINT_GENERAL,               /* bDescriptor */
      0x00,                                 /* bmAttributes */
      0x00,                                 /* bLockDelayUnits */
      WBVAL(0x0000),                        /* wLockDelay */
    
    /* Terminator */
      0                                     /* bLength */
    };
    
    /* USB String Descriptor (optional) */
    const uint8_t USB_StringDescriptor[] = {
    /* Index 0x00: LANGID Codes */
      0x04,                              /* bLength */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      WBVAL(0x0409), /* US English */    /* wLANGID */
    /* Index 0x01: Manufacturer */
      (13*2 + 2),                        /* bLength (13 Char + Type + lenght) */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      'N',0,
      'X',0,
      'P',0,
      ' ',0,
      'S',0,
      'e',0,
      'm',0,
      'i',0,
      'c',0,
      'o',0,
      'n',0,
      'd',0,
      ' ',0,
    /* Index 0x02: Product */
      (20*2 + 2),                        /* bLength ( 20 Char + Type + lenght) */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      'N',0,
      'X',0,
      'P',0,
      ' ',0,
      'L',0,
      'P',0,
      'C',0,
      '1',0,
      '7',0,
      'x',0,
      'x',0,
      ' ',0,
      'S',0,
      'p',0,
      'e',0,
      'a',0,
      'k',0,
      'e',0,
      'r',0,
      ' ',0,
    /* Index 0x03: Serial Number */
      (12*2 + 2),                        /* bLength (12 Char + Type + lenght) */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      'D',0,
      'E',0,
      'M',0,
      'O',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
    };
    

Reply
  • /* Interface 1, Alternate Setting 1, Audio Streaming - Operational */
      USB_INTERFACE_DESC_SIZE,              /* bLength */
      USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
      0x01,                                 /* bInterfaceNumber */
      0x01,                                 /* bAlternateSetting */
      0x01,                                 /* bNumEndpoints */
      USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
      AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
      AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
      0x00,                                 /* iInterface */
    /* Audio Streaming Interface */
      AUDIO_STREAMING_INTERFACE_DESC_SIZE,  /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_STREAMING_GENERAL,              /* bDescriptorSubtype */
      0x01,                                 /* bTerminalLink */
      0x00,                                 /* bDelay */
      WBVAL(AUDIO_FORMAT_PCM),              /* wFormatTag */
    /* Audio Type I Format */
      AUDIO_FORMAT_TYPE_I_DESC_SZ(1),       /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_STREAMING_FORMAT_TYPE,          /* bDescriptorSubtype */
      AUDIO_FORMAT_TYPE_I,                  /* bFormatType */
      0x01,                                 /* bNrChannels */
      0x02,                                 /* bSubFrameSize */
      16,                                   /* bBitResolution */
      0x01,                                 /* bSamFreqType */
      B3VAL(32000),                         /* tSamFreq */
      /* Endpoint - Standard Descriptor */
      AUDIO_STANDARD_ENDPOINT_DESC_SIZE,    /* bLength */
      USB_ENDPOINT_DESCRIPTOR_TYPE,         /* bDescriptorType */
      USB_ENDPOINT_OUT(3),                  /* bEndpointAddress */
      USB_ENDPOINT_TYPE_ISOCHRONOUS,         /* bmAttributes */
      WBVAL(66),                            /* wMaxPacketSize */
      0x01,                                 /* bInterval */
      0x00,                                 /* bRefresh */
      0x00,                                 /* bSynchAddress */
    /* Endpoint - Audio Streaming */
      AUDIO_STREAMING_ENDPOINT_DESC_SIZE,   /* bLength */
      AUDIO_ENDPOINT_DESCRIPTOR_TYPE,       /* bDescriptorType */
      AUDIO_ENDPOINT_GENERAL,               /* bDescriptor */
      0x00,                                 /* bmAttributes */
      0x00,                                 /* bLockDelayUnits */
      WBVAL(0x0000),                        /* wLockDelay */
    
      /* Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith
      USB_INTERFACE_DESC_SIZE,              /* bLength */
      USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
      0x02,                                 /* bInterfaceNumber */
      0x00,                                 /* bAlternateSetting */
      0x00,                                 /* bNumEndpoints */
      USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
      AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
      AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
      0x00,                                 /* iInterface */
      /* Interface 1, Alternate Setting 1, Audio Streaming - Operational
      USB_INTERFACE_DESC_SIZE,              /* bLength */
      USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
      0x02,                                 /* bInterfaceNumber */
      0x01,                                 /* bAlternateSetting */
      0x01,                                 /* bNumEndpoints */
      USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
      AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
      AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
      0x00,                                 /* iInterface */
      /* Audio Streaming Interface */
      AUDIO_STREAMING_INTERFACE_DESC_SIZE,  /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_SUBCLASS_AUDIOCONTROL,          /* bDescriptorSubtype */
      0x05,                                 /* bTerminalLink */      (output terminal microphone)
      0x01,                                 /* bDelay */
      WBVAL(AUDIO_FORMAT_PCM),              /* wFormatTag */
      /* Audio Type I Format */
      AUDIO_FORMAT_TYPE_I_DESC_SZ(1),       /* bLength */
      AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
      AUDIO_SUBCLASS_AUDIOSTREAMING ,          /* bDescriptorSubtype */
      AUDIO_FORMAT_TYPE_I,                  /* bFormatType */
      0x01,                                 /* bNrChannels */
      0x02,                                 /* bSubFrameSize */
      16,                                   /* bBitResolution */
      0x01,                                 /* bSamFreqType */
      B3VAL(32000),                         /* tSamFreq */
      /* Endpoint - Standard Descriptor */
      AUDIO_STANDARD_ENDPOINT_DESC_SIZE,    /* bLength */
      USB_ENDPOINT_DESCRIPTOR_TYPE,         /* bDescriptorType */
      USB_ENDPOINT_IN(3),                  /* bEndpointAddress */
      USB_ENDPOINT_TYPE_ISOCHRONOUS,         /* bmAttributes */
      WBVAL(66),                            /* wMaxPacketSize */
      0x01,                                 /* bInterval */
      0x00,                                 /* bRefresh */
      0x00,                                 /* bSynchAddress */
      /* Endpoint - Audio Streaming */
      AUDIO_STREAMING_ENDPOINT_DESC_SIZE,   /* bLength */
      AUDIO_ENDPOINT_DESCRIPTOR_TYPE,       /* bDescriptorType */
      AUDIO_ENDPOINT_GENERAL,               /* bDescriptor */
      0x00,                                 /* bmAttributes */
      0x00,                                 /* bLockDelayUnits */
      WBVAL(0x0000),                        /* wLockDelay */
    
    /* Terminator */
      0                                     /* bLength */
    };
    
    /* USB String Descriptor (optional) */
    const uint8_t USB_StringDescriptor[] = {
    /* Index 0x00: LANGID Codes */
      0x04,                              /* bLength */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      WBVAL(0x0409), /* US English */    /* wLANGID */
    /* Index 0x01: Manufacturer */
      (13*2 + 2),                        /* bLength (13 Char + Type + lenght) */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      'N',0,
      'X',0,
      'P',0,
      ' ',0,
      'S',0,
      'e',0,
      'm',0,
      'i',0,
      'c',0,
      'o',0,
      'n',0,
      'd',0,
      ' ',0,
    /* Index 0x02: Product */
      (20*2 + 2),                        /* bLength ( 20 Char + Type + lenght) */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      'N',0,
      'X',0,
      'P',0,
      ' ',0,
      'L',0,
      'P',0,
      'C',0,
      '1',0,
      '7',0,
      'x',0,
      'x',0,
      ' ',0,
      'S',0,
      'p',0,
      'e',0,
      'a',0,
      'k',0,
      'e',0,
      'r',0,
      ' ',0,
    /* Index 0x03: Serial Number */
      (12*2 + 2),                        /* bLength (12 Char + Type + lenght) */
      USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
      'D',0,
      'E',0,
      'M',0,
      'O',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
    };
    

Children
No data