cancel
Showing results for 
Search instead for 
Did you mean: 

USB virtual comport issue with PC application after disconnect and connect back

gatadivijay
Associate II
Posted on February 28, 2017 at 16:01

Hi,

Am using STM32F072CB controller and am using USB in Virtual com port mode generated by cubex.

USB virtual comport communication is working fine.

But we are facing with  our PC application when Disconnect the virtual comport from the code  and try to connect back then most of the time's USB virtual comport not detecting in the PC application.

Due to this our PC application is hanging.

During this scenario I debugged STM32  code, it is running fine and also in device manager I can able to see STM32 Virtual comport .

The same PC application is working fine if I use UART port instead of USB virtual comport.I can able to disconnect and connect multiple times.

I hope you understand my problem.

Please can you give your suggestion.

1 REPLY 1
ColdWeather
Senior
Posted on February 28, 2017 at 16:34

Hello,

first of all, I think, the problem must be rather in your PC program under OS (Windows?) than on the controller side.

Try to rescan (enumerate) the ports before reopening.

Second, I've got VCP on F103. What I could see, no notification to the VCP USB code on the controller when a PC was closing the port. Due to this behavour my firmware on the controller

:(

stalled still trying to send chars over VCP to the PC. My work around in the firmware was internally to mark a port as closed if the output buffer (from VCP to PC) stayed full for a certain period of time. Maybe in your firmware you reject the further tries from PC to open the VCP. Note, the PC (OS) first closes a port before openning it. Try to trace this calls in the firmware to get sure, your firmware does not reject anything.