Phantom usb to serial port

461 views Asked by At

My program talks to various electronic devices via an ftdi usb to serial port. On the hardware side it can happen, that the ftdi chip is disturbed by a short power outage. If this happens, the software should reset the connection and continue to talk to the device. This works fine as long as the power outage is long enough (>~0.5 s). If it is very short (like <~0.1 s), it is no longer possible to reset the connection for several minutes. Every connection to the port fails with the message that the port is still in use. So here is what I’ve tried so far:

Running the ftdi API commands FT_ResetDevice, FT_CyclePort and even FT_Rescan and FT_Reload do not help.

Unplugging the device from both USB and power and replugging it does not help. The port is still blocked.

Even while the USB cable is disconnected, a phantom port is still visible in the windows device manager. All attempts to connect to this port fail with the port in use message, independently of which program I use to connect to the port.

I could also reproduce the effect if the port was not open when the power outage took place.

So far, the only action that helped is restarting windows or waiting for a few minutes. Of course, this is not really a feasible option.

What I’m looking for is a way to reset the USB/serial port programmatically if it ended up in a phantom state. Maybe this could be directly handled via the windows API instead of the ftdi API.

0

There are 0 answers