2017-01-04 07:25 AM
Hi
I have been investigating a problem with a product using an STM32F103R8T6 and USB virtual COM port. Code for the CDC was generated from the latest version of the Cube. The device is bus powered and the problem occurs after a brief USB disconnect/reconnect sequence.
It seems that various Windows OS event messages are not being generated.
I get a device change (WM_DEVICECHANGE) notification message but this is not specific about which device has been unplugged. I have used this non-specific message to check comms with the product and this does work to some degree as a work around.
However without the correct message (DBT_DEVICEREMOVECOMPLETE) it is possible to get the comms handler into a bad state where recovery requires another physical disconnect/reconnect sequence.
Reading various forums on the topic, the missing disconnect message (DBT_DEVICEREMOVECOMPLETE) may be a result of bad settings made during the initial USB device enumeration (i.e. CDC get/set commands).
Has anyone else had experience of this?
Or any suggestions for a fix to this?