HI, I use 52840 and need to make a USB HID device. I have a problem. I can't make USBD work properly. Please help me see what the problem is.
This is translated by Google.
My use example: nRF5_ SDK_ 17.1.0_ Ddde560 examples universal usbd to create my application.
The source code is as follows:
uint8_t get_descriptor_report_6kro_kb[USBD_6KRO_KB_REPORT_DESCRIPTOR_SIZE] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)目前正在使用的
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x08, // REPORT_COUNT (8)
0x05, 0x07, // USAGE_PAGE (Keyboard)(Key Codes)
0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)(224)
0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)(231)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x81, 0x02, // INPUT (Data,Var,Abs) ; Modifier byte
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x03, // INPUT (Cnst,Var,Abs) ; Reserved byte
0x95, 0x05, // REPORT_COUNT (5)
0x75, 0x01, // REPORT_SIZE (1)
0x05, 0x08, // USAGE_PAGE (LEDs)
0x19, 0x01, // USAGE_MINIMUM (Num Lock)
0x29, 0x05, // USAGE_MAXIMUM (Kana)
0x91, 0x02, // OUTPUT (Data,Var,Abs) ; LED report
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x03, // REPORT_SIZE (3)
0x91, 0x03, // OUTPUT (Cnst,Var,Abs) ; LED report padding
0x95, 0x06, // REPORT_COUNT (6)
0x75, 0x08, // REPORT_SIZE (8)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff,0x00, // LOGICAL_MAXIMUM (101->0x65),(0xff)
0x05, 0x07, // USAGE_PAGE (Keyboard)(Key Codes)
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))(0)
0x2a, 0xff,0x00, // USAGE_MAXIMUM (Keyboard Application)(101)231->0XE7 (0xff)
0x81, 0x00, // INPUT (Data,Ary,Abs)
0xc0 // END_COLLECTION
};
#define USBD_CONFIG_DESCRIPTOR_FULL_SIZE (9 + (9 + 9 + 7 + 7))
uint8_t get_descriptor_configuration[USBD_CONFIG_DESCRIPTOR_FULL_SIZE]= {
0x09, // bLength | length of descriptor
0x02, // bDescriptorType | descriptor type (CONFIGURATION)
USBD_CONFIG_DESCRIPTOR_FULL_SIZE, 0x00, // wTotalLength | total length of descriptor(s)
0x01, // 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
30, // maximum power in steps of 2mA (60mA)
//HID接口1:普通键盘
0x09, // bLength
0x04, // bDescriptorType | descriptor type (INTERFACE)
0x00, // bInterfaceNumber
0x00, // bAlternateSetting
0x02, // bNumEndpoints | number of endpoints (1)
0x03, // bInterfaceClass | interface class (3..defined by USB spec: HID)
0x01, // bInterfaceSubClass |interface sub-class (0.. no boot interface)
0x01, // bInterfaceProtocol | interface protocol (1..defined by USB spec: mouse)
0x00, // interface string index (not supported)
//键盘接口描述符
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_6KRO_KB_REPORT_DESCRIPTOR_SIZE), /* Total length of Report descr., low byte */
(uint8_t)(USBD_6KRO_KB_REPORT_DESCRIPTOR_SIZE / 256), /* Total length of Report descr., high byte */
//发送数据端口 in 0x81端点
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)
0x01, // bInterval | polling interval (10ms)
//接收数据端口 out 0x01端点
0x07,
0x05,
0x01,
0x03,
0x01,
0x00,
0x0a
};

When this error prompt appears, USB HID cannot work properly.What is the problem?