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 Composite not showing data after a confirmation on sending

Hey Team,

I was playing around with the composite example, and added in my own class a  and used the mouse class to implement it while changing it to suit what i have 
orgianlly to output to EP3 and removing the subclass_boot/ setting it to be a generic device from a mouse device.

on pressing a button, i set a bunch of the 'buttons' to 1 and then organise it into the report buffer and send as like the other examples do. I get no error and it goes go through but looking at the device in test mode no data seems to trigger on.

Not sure what im missing.


Main changes:

/**
 * @brief Initializer of interface descriptor for HID mouse class.
 *
 * @param interface_number Interface number.
 */
#define APP_USBD_HID_GAMEPAD_INTERFACE_DSC(interface_number)      \
        APP_USBD_HID_INTERFACE_DSC(interface_number,            \
                                   1,                           \
                                   APP_USBD_HID_SUBCLASS_NONE ,  \
                                   APP_USBD_HID_PROTO_GENERIC )


/**
 * @brief Global definition macro of app_usbd_hid_mouse_t class.
 *
 * @param instance_name     Name of global instance.
 * @param interface_number  Unique interface number.
 * @param endpoint          Input endpoint (@ref nrf_drv_usbd_ep_t).
 * @param user_ev_handler   User event handler (optional).
 * @param subclass_boot     Subclass boot (@ref app_usbd_hid_subclass_t).
 *
 * @code
   APP_USBD_HID_MOUSE_GLOBAL_DEF(my_awesome_mouse, 0, NRF_DRV_USBD_EPIN1, 3, NULL);
 * @endcode
 */

  //static uint8_t const CONCAT_2(name,  _data)[] = fuck bcnt 

     /*typedef struct {
    size_t                size;
    app_usbd_descriptor_t type;
    uint8_t const * const p_data;
    } app_usbd_hid_subclass_desc_t; */


#define APP_USBD_HID_GAMEPAD_GLOBAL_DEF(instance_name,                                                  \
                                       interface_number,                                                \
                                       endpoint,                                                        \
                                       user_ev_handler,                                                 \
                                       subclass_boot)                                                   \
    APP_USBD_HID_GENERIC_SUBCLASS_REPORT_DESC(gamepad_desc, APP_USBD_HID_GAMEPAD_REPORT_DSC(196));      \
    static const app_usbd_hid_subclass_desc_t * gamepad_descs[] = {&gamepad_desc};                      \
    APP_USBD_HID_GAMEPAD_GLOBAL_DEF_INTERNAL(instance_name,                                             \
                                              interface_number,                                         \
                                              endpoint,                                                 \
                                              user_ev_handler,                                          \
                                              subclass_boot)


#ifdef DOXYGEN
/**
 * @brief HID mouse class instance type.
 *
 * @ref APP_USBD_CLASS_TYPEDEF
 */
typedef struct { } app_usbd_hid_gamepad_t;
#else
// other examples have the config at 0,endpoiint number
/*lint -save -e10 -e26 -e123 -e505 */
APP_USBD_CLASS_TYPEDEF(app_usbd_hid_gamepad,                      \
            APP_USBD_HID_GAMEPAD_CONFIG(0, NRF_DRV_USBD_EPIN1),   \
            APP_USBD_HID_GAMEPAD_INSTANCE_SPECIFIC_DEC,           \
            APP_USBD_HID_GAMEPAD_DATA_SPECIFIC_DEC                \
);
/*lint -restore*/
#endif
// @brief Specific class constant data for HID gamepad class.
//@brief Specific class data for HID gamepad class. 



 //###########################################
 /**
 * @brief Global HID GAMEPAD instance  AT EP1 (use to be at 3, swapped mouse and controller around)
 */
 //###########################################
APP_USBD_HID_GAMEPAD_GLOBAL_DEF(m_app_hid_gamepad,                //@param instance_name     Name of global instance.
                                APP_USBD_INTERFACE_GAMEPAD,       //@param interface_number  Unique interface number.
                                NRF_DRV_USBD_EPIN1,               //@param endpoint          Input endpoint (@ref nrf_drv_usbd_ep_t).
                                hid_gamepad_user_ev_handler,      //@param user_ev_handler   User event handler (optional).
                                APP_USBD_HID_SUBCLASS_NONE        //@param subclass_boot     Subclass boot (@ref app_usbd_hid_subclass_t).
);

APP_USBD_DUMMY_GLOBAL_DEF(m_app_gamepad_dummy, APP_USBD_INTERFACE_GAMEPAD);



Code is attached and the class is in the same folders as the other classes
5658.files.rar



Test showing on pc, no lights showup:



Serial log:

