2018-06-15 03:50 PM
Has anyone seen a similar issue?
STM32F072CBT with USB 'Custom HID' based application (mix of 'HID' and 'Custom HID'), on a 100% custom board.
With many hosts (desktop PCs and laptops) it works as intended.
But with certain hosts sometimes the HID data IN endpoint starts spewing a lot of garbage, right after successful enumeration, reading all descriptors etc. Every read from the IN endpoint produces 200+ bytes. My code is not sending this data.
This is seen on a Ellisys analyzer.
I understand that this may be caused by our hardware (USB power suppy and so on) but no idea how.
Any clues?
Thanks,
-- pa
#usb-device #usb-hid #stm32f02018-06-28 06:57 AM
It seems like the root cause of this is gratituos 'clear halt' requests sent by the host.
When the device's endpoint is not stalled, HAL_PCD_EP_ClrStall (
) does something horrible to the USB controller or the driver.After the next IN transaction to this EP, somehow the data pointer and transfer length registers become filled with random values.
The interrupt handler then continues to feed the garbage (so the EP data structures in memory become corrupt too).
I cannot afford digging into it further, so just check whether the EP is stalled in the request handler:
if (!
ep->
is_stall) // bail out
Would be grateful for any comments from people knowledgeable in the STM32F0 USB device controller
Regards,
Pavel A