[SOLVED] Map all Arduino's to same COM port?

Windows / Arduino DUE and Mega's

Every time I plug in a new Arduino PCB via USB, windows assigns a new COM port to it.

Is there a way to set any Arduino to use the same COM port (say when you'd like to program a stack of pcb's)?

** My apologies if this has already been answered... The search terms that I could come up with are so common, the that the results are hard to sift through. **

Regards,

Chris

-- Just found this:
"Ignore Hardware Serial Number Registry Editor Utility"
at:
http://www.ftdichip.com/Support/Utilities.htm

Has anyone attempted to use this?

The description notes:

Enter the device type and VID/PID that you want to ignore the serial number on and press WRITE to apply.

Any hints on discovering the 'device type' and 'VID/PID'?

I see the DUE does not use a FTDI chip... No joy here...

-Chris

You may change COM port in the Device Manager and set to same number. Of course, ignoring all warnings.

Tip to show/delete/manage non present devices:
http://support.microsoft.com/kb/241257

Thanks K5CZ,

I realized that changing the port assignment via the windows gui is a possibility, (as well as viewing ghosted devices).

However, imagine you have a stack of new Arduino's that you'd like to program, and then perhaps reprogram N times. Followed by another batch...

It seems inefficient for the driver to assign a new Com port each time a new board is plugged in (especially when the other boards are not connected).

There must be a known work around for programming a pile of Arduino's...

I hope.

-Chris

Your problem is challenge to my scripting skills. So, Last hour I wrote next script:

@ECHO OFF
CLS
SET "DESIREDPORT=COM3"
SET /A COUNTER=0
FOR /F "tokens=1,2,3" %%A IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Enum\USB" /s /v "PortName" /f "COM" /c /t "REG_SZ"') DO CALL :_parse "%%A" "%%B" "%%C"
SET /A NUMBER=%COUNTER%
SET /A COUNTER=0
SET "ROW="
:loop
SET /A COUNTER=%COUNTER% + 1
IF %NUMBER% LSS %COUNTER% GOTO endloop
SET "ROW=%ROW% %COUNTER%"
GOTO loop
:endloop
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO COM ports found:
ECHO ================
FOR %%A IN (%ROW%) DO CALL :_process "%%A"
SET /A COUNTER=0
FOR /F "tokens=1,2,3" %%A IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Enum\USB" /s /v "PortName" /f "COM" /c /t "REG_SZ"') DO CALL :_parse "%%A" "%%B" "%%C"
ECHO.
ECHO COM ports changed to:
ECHO =====================
FOR %%A IN (%ROW%) DO (ECHO !KEYNAME%%A!&ECHO PortName=!COMPORT%%A!&ECHO.)
ENDLOCAL
PAUSE
GOTO :EOF
REM ***************************************************************************
:_process
ECHO !KEYNAME%~1!
ECHO PortName=!COMPORT%~1!
REG ADD "!KEYNAME%~1!" /v "PortName" /t "REG_SZ" /d "%DESIREDPORT%" /f > NUL
ECHO.
GOTO :EOF
REM ***************************************************************************
:_parse
ECHO "%~1"|FIND "HKEY_LOCAL_MACHINE">NUL
IF %ErrorLevel% EQU 0 goto keyname
IF "%~1" == "PortName" goto value
GOTO :EOF
:keyname
SET /A COUNTER=%COUNTER% + 1
set "KEYNAME%COUNTER%=%~1 %~2"
GOTO :EOF
:value
set "COMPORT%COUNTER%=%~3"
GOTO :EOF
REM ***************************************************************************

The script is not perfect, the Port descriptions are not changed (old port numbers are shown), but COM port numbers yes. Set IDE to COM3 and it works!

PS: I try to improve script later
PS2: second version requires subinacl.exe to set access rights in the registry

ChangeAllComPortNumber.bat (1.49 KB)

ChangeAllComPortNumbers.bat (2.7 KB)

subinacl.exe (284 KB)

Works on Windows XP (Other Windows?)

Found a solution for me - inspired by by:

The key is to set 'IgnoreHWSerNum' in the registry for the Arduino DUE.

For reference the DUE's Vendor ID = 2341, the Product ID = 003d.

  • Follow Section 7.2 in the linked PDF to list all previously installed drivers.
  • Right-click on all existing Arduino serial ports listed in 'Ports', and select 'Uninstall'
  • Open Regedit, and add a new Binary entry as:

IgnoreHWSerNum2341003d to 1

(this is described in Section 7.1 in the PDF). See attached image.

The next time an Arduino board is plugged in, allow the serial driver to install ('let Windows do it for me' worked).
Now, when that board is disconnected and a new board that is connected, the new board will use the same Com port number.

From now on, each new Arduino DUE will use the same Com port assignment.

Yes, this is an old XP box. Not sure about Win7.

-Chris

The "IgnoreHWSerNumvendor" is good way for mass production.

Tip:
I also had a large number of USB COM ports (by present and non present devices), so I quickly delete all of them and rescan for present only devices by script

DeleteAllUSBComPorts.bat (2.11 KB)

devcon_x86.exe (54.5 KB)

devcon_x64.exe (68.5 KB)

(deleted)