2014-07-01 06:51 AM
Hi, here's the problem: When I used RS232, I could reset my target, reset my PC app, and get going again, as the new bytes I sent went to the target. But this doesn't work over VCP. When the target is reset, the device disappears from device manager, then reappears when it is recognised again. Now it seems there is no way to resume communications without physically unplugging the USB lead and plugging it back in again. What is the solution to this?
Thanks, Ian2014-07-01 07:21 AM
Hi
''Hi, here's the problem: When I used RS232, I could reset my target, reset my PC app, and get going again, as the new bytes I sent went to the target. But this doesn't work over VCP. When the target is reset, the device disappears from device manager, then reappears when it is recognised again. Now it seems there is no way to resume communications without physically unplugging the USB lead and plugging it back in again.'' The problem is the VCP emulation - when the USB device is unplugged, the port is removed (disconnected). RS232/COMM ports were NEVER disconnected. So, most applications that use COMM ports do not expect the port to dissapear on them! The problem lies in the PC application. Even though the port has gone, the PC program still has the COMM port open. (Try it with a Terminal program - Open the port to the target, unplug the target and and plug it back in. Close the Comm port in the terminal and open it again BUT it has not worked because it is still trying to connect to the old instance of the comm port). ''What is the solution to this?'' You have to do something that is non standard. The PC program must register for the VCP/CDC device notifications. When the PC program is notified of the device dissapearing - it must close the comm port. (As I said - most programs that deal with a comm port do NOT expect it to dissapear)2014-07-01 07:36 AM
Thanks, it was as simple as that, I can set .portopen = false after I send the last byte that causes the reset, delay for 5 seconds while the device disappears and comes back, then open a new connection.