I am building an HID Gamepad with the NRF52840 DK, using the Zephyr project, through VS Code.
I am using the Zephyr sample application 'HID', available here: https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/usb/hid/src/main.c
It does not matter whether I am using the sample as-is, or adding my own values to the report struct, or its report_1 instance, the values are not updating, they're keeping their default value (i.e. 0 for buttons, 127 for axes).
The report descriptor is working fine, the device is showing all of my buttons and axes, it is just not updating their values.
This is particularly troublesome because the default sample updates a value every 2 seconds, but even this is not working...
When I debug it, its logs "HID IN endpoint busy", repeating every 2 seconds.
After further inspection from debugging, it appears the program gives me the following errors, even when the program is completely unedited from the sample:
*** Booting Zephyr OS build v3.2.99-ncs2 *** [00:00:00.252,105] <inf> main: HID Device: dev 0x100e8 [00:00:02.278,717] <err> os: ***** USAGE FAULT ***** [00:00:02.278,717] <err> os: Illegal use of the EPSR [00:00:02.278,747] <err> os: r0/a1: 0x20000b6c r1/a2: 0x00000005 r2/a3: 0x00000000 [00:00:02.278,747] <err> os: r3/a4: 0x00000000 r12/ip: 0xffffffff r14/lr: 0x0000b5b3 [00:00:02.278,778] <err> os: xpsr: 0x60000000 [00:00:02.278,778] <err> os: Faulting instruction address (r15/pc): 0x00000000 [00:00:02.278,808] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0 [00:00:02.278,869] <err> os: Current thread: 0x20000a90 (sysworkq) *** Booting Zephyr OS build v3.2.99-ncs2 ***ng system [00:00:00.252,105] <inf> main: HID Device: dev 0x100e8 [00:00:00.252,166] <inf> main: Starting application
What is happening, how do I fix it?
I want to be able to update the button values.