This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB CDC ACM with AUDIO class on Windows

I have successfully been using USB CDC ACM class alongside USB Audio with only a MIC feature available on Mac OS. However, on Windows, only USB CDC ACM enumerates in Device Manager. The Audio class enumerates with a failure "Device USB\VID****** had a problem starting". Any ideas what could be causing this discrepancy?

Parents
  • my code with the addition of IAD in the file "app_usbd_audio.c" not work (no usb audio device in windows):

    #define USBD_AUDIO_CLASS				0x01
    #define USBD_AUDIO_SUBCLASS_CONTROL			0x01
    #define USBD_AUDIO_PROTOCOL_UNDEFINED			0x00
    #define USBD_DSC_TYPE_INTERFACE_ASSOCIATION		0x0B
    
    static bool audio_feed_descriptors(app_usbd_class_descriptor_ctx_t * p_ctx,
                                       app_usbd_class_inst_t const     * p_inst,
                                       uint8_t                         * p_buff,
                                       size_t                            max_size)
    {
        static uint8_t ifaces   = 0;
        ifaces = app_usbd_class_iface_count_get(p_inst);
        ASSERT(ifaces == 2);
        app_usbd_audio_t const * p_audio = audio_get(p_inst);
    //**
        static app_usbd_class_iface_conf_t const * p_cur_iface = NULL;
        p_cur_iface = app_usbd_class_iface_get(p_inst, 0);
    //**
    
        APP_USBD_CLASS_DESCRIPTOR_BEGIN(p_ctx, p_buff, max_size);
    
        //********** IA insert ******************
    
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x08); // bLength
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_DSC_TYPE_INTERFACE_ASSOCIATION);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_number_get(p_cur_iface));
        APP_USBD_CLASS_DESCRIPTOR_WRITE(2);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_CLASS);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_SUBCLASS_CONTROL);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_PROTOCOL_UNDEFINED);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00);
    
        //*****************************************
    
        /* CONTROL INTERFACE DESCRIPTOR */
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x09); // bLength
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_DESCRIPTOR_INTERFACE); // bDescriptorType = Interface
    
    //    static app_usbd_class_iface_conf_t const * p_cur_iface = NULL;
    //    p_cur_iface = app_usbd_class_iface_get(p_inst, 0);
    
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_number_get(p_cur_iface)); // bInterfaceNumber
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00); // bAlternateSetting
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_ep_count_get(p_cur_iface)); // bNumEndpoints
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_CLASS); // bInterfaceClass = Audio
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_SUBCLASS_AUDIOCONTROL); // bInterfaceSubclass (Audio Control)
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_CLASS_PROTOCOL_UNDEFINED); // bInterfaceProtocol
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00); // iInterface
    
        /* HEADER INTERFACE */

  • It works, I give the working code for nrf82540 and SDK v17b maybe it will help someone (to create a composite USB device USB AUDIO + CDC ACM, you need to add a descriptor  an "INTERFACE_ASSOCIATION DESCRIPTOR" (IAD) just before the "INTERFACE DESCRIPTOR" in the file "app_usbd_audio.c", in the function audio_feed_descriptors() at line 675,  for the AudioClass Control Interface):

    #define USBD_AUDIO_CLASS				0x01
    #define USBD_AUDIO_SUBCLASS_CONTROL			0x01
    #define USBD_AUDIO_PROTOCOL_UNDEFINED			0x00
    #define USBD_DSC_TYPE_INTERFACE_ASSOCIATION		0x0B
    
    static bool audio_feed_descriptors(app_usbd_class_descriptor_ctx_t * p_ctx,
                                       app_usbd_class_inst_t const     * p_inst,
                                       uint8_t                         * p_buff,
                                       size_t                            max_size)
    {
        static uint8_t ifaces   = 0;
        ifaces = app_usbd_class_iface_count_get(p_inst);
        ASSERT(ifaces == 2);
        app_usbd_audio_t const * p_audio = audio_get(p_inst);
    
        APP_USBD_CLASS_DESCRIPTOR_BEGIN(p_ctx, p_buff, max_size);
    
        static app_usbd_class_iface_conf_t const * p_cur_iface = NULL;
        p_cur_iface = app_usbd_class_iface_get(p_inst, 0);
    
        //********** IA insert ******************
    
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x08); // bLength
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_DSC_TYPE_INTERFACE_ASSOCIATION);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_number_get(p_cur_iface));
        APP_USBD_CLASS_DESCRIPTOR_WRITE(ifaces);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_CLASS);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_SUBCLASS_CONTROL);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_PROTOCOL_UNDEFINED);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00);
    
        //*****************************************
    
        /* CONTROL INTERFACE DESCRIPTOR */
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x09); // bLength
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_DESCRIPTOR_INTERFACE); // bDescriptorType = Interface
    
      //  static app_usbd_class_iface_conf_t const * p_cur_iface = NULL;
     //   p_cur_iface = app_usbd_class_iface_get(p_inst, 0);
    
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_number_get(p_cur_iface)); // bInterfaceNumber
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00); // bAlternateSetting
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_ep_count_get(p_cur_iface)); // bNumEndpoints
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_CLASS); // bInterfaceClass = Audio
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_SUBCLASS_AUDIOCONTROL); // bInterfaceSubclass (Audio Control)
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_CLASS_PROTOCOL_UNDEFINED); // bInterfaceProtocol
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00); // iInterface
    
        /* HEADER INTERFACE */
    

