2012-10-17 07:58 AM
Hi,
I have a problem while developing a USB-to-serial device and I am looking for a solution.I successfully implemented a USB virtual COM port on STM32F407 microcontroller. I can send and receive data to/from the computer via hyperterminal program perfectly using the generic virtual COM driver provided by Windows 7. However, if I unplug the USB cable while Hyperterminal is still in ''connected'' state, the communication cannot be established when I plug it back. To resume the communication, I have to 1. disconnect Hyperterminal, 2. unplug USB cable, 3. plug it back again and then 4. connect Hyperterminal.To clarify the situation I am in, here are two senarios:Senario 1:- plug USB cable- connect Hyperterminal- communication established successfully and worked well- disconnect Hyperminal- unplug USB cable- plug USB cable back - connect Hyperterminal- communication established successfully and worked wellSenario 2:- plug USB cable- connect Hyperterminal- communication established successfully and worked well- unplug USB cable- plug USB cable back - Hyperminal not working (but Windows device manager sees the disappearance and reappearance of the virtual COM port)- disconnect Hyperminal- connect Hyperterminal (FAIL! Hyperterminal cannot connect to this virtual COM port even if device manager has it in the COM port list)- unplug USB cable (now Hyperterminal is in disconnected state)- plug USB cable- connect Hyperterminal- communication established successfully and worked wellI captured the USB traffic with SourceUSB and found that when I tried to disconnect Hyperterminal in Senario 2, it said ''No such device''.Any suggestions are appreciated! Thanks!Shuozhi2012-10-18 04:54 AM
I dont really see the question in your thread but I would think you'd like that once you re-plug the device would keep working without hyperterminal restart.
I dont know much about Microsoft Hyperterminal, but I would suggest you make rts-cts checks on uC and if they fail few times re-establish handshake of protocol (or maybe smarter to start with termination protocol which is followed by handshake - so terminal will drop connection and then re-establish it, as that seems to be the problem from your description). That way you might trick hyperterminal that you're now re-establishing connection and he will keep working. It would be smart to check if that is really the idea, or he just hangs up within some nifty bug.2012-12-10 01:27 PM
I'd like to know how to fix this problem too. Is it a bug in the PC Virtual Com Port Driver or a bug in the STM32 library or is it the proper behavior? Everytime you rebuild code or cycle power you have to physically unplug and replug in the USB connector, remembering to disconnect from HyperTerminal first. It should auto re-enumerate when the processor reboots but something gets in a weird state.
2012-12-19 10:47 PM
Hi,
I am also using this MCU, the STM32F407VGT6 to be exact, on the discovery board.How did you modify the virtual com port example to work on this MCU please?Thanks,Terence2014-01-20 12:52 PM
Is there still no solution???
2014-01-21 02:44 AM
''Is there still no solution???''
NO The problem is that it is a serial port EMULATION! You cannot unplug a serial port in real life. So there is no way to signal the terminal program that the serial port connect is closed. The terminal program just leaves the VCP port open - even though the other end has gone.2014-01-21 08:53 AM
More to the point, it is a hyper tem problem.
Windows does send a message to all applications WM_DEVICECHANGEthis can notifie an app of insertion or removal of USB devices.it is up to the app to determine if the device is important to the app