The oldest data was removed. Continue...
li:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J[1;31mLogs dropped (1)[0m

<info> app: hid_gamepad_feed_descriptors

[1;32muarart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: hid_gamepad_feed_descriptors

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 0

[1;32muart_cli:~$ [1;37m[12D[J<info> app: APP_USBD_HID_USER_EVT_IN_REPORT_DONE

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 1

[1;32muart_cli:~$ [1;37m[12D[J<info> app: APP_USBD_HID_USER_EVT_IN_REPORT_DONE

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 0

[1;32muart_cli:~$ [1;37m[12D[J<info> app: APP_USBD_HID_USER_EVT_IN_REPORT_DONE

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 1

[1;32muart_cli:~$ [1;37m[12D[J<info> app: APP_USBD_HID_USER_EVT_IN_REPORT_DONE

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 0

[1;32muart_cli:~$ [1;37m[12D[J<info> app: APP_USBD_HID_USER_EVT_IN_REPORT_DONE

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 1

[1;32muart_cli:~$ [1;37m[12D[J<info> app: APP_USBD_HID_USER_EVT_IN_REPORT_DONE

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 0

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 1

[1;32muart_cli:~$ [1;37m[12D[J<info> app: sending button press 0

[1;32muart_cli:~$ [1;37m[12D[J<info> app: APP_USBD_HID_USER_EVT_IN_REPORT_DONE

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m[12D[J<info> app: SENDING NEW USB DATA

[1;32muart_cli:~$ [1;37m[12D[J<info> app: transfer in progress

[1;32muart_cli:~$ [1;37m






Parents
  • Hi,

    Can you take a look at this example and use it as a basis for adding your gamepad descriptor?
    https://github.com/too1/nrf52-usbd-custom-hid-ep

    Best regards,
    Kenneth

  • Hey, thanks for the page. unforutantly thats confused me a tad bit more.
    If anything i would think the fault would lie within the descriptors function your examples use as i havnt modified them at all (hid_gamepad_feed_descriptors). Although in the example you offered the descriptors are layered out nicely. one think im having a hard time understanding is what value i would be writing to through the protothreads ie:

    static bool hid_gamepad_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)
    {
     NRF_LOG_INFO("hid_gamepad_feed_descriptors");
        static uint8_t ifaces   = 0;
    
        ifaces = app_usbd_class_iface_count_get(p_inst);
     NRF_LOG_INFO("Number of ifaces are %d",ifaces);
    
        app_usbd_hid_gamepad_t const * p_gamepad = hid_gamepad_get(p_inst);
    
        APP_USBD_CLASS_DESCRIPTOR_BEGIN(p_ctx, p_buff, max_size);
    
        static uint8_t i = 0;
    
        for (i = 0; i < ifaces; i++)
        {
            /* INTERFACE DESCRIPTOR */ 
            //Offset	Field                   Size                      Value                     Description
            //  0           bLength                   1                       Number              Size of Descriptor in Bytes 
            APP_USBD_CLASS_DESCRIPTOR_WRITE(0x09); // bLength  
            //  1          bDescriptionType           1                       Constant                  DescriptorType
            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, i);
    
            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_HID_CLASS);                                      // bInterfaceClass = HID  // unable to find an alternative 
            APP_USBD_CLASS_DESCRIPTOR_WRITE(p_gamepad->specific.inst.hid_inst.subclass_boot);         // bInterfaceSubclass (Boot Interface)
            APP_USBD_CLASS_DESCRIPTOR_WRITE(p_gamepad->specific.inst.hid_inst.protocol);              // bInterfaceProtocol
            APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00);                                                    // iInterface
    
            /* HID DESCRIPTOR */
            //Offset	Field                   Size                      Value                     Description
            APP_USBD_CLASS_DESCRIPTOR_WRITE(0x09);                                                    // bLength
            //  1         bDescriptorType             1                       Constant            Device Descriptor (0x01)
            APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_HID_DESCRIPTOR_HID);                             // bDescriptorType = HID
            //  2           bcdUSB                    2                         BCD             USB Specification Number which device complies too.
            APP_USBD_CLASS_DESCRIPTOR_WRITE(LSB_16(APP_USBD_HID_BCD_VER));                            // bcdHID LSB
            APP_USBD_CLASS_DESCRIPTOR_WRITE(MSB_16(APP_USBD_HID_BCD_VER));                            // bcdHID MSB
    
            APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_HID_COUNTRY_NOT_SUPPORTED);                      // bCountryCode
            APP_USBD_CLASS_DESCRIPTOR_WRITE(hid_gamepad_get_class_descriptors_count(p_inst));         // bNumDescriptors
    
            static uint8_t class_desc_cnt = 0;
            class_desc_cnt = hid_gamepad_get_class_descriptors_count(p_inst);
            static uint8_t  j              = 0;
            static uint16_t class_desc_len = 0;
    
            for (j = 0; j < class_desc_cnt; j++)
            {
                APP_USBD_CLASS_DESCRIPTOR_WRITE(hid_gamepad_get_class_descriptors_type(p_inst, j));   // bDescriptorType
    
                class_desc_len = hid_gamepad_get_class_descriptors_length(p_inst, j);
                APP_USBD_CLASS_DESCRIPTOR_WRITE(LSB_16(class_desc_len));                              // wDescriptorLength LSB
                APP_USBD_CLASS_DESCRIPTOR_WRITE(MSB_16(class_desc_len));                              // wDescriptorLength MSB
            }
    
            static uint8_t endpoints = 0;
            endpoints = app_usbd_class_iface_ep_count_get(p_cur_iface);
    
            for (j = 0; j < endpoints; j++)
            {
                /* ENDPOINT DESCRIPTOR */
                APP_USBD_CLASS_DESCRIPTOR_WRITE(0x07);                                                // bLength
                APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_DESCRIPTOR_ENDPOINT);                        // bDescriptorType = Endpoint
    
                static app_usbd_class_ep_conf_t const * p_cur_ep = NULL;
                p_cur_ep = app_usbd_class_iface_ep_get(p_cur_iface, j);
                APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_ep_address_get(p_cur_ep));             // bEndpointAddress
                APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_INTERRUPT);          // bmAttributes
                APP_USBD_CLASS_DESCRIPTOR_WRITE(LSB_16(NRF_DRV_USBD_EPSIZE));                         // wMaxPacketSize LSB
                APP_USBD_CLASS_DESCRIPTOR_WRITE(MSB_16(NRF_DRV_USBD_EPSIZE));                         // wMaxPacketSize MSB
                APP_USBD_CLASS_DESCRIPTOR_WRITE(p_gamepad->specific.inst.hid_inst.p_ep_interval[j]);  // bInterval
            }
        }
    
        APP_USBD_CLASS_DESCRIPTOR_END();
    }

    Then comparing the examples setup: 
    /** Maximum size of the packed transfered by EP0 */
    #define EP0_MAXPACKETSIZE NRF_DRV_USBD_EPSIZE
    
    /** Device descriptor */
    #define USBD_DEVICE_DESCRIPTOR \
        0x12,                        /* bLength | size of descriptor                                                  */\
        0x01,                        /* bDescriptorType | descriptor type                                             */\
        0x00, 0x02,                  /* bcdUSB | USB spec release (ver 2.0)                                           */\
        0x00,                        /* bDeviceClass ¦ class code (each interface specifies class information)        */\
        0x00,                        /* bDeviceSubClass ¦ device sub-class (must be set to 0 because class code is 0) */\
        0x00,                        /* bDeviceProtocol | device protocol (no class specific protocol)                */\
        EP0_MAXPACKETSIZE,           /* bMaxPacketSize0 | maximum packet size (64 bytes)                              */\
        0x15, 0x19,                  /* vendor ID  (0x1915 Nordic)                                                    */\
        0x0B, 0x52,                  /* product ID (0x520B nRF52 HID mouse on nrf_drv)                                */\
        0x01, 0x01,                  /* bcdDevice | final device release number in BCD Format                         */\
        USBD_STRING_MANUFACTURER_IX, /* iManufacturer | index of manufacturer string                                  */\
        USBD_STRING_PRODUCT_IX,      /* iProduct | index of product string                                            */\
        USBD_STRING_SERIAL_IX,       /* iSerialNumber | Serial Number string                                          */\
        0x01                         /* bNumConfigurations | number of configurations                                 */
    
    /** Configuration descriptor */
    #define DEVICE_SELF_POWERED 1
    #define REMOTE_WU           1
    
    #define USBD_CONFIG_DESCRIPTOR_SIZE   9
    #define USBD_CONFIG_DESCRIPTOR_FULL_SIZE   (9 + (9 + 9 + 7) + (9 + 9 + 7 + 7)) // 66
    #define USBD_CONFIG_DESCRIPTOR  \
        0x09,         /* bLength | length of descriptor                                             */\
        0x02,         /* bDescriptorType | descriptor type (CONFIGURATION)                          */\
        USBD_CONFIG_DESCRIPTOR_FULL_SIZE, 0x00,    /* wTotalLength | total length of descriptor(s)  */\
        0x02,         /* bNumInterfaces                                                             */\
        0x01,         /* bConfigurationValue                                                        */\
        0x00,         /* index of string Configuration | configuration string index (not supported) */\
        0x80| (((DEVICE_SELF_POWERED) ? 1U:0U)<<6) | (((REMOTE_WU) ? 1U:0U)<<5), /* bmAttributes    */\
        49            /* maximum power in steps of 2mA (98mA)                                       */
    
    #define USBD_INTERFACE0_DESCRIPTOR  \
        0x09,         /* bLength                                                                          */\
        0x04,         /* bDescriptorType | descriptor type (INTERFACE)                                    */\
        0x00,         /* bInterfaceNumber                                                                 */\
        0x00,         /* bAlternateSetting                                                                */\
        0x01,         /* bNumEndpoints | number of endpoints (1)                                          */\
        0x03,         /* bInterfaceClass | interface class (3..defined by USB spec: HID)                  */\
        0x00,         /* bInterfaceSubClass |interface sub-class (0.. no boot interface)                  */\
        0x02,         /* bInterfaceProtocol | interface protocol (1..defined by USB spec: mouse)          */\
        0x00          /* interface string index (not supported)      */     
                                        
    /**
     * HID Table must normally be between Interface and EndPoint Descriptor
     * as written in HID spec§7.1 but it doesn't work with OSR2.1
     */
    #define USBD_HID0_DESCRIPTOR  \
        0x09,         /* bLength | length of descriptor (9 bytes)                    */\
        0x21,         /* bHIDDescriptor | descriptor type (HID)                      */\
        0x11, 0x01,   /* HID wBcdHID | Spec version 01.11                            */\
        0x00,         /* bCountryCode | HW Target country                            */\
        0x01,         /* bNumDescriptors | Number of HID class descriptors to follow */\
        0x22,         /* bDescriptorType | Report descriptor type is 0x22 (report)   */\
        (uint8_t)(USBD_MOUSE_REPORT_DESCRIPTOR_SIZE),      /* Total length of Report descr., low byte */ \
        (uint8_t)(USBD_MOUSE_REPORT_DESCRIPTOR_SIZE / 256) /* Total length of Report descr., high byte */
    
    #define USBD_ENDPOINT1_DESCRIPTOR  \
        0x07,         /* bLength | length of descriptor (7 bytes)                                     */\
        0x05,         /* bDescriptorType | descriptor type (ENDPOINT)                                 */\
        0x81,         /* bEndpointAddress | endpoint address (IN endpoint, endpoint 1)                */\
        0x03,         /* bmAttributes | endpoint attributes (interrupt)                               */\
        0x08,0x00,    /* bMaxPacketSizeLowByte,bMaxPacketSizeHighByte | maximum packet size (8 bytes) */\
        0x08          /* bInterval | polling interval (10ms)                                          */
    
    #define USBD_INTERFACE1_DESCRIPTOR  \
        0x09,         /* bLength                                                                          */\
        0x04,         /* bDescriptorType | descriptor type (INTERFACE)                                    */\
        0x01,         /* bInterfaceNumber                                                                 */\
        0x00,         /* bAlternateSetting                                                                */\
        0x02,         /* bNumEndpoints | number of endpoints (2)                                          */\
        0x03,         /* bInterfaceClass | interface class (3..defined by USB spec: HID)                  */\
        0x00,         /* bInterfaceSubClass |interface sub-class (0.. no boot interface)                  */\
        0x00,         /* bInterfaceProtocol | interface protocol (1..defined by USB spec: mouse)          */\
        0x00          /* interface string index (not supported)    */
    
    #define USBD_HID1_DESCRIPTOR  \
        0x09,         /* bLength | length of descriptor (9 bytes)                    */\
        0x21,         /* bHIDDescriptor | descriptor type (HID)                      */\
        0x11, 0x01,   /* HID wBcdHID | Spec version 01.11                            */\
        0x00,         /* bCountryCode | HW Target country                            */\
        0x01,         /* bNumDescriptors | Number of HID class descriptors to follow */\
        0x22,         /* bDescriptorType | Report descriptor type is 0x22 (report)   */\
        (uint8_t)(USBD_CUSTOM_REPORT_DESCRIPTOR_SIZE),      /* Total length of Report descr., low byte */ \
        (uint8_t)(USBD_CUSTOM_REPORT_DESCRIPTOR_SIZE / 256) /* Total length of Report descr., high byte */
    
    #define USBD_ENDPOINT2_DESCRIPTOR  \
        0x07,         /* bLength | length of descriptor (7 bytes)                                     */\
        0x05,         /* bDescriptorType | descriptor type (ENDPOINT)                                 */\
        0x82,         /* bEndpointAddress | endpoint address (IN endpoint, endpoint 2)                */\
        0x03,         /* bmAttributes | endpoint attributes (interrupt)                               */\
        0x40,0x00,    /* bMaxPacketSizeLowByte,bMaxPacketSizeHighByte | maximum packet size (64 bytes) */\
        0x08          /* bInterval | polling interval (10ms)    */   
    
    #define USBD_ENDPOINT2_OUT_DESCRIPTOR  \
        0x07,         /* bLength | length of descriptor (7 bytes)                                     */\
        0x05,         /* bDescriptorType | descriptor type (ENDPOINT)                                 */\
        0x02,         /* bEndpointAddress | endpoint address (OUT endpoint, endpoint 2)                */\
        0x03,         /* bmAttributes | endpoint attributes (interrupt)                               */\
        0x40,0x00,    /* bMaxPacketSizeLowByte,bMaxPacketSizeHighByte | maximum packet size (64 bytes) */\
        0x08          /* bInterval | polling interval (10ms)    */   
    

    im currently trying to make sense of how things are sorted out from the app_usbd_core.c file
    regarding

    #define APP_USBD_CORE_DEVICE_DESCRIPTOR  {                                                               \
       .bLength = sizeof(app_usbd_descriptor_device_t),    /* descriptor size */                             \
       .bDescriptorType = APP_USBD_DESCRIPTOR_DEVICE,      /* descriptor type */                             \
       .bcdUSB = APP_USBD_BCD_VER_MAKE(2,0,0),             /* USB BCD version: 2.0 */                        \
       .bDeviceClass = 0,                                  /* device class: 0 - specified by interface */    \
       .bDeviceSubClass = 0,                               /* device subclass: 0 - specified by interface */ \
       .bDeviceProtocol = 0,                               /* device protocol: 0 - specified by interface */ \
       .bMaxPacketSize0 = NRF_DRV_USBD_EPSIZE,             /* endpoint size: fixed to: NRF_DRV_USBD_EPSIZE*/ \
       .idVendor = APP_USBD_VID,                           /* Vendor ID*/                                    \
       .idProduct = APP_USBD_PID,                          /* Product ID*/                                   \
       .bcdDevice = APP_USBD_BCD_VER_MAKE(                 /* Device version BCD */                          \
           APP_USBD_DEVICE_VER_MAJOR,                                                                        \
           APP_USBD_DEVICE_VER_MINOR,                                                                        \
           APP_USBD_DEVICE_VER_SUB),                                                                         \
       .iManufacturer = APP_USBD_STRING_ID_MANUFACTURER,   /* String ID: manufacturer */                     \
       .iProduct = APP_USBD_STRING_ID_PRODUCT,             /* String ID: product */                          \
       .iSerialNumber = APP_USBD_STRING_ID_SERIAL,         /* String ID: serial */                           \
       .bNumConfigurations = 1                             /* Fixed value: only one configuration supported*/\
    }
    
    
    #define APP_USBD_CORE_CONFIGURATION_DESCRIPTOR {                                        \
        .bLength = sizeof(app_usbd_descriptor_configuration_t),                             \
        .bDescriptorType = APP_USBD_DESCRIPTOR_CONFIGURATION,                               \
        .wTotalLength = 0,          /*Calculated dynamically*/                              \
        .bNumInterfaces = 0,        /*Calculated dynamically*/                              \
        .bConfigurationValue = 1,   /*Value passed to set configuration*/                   \
        .iConfiguration = APP_USBD_STRING_ID_CONFIGURATION,        /*Configuration ID*/     \
        .bmAttributes = APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_ALWAYS_SET_MASK |       \
                        ((APP_USBD_CONFIG_SELF_POWERED) ?                                   \
                            APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_SELF_POWERED_MASK   \
                            :                                                               \
                            0),                                                             \
        .bMaxPower = APP_USBD_POWER_MAKE(APP_USBD_CONFIG_MAX_POWER),                        \
    }
    


    am i on the right path regarding this being the issue ?

    i also noticed changing the endpoint of my setup to 0 kills it.

Reply
  • Hey, thanks for the page. unforutantly thats confused me a tad bit more.
    If anything i would think the fault would lie within the descriptors function your examples use as i havnt modified them at all (hid_gamepad_feed_descriptors). Although in the example you offered the descriptors are layered out nicely. one think im having a hard time understanding is what value i would be writing to through the protothreads ie:

    static bool hid_gamepad_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)
    {
     NRF_LOG_INFO("hid_gamepad_feed_descriptors");
        static uint8_t ifaces   = 0;
    
        ifaces = app_usbd_class_iface_count_get(p_inst);
     NRF_LOG_INFO("Number of ifaces are %d",ifaces);
    
        app_usbd_hid_gamepad_t const * p_gamepad = hid_gamepad_get(p_inst);
    
        APP_USBD_CLASS_DESCRIPTOR_BEGIN(p_ctx, p_buff, max_size);
    
        static uint8_t i = 0;
    
        for (i = 0; i < ifaces; i++)
        {
            /* INTERFACE DESCRIPTOR */ 
            //Offset	Field                   Size                      Value                     Description
            //  0           bLength                   1                       Number              Size of Descriptor in Bytes 
            APP_USBD_CLASS_DESCRIPTOR_WRITE(0x09); // bLength  
            //  1          bDescriptionType           1                       Constant                  DescriptorType
            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, i);
    
            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_HID_CLASS);                                      // bInterfaceClass = HID  // unable to find an alternative 
            APP_USBD_CLASS_DESCRIPTOR_WRITE(p_gamepad->specific.inst.hid_inst.subclass_boot);         // bInterfaceSubclass (Boot Interface)
            APP_USBD_CLASS_DESCRIPTOR_WRITE(p_gamepad->specific.inst.hid_inst.protocol);              // bInterfaceProtocol
            APP_USBD_CLASS_DESCRIPTOR_WRITE(0x00);                                                    // iInterface
    
            /* HID DESCRIPTOR */
            //Offset	Field                   Size                      Value                     Description
            APP_USBD_CLASS_DESCRIPTOR_WRITE(0x09);                                                    // bLength
            //  1         bDescriptorType             1                       Constant            Device Descriptor (0x01)
            APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_HID_DESCRIPTOR_HID);                             // bDescriptorType = HID
            //  2           bcdUSB                    2                         BCD             USB Specification Number which device complies too.
            APP_USBD_CLASS_DESCRIPTOR_WRITE(LSB_16(APP_USBD_HID_BCD_VER));                            // bcdHID LSB
            APP_USBD_CLASS_DESCRIPTOR_WRITE(MSB_16(APP_USBD_HID_BCD_VER));                            // bcdHID MSB
    
            APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_HID_COUNTRY_NOT_SUPPORTED);                      // bCountryCode
            APP_USBD_CLASS_DESCRIPTOR_WRITE(hid_gamepad_get_class_descriptors_count(p_inst));         // bNumDescriptors
    
            static uint8_t class_desc_cnt = 0;
            class_desc_cnt = hid_gamepad_get_class_descriptors_count(p_inst);
            static uint8_t  j              = 0;
            static uint16_t class_desc_len = 0;
    
            for (j = 0; j < class_desc_cnt; j++)
            {
                APP_USBD_CLASS_DESCRIPTOR_WRITE(hid_gamepad_get_class_descriptors_type(p_inst, j));   // bDescriptorType
    
                class_desc_len = hid_gamepad_get_class_descriptors_length(p_inst, j);
                APP_USBD_CLASS_DESCRIPTOR_WRITE(LSB_16(class_desc_len));                              // wDescriptorLength LSB
                APP_USBD_CLASS_DESCRIPTOR_WRITE(MSB_16(class_desc_len));                              // wDescriptorLength MSB
            }
    
            static uint8_t endpoints = 0;
            endpoints = app_usbd_class_iface_ep_count_get(p_cur_iface);
    
            for (j = 0; j < endpoints; j++)
            {
                /* ENDPOINT DESCRIPTOR */
                APP_USBD_CLASS_DESCRIPTOR_WRITE(0x07);                                                // bLength
                APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_DESCRIPTOR_ENDPOINT);                        // bDescriptorType = Endpoint
    
                static app_usbd_class_ep_conf_t const * p_cur_ep = NULL;
                p_cur_ep = app_usbd_class_iface_ep_get(p_cur_iface, j);
                APP_USBD_CLASS_DESCRIPTOR_WRITE(app_usbd_class_ep_address_get(p_cur_ep));             // bEndpointAddress
                APP_USBD_CLASS_DESCRIPTOR_WRITE(APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_INTERRUPT);          // bmAttributes
                APP_USBD_CLASS_DESCRIPTOR_WRITE(LSB_16(NRF_DRV_USBD_EPSIZE));                         // wMaxPacketSize LSB
                APP_USBD_CLASS_DESCRIPTOR_WRITE(MSB_16(NRF_DRV_USBD_EPSIZE));                         // wMaxPacketSize MSB
                APP_USBD_CLASS_DESCRIPTOR_WRITE(p_gamepad->specific.inst.hid_inst.p_ep_interval[j]);  // bInterval
            }
        }
    
        APP_USBD_CLASS_DESCRIPTOR_END();
    }

    Then comparing the examples setup: 
    /** Maximum size of the packed transfered by EP0 */
    #define EP0_MAXPACKETSIZE NRF_DRV_USBD_EPSIZE
    
    /** Device descriptor */
    #define USBD_DEVICE_DESCRIPTOR \
        0x12,                        /* bLength | size of descriptor                                                  */\
        0x01,                        /* bDescriptorType | descriptor type                                             */\
        0x00, 0x02,                  /* bcdUSB | USB spec release (ver 2.0)                                           */\
        0x00,                        /* bDeviceClass ¦ class code (each interface specifies class information)        */\
        0x00,                        /* bDeviceSubClass ¦ device sub-class (must be set to 0 because class code is 0) */\
        0x00,                        /* bDeviceProtocol | device protocol (no class specific protocol)                */\
        EP0_MAXPACKETSIZE,           /* bMaxPacketSize0 | maximum packet size (64 bytes)                              */\
        0x15, 0x19,                  /* vendor ID  (0x1915 Nordic)                                                    */\
        0x0B, 0x52,                  /* product ID (0x520B nRF52 HID mouse on nrf_drv)                                */\
        0x01, 0x01,                  /* bcdDevice | final device release number in BCD Format                         */\
        USBD_STRING_MANUFACTURER_IX, /* iManufacturer | index of manufacturer string                                  */\
        USBD_STRING_PRODUCT_IX,      /* iProduct | index of product string                                            */\
        USBD_STRING_SERIAL_IX,       /* iSerialNumber | Serial Number string                                          */\
        0x01                         /* bNumConfigurations | number of configurations                                 */
    
    /** Configuration descriptor */
    #define DEVICE_SELF_POWERED 1
    #define REMOTE_WU           1
    
    #define USBD_CONFIG_DESCRIPTOR_SIZE   9
    #define USBD_CONFIG_DESCRIPTOR_FULL_SIZE   (9 + (9 + 9 + 7) + (9 + 9 + 7 + 7)) // 66
    #define USBD_CONFIG_DESCRIPTOR  \
        0x09,         /* bLength | length of descriptor                                             */\
        0x02,         /* bDescriptorType | descriptor type (CONFIGURATION)                          */\
        USBD_CONFIG_DESCRIPTOR_FULL_SIZE, 0x00,    /* wTotalLength | total length of descriptor(s)  */\
        0x02,         /* bNumInterfaces                                                             */\
        0x01,         /* bConfigurationValue                                                        */\
        0x00,         /* index of string Configuration | configuration string index (not supported) */\
        0x80| (((DEVICE_SELF_POWERED) ? 1U:0U)<<6) | (((REMOTE_WU) ? 1U:0U)<<5), /* bmAttributes    */\
        49            /* maximum power in steps of 2mA (98mA)                                       */
    
    #define USBD_INTERFACE0_DESCRIPTOR  \
        0x09,         /* bLength                                                                          */\
        0x04,         /* bDescriptorType | descriptor type (INTERFACE)                                    */\
        0x00,         /* bInterfaceNumber                                                                 */\
        0x00,         /* bAlternateSetting                                                                */\
        0x01,         /* bNumEndpoints | number of endpoints (1)                                          */\
        0x03,         /* bInterfaceClass | interface class (3..defined by USB spec: HID)                  */\
        0x00,         /* bInterfaceSubClass |interface sub-class (0.. no boot interface)                  */\
        0x02,         /* bInterfaceProtocol | interface protocol (1..defined by USB spec: mouse)          */\
        0x00          /* interface string index (not supported)      */     
                                        
    /**
     * HID Table must normally be between Interface and EndPoint Descriptor
     * as written in HID spec§7.1 but it doesn't work with OSR2.1
     */
    #define USBD_HID0_DESCRIPTOR  \
        0x09,         /* bLength | length of descriptor (9 bytes)                    */\
        0x21,         /* bHIDDescriptor | descriptor type (HID)                      */\
        0x11, 0x01,   /* HID wBcdHID | Spec version 01.11                            */\
        0x00,         /* bCountryCode | HW Target country                            */\
        0x01,         /* bNumDescriptors | Number of HID class descriptors to follow */\
        0x22,         /* bDescriptorType | Report descriptor type is 0x22 (report)   */\
        (uint8_t)(USBD_MOUSE_REPORT_DESCRIPTOR_SIZE),      /* Total length of Report descr., low byte */ \
        (uint8_t)(USBD_MOUSE_REPORT_DESCRIPTOR_SIZE / 256) /* Total length of Report descr., high byte */
    
    #define USBD_ENDPOINT1_DESCRIPTOR  \
        0x07,         /* bLength | length of descriptor (7 bytes)                                     */\
        0x05,         /* bDescriptorType | descriptor type (ENDPOINT)                                 */\
        0x81,         /* bEndpointAddress | endpoint address (IN endpoint, endpoint 1)                */\
        0x03,         /* bmAttributes | endpoint attributes (interrupt)                               */\
        0x08,0x00,    /* bMaxPacketSizeLowByte,bMaxPacketSizeHighByte | maximum packet size (8 bytes) */\
        0x08          /* bInterval | polling interval (10ms)                                          */
    
    #define USBD_INTERFACE1_DESCRIPTOR  \
        0x09,         /* bLength                                                                          */\
        0x04,         /* bDescriptorType | descriptor type (INTERFACE)                                    */\
        0x01,         /* bInterfaceNumber                                                                 */\
        0x00,         /* bAlternateSetting                                                                */\
        0x02,         /* bNumEndpoints | number of endpoints (2)                                          */\
        0x03,         /* bInterfaceClass | interface class (3..defined by USB spec: HID)                  */\
        0x00,         /* bInterfaceSubClass |interface sub-class (0.. no boot interface)                  */\
        0x00,         /* bInterfaceProtocol | interface protocol (1..defined by USB spec: mouse)          */\
        0x00          /* interface string index (not supported)    */
    
    #define USBD_HID1_DESCRIPTOR  \
        0x09,         /* bLength | length of descriptor (9 bytes)                    */\
        0x21,         /* bHIDDescriptor | descriptor type (HID)                      */\
        0x11, 0x01,   /* HID wBcdHID | Spec version 01.11                            */\
        0x00,         /* bCountryCode | HW Target country                            */\
        0x01,         /* bNumDescriptors | Number of HID class descriptors to follow */\
        0x22,         /* bDescriptorType | Report descriptor type is 0x22 (report)   */\
        (uint8_t)(USBD_CUSTOM_REPORT_DESCRIPTOR_SIZE),      /* Total length of Report descr., low byte */ \
        (uint8_t)(USBD_CUSTOM_REPORT_DESCRIPTOR_SIZE / 256) /* Total length of Report descr., high byte */
    
    #define USBD_ENDPOINT2_DESCRIPTOR  \
        0x07,         /* bLength | length of descriptor (7 bytes)                                     */\
        0x05,         /* bDescriptorType | descriptor type (ENDPOINT)                                 */\
        0x82,         /* bEndpointAddress | endpoint address (IN endpoint, endpoint 2)                */\
        0x03,         /* bmAttributes | endpoint attributes (interrupt)                               */\
        0x40,0x00,    /* bMaxPacketSizeLowByte,bMaxPacketSizeHighByte | maximum packet size (64 bytes) */\
        0x08          /* bInterval | polling interval (10ms)    */   
    
    #define USBD_ENDPOINT2_OUT_DESCRIPTOR  \
        0x07,         /* bLength | length of descriptor (7 bytes)                                     */\
        0x05,         /* bDescriptorType | descriptor type (ENDPOINT)                                 */\
        0x02,         /* bEndpointAddress | endpoint address (OUT endpoint, endpoint 2)                */\
        0x03,         /* bmAttributes | endpoint attributes (interrupt)                               */\
        0x40,0x00,    /* bMaxPacketSizeLowByte,bMaxPacketSizeHighByte | maximum packet size (64 bytes) */\
        0x08          /* bInterval | polling interval (10ms)    */   
    

    im currently trying to make sense of how things are sorted out from the app_usbd_core.c file
    regarding

    #define APP_USBD_CORE_DEVICE_DESCRIPTOR  {                                                               \
       .bLength = sizeof(app_usbd_descriptor_device_t),    /* descriptor size */                             \
       .bDescriptorType = APP_USBD_DESCRIPTOR_DEVICE,      /* descriptor type */                             \
       .bcdUSB = APP_USBD_BCD_VER_MAKE(2,0,0),             /* USB BCD version: 2.0 */                        \
       .bDeviceClass = 0,                                  /* device class: 0 - specified by interface */    \
       .bDeviceSubClass = 0,                               /* device subclass: 0 - specified by interface */ \
       .bDeviceProtocol = 0,                               /* device protocol: 0 - specified by interface */ \
       .bMaxPacketSize0 = NRF_DRV_USBD_EPSIZE,             /* endpoint size: fixed to: NRF_DRV_USBD_EPSIZE*/ \
       .idVendor = APP_USBD_VID,                           /* Vendor ID*/                                    \
       .idProduct = APP_USBD_PID,                          /* Product ID*/                                   \
       .bcdDevice = APP_USBD_BCD_VER_MAKE(                 /* Device version BCD */                          \
           APP_USBD_DEVICE_VER_MAJOR,                                                                        \
           APP_USBD_DEVICE_VER_MINOR,                                                                        \
           APP_USBD_DEVICE_VER_SUB),                                                                         \
       .iManufacturer = APP_USBD_STRING_ID_MANUFACTURER,   /* String ID: manufacturer */                     \
       .iProduct = APP_USBD_STRING_ID_PRODUCT,             /* String ID: product */                          \
       .iSerialNumber = APP_USBD_STRING_ID_SERIAL,         /* String ID: serial */                           \
       .bNumConfigurations = 1                             /* Fixed value: only one configuration supported*/\
    }
    
    
    #define APP_USBD_CORE_CONFIGURATION_DESCRIPTOR {                                        \
        .bLength = sizeof(app_usbd_descriptor_configuration_t),                             \
        .bDescriptorType = APP_USBD_DESCRIPTOR_CONFIGURATION,                               \
        .wTotalLength = 0,          /*Calculated dynamically*/                              \
        .bNumInterfaces = 0,        /*Calculated dynamically*/                              \
        .bConfigurationValue = 1,   /*Value passed to set configuration*/                   \
        .iConfiguration = APP_USBD_STRING_ID_CONFIGURATION,        /*Configuration ID*/     \
        .bmAttributes = APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_ALWAYS_SET_MASK |       \
                        ((APP_USBD_CONFIG_SELF_POWERED) ?                                   \
                            APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_SELF_POWERED_MASK   \
                            :                                                               \
                            0),                                                             \
        .bMaxPower = APP_USBD_POWER_MAKE(APP_USBD_CONFIG_MAX_POWER),                        \
    }
    


    am i on the right path regarding this being the issue ?

    i also noticed changing the endpoint of my setup to 0 kills it.

Children
  • A better question might be 
    1) From looking at how it's setup the feeddescriptors doesnt seem to be something i would need to modify
    as it looks as if its pulling alot of data from other locations. Although it then has missing values from the
     app_usbd_descriptor_configuration_t and app_usbd_descriptor_iface_t.. 

    2) is my process for sending data out correct ? im trying to understand where my problem lies as it shows up nicely on the device manager but no data updates.
    so i would initially think these an issue with the endpoint
    and maybe how i used those define functions that those other two examples used, but since those two work fine and have different sized reports but the same setup for the feeddescriptors function im kind of at a loss with what i may of missed.

Related