element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum So why does the Arduino IDE connect to an Arduino using a different COM port each time a different one is plugged in, even tho each Arduino is plugged into the same USB connector to the PC ?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 11 replies
  • Subscribers 384 subscribers
  • Views 3184 views
  • Users 0 members are here
  • arduino ide
  • arduino
Related

So why does the Arduino IDE connect to an Arduino using a different COM port each time a different one is plugged in, even tho each Arduino is plugged into the same USB connector to the PC ?

robogary
robogary over 2 years ago

Curious minds want to know 

So why does the Arduino IDE connect to an Arduino using a different COM port each time a different one is plugged in, even tho each Arduino is plugged into the same USB connector to the PC ?

Is it related to he USB driver IC used on the Arduino board ? 

  • Sign in to reply
  • Cancel

Top Replies

  • genebren
    genebren over 2 years ago +5 verified
    This is the case with most USB devices. The USB transceivers are coded with unique serial numbers, and because of that, the drivers caused them to be assigned a unique COM id. On my development system…
  • beacon_dave
    beacon_dave over 2 years ago in reply to colporteur +3
    If the device vendor ID, product ID and serial number match then it should in theory get the same virtual COM port assignment each time, assuming it isn't currently active. If you type: set devmgr_show_nonpresent_devices…
  • BigG
    BigG over 2 years ago +2
    Having switched over to Linux OS on my computer years ago, I no longer have to experience this Windows COM port comedy. On the Arduino side, there is a core header file "usbconfig.h" which contains the…
Parents
  • genebren
    +1 genebren over 2 years ago

    This is the case with most USB devices.  The USB transceivers are coded with unique serial numbers, and because of that, the drivers caused them to be assigned a unique COM id.  On my development system at home, I am currently well over COM100.  I have a client that wants to have the USB device enumerate to the same COM number on a system, so I program a fixed Serial Number on the devices, so that any adapter that is connected on a give computer will enumerate to the same COM number.

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • colporteur
    0 colporteur over 2 years ago in reply to genebren

    Can I get some clarification. I find the Windows COM port comedy frustrating. Knowing the cause doesn't solve the problems but at least I have some understanding.

    USB transceivers have unique serial numbers S/N. USB COM drivers assign each S/N a COM ID. When a  USB device is detected, the driver deals out COM id's. Each time a new USB device is detected, the assignment begins again and may not remain consistent?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • beacon_dave
    0 beacon_dave over 2 years ago in reply to colporteur

    If the device vendor ID, product ID and serial number match then it should in theory get the same virtual COM  port assignment each time, assuming it isn't currently active.

    If you type:

       set devmgr_show_nonpresent_devices=1 

    from a command prompt before starting Device Manager, then select 'Show hidden devices' 

    image

    you should be able to see the virtual COM port assignments for both present and non present USB serial devices.

    Some issues may start to appear if you start using multiple devices with the same serial numbers at the same time (or perhaps if the device was still in use by an application when it was removed) as when the device is next plugged in, a new virtual COM port assignment may end up being created. The next time round then you now have two virtual COM port assignments allocated to the same VID/PID/serial number and it will depend on the enumeration order as to which virtual COM port you will be allocated for that device.

    A bit of 'housekeeping' in Device Manager can help keep things in order.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • beacon_dave
    0 beacon_dave over 2 years ago in reply to beacon_dave

    Just to add... a useful tool for viewing USB related information all in the one place is 'USBDeview' by NirSoft. It lists all the USB devices and displays extended information including VID PID, serial No, COM port allocation and so on for current and past devices. It might be a rather long list if you are above COM100 though.

    https://www.nirsoft.net/utils/usb_devices_view.html

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • cstanton
    0 cstanton over 2 years ago in reply to colporteur

    I find this happens with the Arduino Leonardo, the Uno doesn't suffer from this problem.

    In part of the programming procedure, Windows see the device do this:

    - Hi, I'm a serial device, upload code to me!

    - I'm no longer a serial device, I'm in programming mode, but you don't have a driver for me

    - Hi, I'm back to being a serial device, upload code to me!

    And it's this process which unhinges the COM port allocation. If you can manage to hold the Arduino Leonardo in its 'programmer' phase which Windows doesn't have a driver installed for (yet) then I found it doesn't suffer COM port hopping as badly. I can't remember how to get the Arduino Leonardo to stay in this mode.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Gough Lui
    0 Gough Lui over 2 years ago in reply to cstanton

    Double tap the reset button to force it into bootloader. LED will "breathe" in this mode. Good to recover a ATmega32u4 based board that has a faulty sketch interfering with USB loaded.

    - Gough

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Gough Lui
    0 Gough Lui over 2 years ago in reply to cstanton

    Double tap the reset button to force it into bootloader. LED will "breathe" in this mode. Good to recover a ATmega32u4 based board that has a faulty sketch interfering with USB loaded.

    - Gough

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube