2021-08-12 05:36 AM
Every period of time i send ~33bytes through USB CDC, if suddenly USB cable disconnected and reconnect i get 16 bytes of the last message loaded, and then continue to get new messages.
How can i detect disconnection and were these 16 bytes located?
2021-08-12 05:54 AM
Sounds more like a windows driver issue than an STM32 thing. Windows should be able to detect when it's unplugged (COM port goes away). Use a USB monitor to see if the actual data on the line includes the 16 bytes.
You can reset the USB peripheral on disconnect (VBUS goes low) and reinitialize to stop whatever ongoing transaction it's doing.
2021-08-12 06:36 AM
Actually it happens on Linux. Linux allow re-connection.
On Windows the communication does not recover after re-connecting the cable, It requires resetting the device in order to reconnect.
Is there a event on VBUS changes?
2021-08-12 06:46 AM