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

Nrf52840 usb hid problem

Hi,

i am developing a device with nordic NRF52840 soc and i want to implement a usb device  with HID interface and custom hid descriptor, for test i changed nordic usb_hid_generic example as below:

#define USBD_CUSTOM_REPORT_DESCRIPTOR { \
      0x06, 0xD0, 0xF1        , /*USAGE_PAGE (FIDO Alliance) */   \
      0x09, 0x01              , /* USAGE (U2F HID Authenticator Device) */   \
      0xa1, 0x01              , /* COLLECTION (Application) */   \
      0x09, 0x20              , /*   USAGE (Input Report Data) */   \
      0x15, 0x00              , /*   LOGICAL_MINIMUM (0) */   \
      0x26, 0xff, 0x00        , /*   LOGICAL_MAXIMUM (255) */   \
      0x75, 0x08              , /*   REPORT_SIZE (8) */   \
      0x95, 0x40              , /*   REPORT_COUNT (64) */   \
      0x81, 0x02              , /*   INPUT (Data,Var,Abs) */   \
      0x09, 0x21              , /*   USAGE(Output Report Data) */   \
      0x15, 0x00              , /*   LOGICAL_MINIMUM (0) */   \
      0x26, 0xff, 0x00        , /*   LOGICAL_MAXIMUM (255) */   \
      0x75, 0x08              , /*   REPORT_SIZE (8) */   \
      0x95, 0x40              , /*   REPORT_COUNT (64) */   \
      0x91, 0x02              , /*   OUTPUT (Data,Var,Abs) */   \
      0xc0                    , /* END_COLLECTION */ \
}

APP_USBD_HID_GENERIC_SUBCLASS_REPORT_DESC(custom_desc,USBD_CUSTOM_REPORT_DESCRIPTOR);
static const app_usbd_hid_subclass_desc_t * custom_reps[] = {&custom_desc};


#define CUSTOM_HID_GENERIC_INTERFACE 0

/**
 * @brief HID generic class endpoint number.
 * */
#define HID_GENERIC_EPIN1                NRF_DRV_USBD_EPIN2
#define HID_GENERIC_EPOUT1               NRF_DRV_USBD_EPOUT2
#define REPORT_IN_QUEUE_SIZE1            1

/**
 * @brief Size of maximum output report. HID generic class will reserve
 *        this buffer size + 1 memory space. */
#define REPORT_OUT_MAXSIZE1  63

/**
 * @brief HID generic class endpoints count.
 * */
#define HID_GENERIC_EP_COUNT1  1

/**
 * @brief List of HID generic class endpoints.
 * */
#define ENDPOINT_LIST1()                                      \
(                                                            \
        HID_GENERIC_EPIN1,HID_GENERIC_EPOUT1                   \
)

void hid_user_ev_handler1(app_usbd_class_inst_t const * p_inst,
                                app_usbd_hid_user_event_t event);

/**
 * @brief Global HID generic instance
 */
APP_USBD_HID_GENERIC_GLOBAL_DEF(ctap_hid_generic1,
                                CUSTOM_HID_GENERIC_INTERFACE,
                                hid_user_ev_handler1,
                                ENDPOINT_LIST1(),
                                custom_reps,
                                REPORT_IN_QUEUE_SIZE1,
                                REPORT_OUT_MAXSIZE1,
                                APP_USBD_HID_SUBCLASS_NONE,
                                APP_USBD_HID_PROTO_GENERIC);

as you can see i changed the endpoints to 2 and also i changed the mouse descriptor to another one. in main function i try to add the class to the stack as below:

ret = app_usbd_init(&usbd_config);
APP_ERROR_CHECK(ret);

app_usbd_class_inst_t const * class_inst_generic1;
class_inst_generic1 = app_usbd_hid_generic_class_inst_get(&ctap_hid_generic1);
ret = app_usbd_class_append(class_inst_generic1);     
APP_ERROR_CHECK(ret);

the problem is that when i compile and load the app to PCA10056 dev board and connecting the board to the computer, in the device manager windows report below error about the device:

This device cannot start. (Code 10)

{Operation Failed}
The requested operation was unsuccessful.

can anyone give me a advice to solve the problem? there is any setting that i should to done when i want use 2 endpoint in my interface?? 

thanks

Parents Reply Children
Related