Reply
  • It works, I give the working code for nrf82540 and SDK v17b maybe it will help someone (to create a composite USB device USB AUDIO + CDC ACM, you need to add a descriptor  an "INTERFACE_ASSOCIATION DESCRIPTOR" (IAD) just before the "INTERFACE DESCRIPTOR" in the file "app_usbd_audio.c", in the function audio_feed_descriptors() at line 675,  for the AudioClass Control Interface):

    #define USBD_AUDIO_CLASS				0x01
    #define USBD_AUDIO_SUBCLASS_CONTROL			0x01
    #define USBD_AUDIO_PROTOCOL_UNDEFINED			0x00
    #define USBD_DSC_TYPE_INTERFACE_ASSOCIATION		0x0B
    
    static bool audio_feed_descriptors(app_usbd_class_descriptor_ctx_t * p_ctx,
                                       app_usbd_class_inst_t const     * p_inst,
                                       uint8_t                         * p_buff,
                                       size_t                            max_size)
    {
        static uint8_t ifaces   = 0;
        ifaces = app_usbd_class_iface_count_get(p_inst);
        ASSERT(ifaces == 2);
        app_usbd_audio_t const * p_audio = audio_get(p_inst);
    
        APP_USBD_CLASS_DESCRIPTOR_BEGIN(p_ctx, p_buff, max_size);
    
        static app_usbd_class_iface_conf_t const * p_cur_iface = NULL;
        p_cur_iface = app_usbd_class_iface_get(p_inst, 0);
    
        //********** IA insert ******************
    
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x08); // bLength
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_DSC_TYPE_INTERFACE_ASSOCIATION);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_number_get(p_cur_iface));
        APP_USBD_CLASS_DESCRIPTOR_WRITE(ifaces);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_CLASS);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_SUBCLASS_CONTROL);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(USBD_AUDIO_PROTOCOL_UNDEFINED);
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00);
    
        //*****************************************
    
        /* CONTROL INTERFACE DESCRIPTOR */
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x09); // bLength
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_DESCRIPTOR_INTERFACE); // bDescriptorType = Interface
    
      //  static app_usbd_class_iface_conf_t const * p_cur_iface = NULL;
     //   p_cur_iface = app_usbd_class_iface_get(p_inst, 0);
    
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_number_get(p_cur_iface)); // bInterfaceNumber
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00); // bAlternateSetting
        APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_iface_ep_count_get(p_cur_iface)); // bNumEndpoints
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_CLASS); // bInterfaceClass = Audio
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_SUBCLASS_AUDIOCONTROL); // bInterfaceSubclass (Audio Control)
        APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_AUDIO_CLASS_PROTOCOL_UNDEFINED); // bInterfaceProtocol
        APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00); // iInterface
    
        /* HEADER INTERFACE */
    

Children
Related