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

How to transmit BULK via USB HID?

How to realize the USB HID interface and PC data transmission?

I want to connect my computer via USB hid protocol for communication

This is my code, but can only send data, can not receive, send data will enter "APP_USBD_HID_USER_EVT_IN_REPORT_DONE" interrupt, but PC to nrf52840 send data, will not enter "APP_USBD_HID_USER_EVT_OUT_REPORT_READY" interrupt, but can pass nrf_usbd_epout_size_get(nrf_drv_usb_epout3);Gets the size of the data sent to the PC.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# define APP_USBD_HID_BULK_REPORT_DSC () {\
X06 0, 0 xa0, 0 XFF, / * usage page (FFA0h, vendor defined) * / \
0x09, 0x01, /* usage (vendor defined) */ \
0xA1, 0x01, /* collection (Application) */ \
0x09, 0x02, /* usage (vendor defined) */ \
0xA1, 0x00, /* set (Physical) */ \
0 x06, xa1 0, 0 XFF, / * usage page (vendor defined) * / \
/* input report */ \
0x09, 0x03, /* usage (vendor defined) */ \
0x09, 0x04, /* usage (vendor defined) */ \
0x15, 0x80, /* logical minimum value (0x80 or -128) */ \
0x25, 0x7F, /* logical maximum (0x7F or 127) */ \
0x35, 0x00, /* physical minimum value (0) */ \
0x45, 0xFF, /* physical maximum (255) */ \
0 x75, 0 x08, / * Report length Report size (8) * / \
0x95, 0x40, /* reports the value (64 fields) */ \
0 x81, 0 x02, / * input (data, variable, absolute) * / \
/* output report */ \
0x09, 0x05, /* usage (vendor defined) */ \
0x09, 0x06, /* usage (vendor defined) */ \
0x15, 0x80, /* logical minimum value (0x80 or -128) */ \
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX