Hi Fedda306 Anadi,
The root cause is that your Windows COM Port Database (COMDB) is filled with "ghost" reservations. Every time there is a slight power fluctuation or micro-disconnect, Windows thinks it is a brand-new device and bumps it to the next available COM number to avoid conflicts.
Here is the exact way to flush the database and permanently lock your device to COM4:
Step 1: Clear the COM Port Database
- Unplug the USB-to-serial device from the machine.
Press Windows key + R, type regedit, and hit Enter to open the Registry Editor.
Navigate exactly to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter
On the right panel, right-click and Delete the ComDB entry. (Don't worry, Windows will automatically recreate a fresh, empty one).
Restart your computer.
Step 2: Lock the Port
Plug the device back into its dedicated physical USB port.
Open Device Manager and expand Ports (COM & LPT).
Right-click your USB-to-serial device -> Properties -> Port Settings tab -> Advanced.
Change the COM Port Number to COM4. (If it says COM4 is "in use", ignore the warning and force it, since we just cleared the database).
Click OK on all windows. Your device will now strictly hold COM4 and stop jumping around. If this resolves your operational headache, please click "Accept Answer".
Tracy.