cancel
Showing results for 
Search instead for 
Did you mean: 

USB Custom HID does not work correctly on Android. STM32F072

Mike Panetta
Associate II

I have been working with a USB custom HID device trying to get it to work on Android but I'm failing miserably... It looks like Android keeps re-detecting the device every so many hundreds of milliseconds. Here is the dmesg output:

[  735.380289] input: Motus Nova Hand Peripheral as /devices/platform/fe3a0000.usb/usb6/6-1/6-1:1.0/0003:0483:C0ED.1A2C/input/input6703
[  735.434904] hid-generic 0003:0483:C0ED.1A2C: input: USB HID v1.11 Joystick [Motus Nova Hand Peripheral] on usb-fe3a0000.usb-1/input0
[  735.484185] input: Motus Nova Hand Peripheral as /devices/platform/fe3a0000.usb/usb6/6-1/6-1:1.0/0003:0483:C0ED.1A2D/input/input6704
[  735.545130] hid-generic 0003:0483:C0ED.1A2D: input: USB HID v1.11 Joystick [Motus Nova Hand Peripheral] on usb-fe3a0000.usb-1/input0
[  735.612361] input: Motus Nova Hand Peripheral as /devices/platform/fe3a0000.usb/usb6/6-1/6-1:1.0/0003:0483:C0ED.1A2E/input/input6705
[  735.681471] hid-generic 0003:0483:C0ED.1A2E: input: USB HID v1.11 Joystick [Motus Nova Hand Peripheral] on usb-fe3a0000.usb-1/input0
[  735.758731] input: Motus Nova Hand Peripheral as /devices/platform/fe3a0000.usb/usb6/6-1/6-1:1.0/0003:0483:C0ED.1A2F/input/input6706
[  735.829222] hid-generic 0003:0483:C0ED.1A2F: input: USB HID v1.11 Joystick [Motus Nova Hand Peripheral] on usb-fe3a0000.usb-1/input0
[  735.888328] input: Motus Nova Hand Peripheral as /devices/platform/fe3a0000.usb/usb6/6-1/6-1:1.0/0003:0483:C0ED.1A30/input/input6707
[  735.945057] hid-generic 0003:0483:C0ED.1A30: input: USB HID v1.11 Joystick [Motus Nova Hand Peripheral] on usb-fe3a0000.usb-1/input0

I'm not sure why it is doing this but it is making the HID transfers very slow. I have a USB Beagle 12, and I got a dump, at first it was stalling on a clear feature request, but I fixed that by making it send ***** data. Here is what is happening on the bus now (see attached file).

What am I doing wrong? Not sure how to fix this issue but I need to fix it so I can get my device to respond in a timely manner...

Thanks,

Mike

1 REPLY 1
Pavel A.
Evangelist III

This may be a manifestation of a bug (hardware or software) when the host sends clear stall request for EP which is not stalled. The USB controller then appears to send lots of garbage from this EP. The host gets annoyed and usually resets the device.

My workaround was to check the stall flag in the USB driver structures and ignore the request if the flag is not set. (I've posted this shortly before the forumocalipse)

Don't know if this is specific to F072 or exists in other MCUs in device mode too.

-- pa