2023-09-27 12:41 AM - edited 2023-09-27 12:49 AM
Hi,
I'm trying to resolve a issue I see occasionnaly where my USB CDC-ACM device fails to be detected by Windows/Linux host as it is not responding to the first device descriptor request until the system is fully reset.
The scenario:
In normal product usage, the problem only manifests itself rarely so is hard to debug, but I have found I can recreate the scenario by introducing a breakpoint or delay into the HAL ISR routine for the OTG_FS interrupt. Steps:
Examining the packets tx/rx on the host side we can see that everything is ok up until the point of the host requesting the device descriptor to which the device fails to respond. The PC host keeps retrying every few seconds until it eventually gives up.
Looking at the interrupts raised by the OTG_FS peripheral, we can see:
I don't have a h/w sniffer to see what is going on on the wire, but it seems the first setup packet is not being ACKed so the host never sends the completion packet.
I can understand that interrupting the normal interrupt flow can mess the session up, but what I can't resolve yet is how to recover from this situation. Once its happened it is game over until I fully reset the processor.
Again, this is easily repoducable using the Cube example project Ux_Device_CDC_ACM with the Nucleo-U575ZI-Q evaluation board.
Any help on how to recover this situation would be greatly appreciated. I can't see anything obvious in the OTG_FS status registers but I might have missed something!