Close
Asset

Auto Serial Reconnect System

Auto Serial Reconnect System

This tool solves a common problem when working with USB serial devices: When a device is unplugged and reconnected, its COM port ID often changes, making fixed-port reconnections unreliable.

I created an Auto Serial Reconnect System that automatically detects and connects to the correct working COM port, without requiring a preconfigured COM ID.

 

How It Works

  • It listens for a specific warning signal of Serial(DAT) from the serial device.

  • When a disconnection is detected, it scans through available COM ports.

  • It identifies the new port by detecting which one returns a valid DAT response.

  • Once found, it reconnects to that port automatically.

 

Why No Fixed COM ID?

In my case, the same device does not retain the same COM ID after being replugged, which makes static COM assignments unreliable.To work around this:

  • I disabled or ignored all known fixed COM ports.

  • When a new COM appears, I know it must be the one that changed, and reconnect accordingly.

 

Skipping Unwanted COM Ports

If you want to exclude certain COM ports from scanning, you can manually add them to a Substitute(DAT) in the configuration.

This solution may help others in the community who face similar USB serial port issues. Feel free to adapt and improve it for your own projects!

Asset Downloads

Comments