cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB Composite HID device (mouse+joystick) not working: USB debug

fbar
Senior

I'm struggling to get a composite HID device to work properly.

I started from the Mouse HID device and built a basic example. Mouse by itself works. Then I modified that example to impersonate a joystick. and that works, too.

Then I create a composite HID device with 2 interfaces, and change the HID_Init code to initialize both. If I send data only thru the first interface (the mouse), everything works. But if I try to send data thru the second interface (joystick), the USB HID device stops working.

I suspect a problem with the initialization code, but every time I try to debug it (with STLink), the USB interface stops working. Is there a trick to be able to debug HAL code when the USB is active?

When coding for the nRF52 (using an onboard J-Link), there is a mode called "monitor mode debugging" which allows to use the debugger even when running time critical code (using interrupts). In theory with a J-link, monitor mode debugging should work on any M3 (or M4) device, but I could not find any example of the necessary code to add

1 REPLY 1
Pavel A.
Evangelist III

> Is there a trick to be able to debug HAL code when the USB is active?

Unfortunately USB is sensitive to long delays caused by breakpoints. The host can think that the device died and reset it.

-- pa