Shop OBEX P1 Docs P2 Docs Learn Events
Too many USB ports? — Parallax Forums

Too many USB ports?

Tracy AllenTracy Allen Posts: 6,664
edited 2015-10-20 21:49 in General Discussion
We have to program several hundred Propeller chips each with its own FT231X USB port. This on a PC running Windows XP, 7 or 8. It goes along smoothly for some time, but then suddenly no joy. New ones won't program.

Upon looking at device manager/USB/hidden devices, the list goes on and on, all not present. A couple hundred, as each new FT231 spawns a new one.

Could that be a problem and if so what to do about it? We can delete them but only one at a time, seemingly. Restarts and reloading the driver doesn't help.

For now we're using a Mac to flash the eeproms, because the PCs seem to be brain dead for the purpose.

«1

Comments

  • Cluso99Cluso99 Posts: 18,069
    The reason is that each FT231X has an internal serial number which uniquely identifies each individual FT231X. So each time you add a new FT231X, a new device is added to Windows. The same "should" happen with the other OSes.

    This also happens with FT232RL (propplugs) so you can have multiple propplugs connected at the same time, and each can be individually addressed.

    I cannot help you overcome this problem. Have you tried google?
  • PublisonPublison Posts: 12,366
    edited 2015-10-20 22:31
    That happened with Ken at the OSH Expo where he and Searith were programming the the Hackable Badges. They had to go clean them out after a while.

    Some wrote a macro or a bat file in the last two weeks to take care of it, but I can not find it right now.
    Will check in the morning.
  • Heater.Heater. Posts: 21,230
    edited 2015-10-20 23:00
    Cluso99,
    The same "should" happen with the other OSes.
    Indeed it can. It's a real pain some times.

    In a non-gui OS that is easy to fix though. Just bind the device vendor and and product identities to a particular device name by hacking a udev rules file. Then whenever you plug in the same USB/Serial adapter it appears as the same serial device name.

    In a GUI OS it's harder of course but I believe possible: http://www.cypress.com/knowledge-base-article/binding-drivers-usb-serial-bridge-controller-custom-vidpid-kba92528 TL;DR


  • Publison wrote: »
    That happened with Ken at the OSH Expo where he and Searith were programming the the Hackable Badges. They had to go clean them out after a while.

    Some wrote a macro or a bat file in the last two weeks to take care of it, but I can not find it right now.
    Will check in the morning.

    See if this helps:

    http://forums.parallax.com/discussion/162301/removing-old-hidden-com-ports-in-windows
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2015-10-21 00:39
    Thanks. That environment variable must already be set, because the hidden ports show up anyway in the device manager Ports heading when I choose "View > Show Hidden Devices". Some of them have port numbers after them in parens, others don't. When I plug in a previously used FT231 device, its port goes from grey to dark.

    I can delete ports one by one, but it is a painstaking process. The highest number is 256. Is that a magic number?

    There is a correspondingly long list under the Universal Serial Bus Controllers heading. "Currently this hardware device is not connected to the computer (Code 45). To fix the problem, reconnect this hardware device to the computer." Duh!

    It seems like a macro would be a great help.
  • With the FT232RL, you can reprogram the serial numbers so that they're all the same. If you can do the same with the FT231X, that might be a solution.

    -Phil
  • I have an even better version of this problem. I have an old XP desktop with a Rocketport 16 serial expansion board which I use for development. Whenever I plug a new FTDI device in it takes port COM3, stomping the first RocketPort which also jams the FTDI driver so I have to do the whole device manager goat rodeo to change it to another port so it will work at all. It's supposedly possible to tie the FTDI port assignment to the USB port instead of the serial number, but I got half-way through the instructions a couple of years ago and my eyes glazed over and they had to call some paramedics.
  • dgatelydgately Posts: 1,630
    edited 2015-10-21 03:06
    Heater. wrote: »
    Cluso99,
    The same "should" happen with the other OSes.
    Indeed it can. It's a real pain some times.

    In a non-gui OS that is easy to fix though. Just bind the device vendor and and product identities to a particular device name by hacking a udev rules file. Then whenever you plug in the same USB/Serial adapter it appears as the same serial device name.

    In a GUI OS it's harder of course but I believe possible: http://www.cypress.com/knowledge-base-article/binding-drivers-usb-serial-bridge-controller-custom-vidpid-kba92528 TL;DR

    On 'ix-based systems (Linux, Mac OS X, Unix), you indeed get a different device name, but a good GUI or command-line program should be able to discern a newly plugged-in device and either give the user an opportunity to choose or automagically pick the 'newest device' for uploading. The program could store device names and test against the list of known devices when a new device is plugged-in.

    EDIT: There's an open-source variant of such a program inside SimpleIDE sources :smile: Well, that code has been updated to use QT libraries :frown:

    On Windows, it appears that some indeterminate number of COM ports becomes unmanageable for app use (at least that's what I understand from reading posts on this forum)... So, some form of reset of devices is required.

    dgately
  • This problem first surfaced when using the FTDI utility, FT_PROG to change the settings in the FT231. We had used one computer exclusively for that and it was the first one to ghost out. Where the heck do the spooks reside?

    Phil, One can indeed set the serial number on the FT231, using FT_PROG. Interesting idea to make them all the same. I'm not convinced I would want to do that, though. On the Mac, I like seeing the serial number appear in drop-down lists, especially in the scenario where more than one Prop is connected to the computer. What would happen if all the serial numbers are the same, is it cosmetic or substantive confusion?
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2015-10-21 11:26
    The FTDI information and port numbers for FTDI devices are found in the registry at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\FTDIBUS"
    for example HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\FTDIBUS\VID_0403+PID_6001+6&257edd14&0&4\0000\Device Parameters PortName=COM8

    There will also be a related registry value under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB
    for example: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_0403&PID_6001

    The attached zip file contains an HTML application file called Enumports.hta which uses vbscript to enumerate ports - it also works on WIN7

    It may help you find and delete the registry entries freeing up COM ports

    enumports.jpg
    1438 x 519 - 189K
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-21 12:49
    So the issue seems to be Registry clutter accumulation.

    One could use the same computer with a Linux Live CD to achieve the task and not have to deal with Microsoft's approach to ports. I suspect that a copy of Puppy Linux might make everything get done with less complexity.

    There are situations where using Linux booted from CD or USB memory stick is an easier way to deploy a special task on your 'normally Windows' computer. People have been doing this for 3D printing for quite some time now. When you aren't doing 3D printing, the computer just boots from hard disk as a normal Windows machine.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2015-10-21 13:11
    So the issue seems to be Registry clutter accumulation.

    I wouldn't call it clutter - those entries are what allows a device to use the same COM port each time it is connected.

    NOTE: The enumports.hta I attached let's you add the descriptions like you see in the image. Clicking a description opens a dialog box which lets you store a description if you first manually add a registry key of HKEY_CURRENT_USER\Software\FTDI Devices
  • The whole Registry concept in Windows drives me nuts.
  • The whole Registry concept in Windows drives me nuts.

    I poke around a lot in the workings of Windows 7. I have to admit, the more I find out about the registry, the more bizarre it seems. However, I'm almost certain there's nothing in there that should cause Linux users to go nuts.
  • TorTor Posts: 2,010
    I think if Windows got rid of the registry (one of the biggest design mistakes ever) I believe a lot of its trouble would simply go away, and we would be left with a reasonably sensible operating system. Well, NTFS should go too.. a fragmentation factory if I ever saw one. Even when just a quarter full. What a relief to go back to XFS which can so very easily be kept nearly full and still at zero point naught something fragmentation.

    -Tor
  • Heater.Heater. Posts: 21,230
    RDL2004,
    However, I'm almost certain there's nothing in there that should cause Linux users to go nuts.
    Maybe not nuts exactly. But how does one hack the registry with vim? How does one back up all the setting for some particular program or service? Why is it such a pain for everyone?
  • RDL2004RDL2004 Posts: 2,554
    edited 2015-10-21 14:48
    I'm not sure what you mean by service, but it's not hard at all for software to work without using the registry. That's one of the biggest issues I have with the registry - software that uses it it to store all kinds of trivial garbage that really should be stored elsewhere.

    Why do so many developers make their software a pain to use by relying on the registry? I have lots of programs that run in "portable" mode. They do not need to be "installed" and don't reside on the C drive. I can completely reinstall Windows and they will continue to work properly.
  • Heater.Heater. Posts: 21,230
    I was thinking "service" as in all those processes that run in the background. Web servers, database servers, DHCP servers etc etc. "Daemons" in Unix land.

    Just to add to the confusion Windows seems to have an "etc" directory as well now a days.
  • I did get a response from Cameron at FTDI.
    "You can manage COM port numbering by uninstalling the drivers , running our Set Ignore Serial Number application, followed by reinstalling the drivers." (links provided) I'll give it a try and report back.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2015-10-21 19:03
    I did get a response from Cameron at FTDI.
    "You can manage COM port numbering by uninstalling the drivers , running our Set Ignore Serial Number application, followed by reinstalling the drivers." (links provided) I'll give it
    a try and report back.

    Interesting - found some info here: http://www.ftdichip.com/Support/Knowledgebase/index.html?ignorehardwareserialnumber.htm
    I sometimes have more than one FTDI device connected at a time - not sure how that would work if they try to use the same COM port...
    FTDI Ignore Hardware Serial Number

    If devices have the same vendor ID and product ID but different serial numbers, the system will normally treat them as different devices. This causes the drivers to be installed for each device and create registry entries for each device.

    It is possible to override this behaviour to make the system ignore a device's serial number and treat all devices with matching VID and PID connected to the same USB port as if they were the same device. This is achieved by adding a

    REG_BINARY value called IgnoreHWSerNum to the registry and setting it to 01.

    This value is held in the registry key located at:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags\IgnoreHWSerNum{Device VID, PID and interface}


    For a default FTDI device ID (VID 0x0403, PID 0x6001), add the following registry REG_BINARY value set to 01:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags\IgnoreHWSerNum04036001


    For port A of an FT2232 device with default VID and PID, the IgnoreHWSerNum string would be:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags\IgnoreHWSerNum0403601000


    and for port B of an FT2232 device the IgnoreHWSerNum string would be:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags\IgnoreHWSerNum0403601001


    As the FT2232 device also uses the Windows composite device driver, an additional IgnoreHWSerNum entry is required to prevent Windows from creating additional composite driver registry entries:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags\IgnoreHWSerNum04036010


    Now the system can treat devices with the same vendor ID and product ID but different serial numbers as the same device and drivers are installed for the first device only. As such, only one entry is created in the registry. If the device is

    connected to another USB port, the driver will have to be reinstalled for that port.

    Note that IgnoreHWSerNum cannot be setup in FTDIBUS.INF or FTDIPORT.INF, it must be setup by editing the registry manually or by an installation utility BEFORE installing the driver.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2015-10-21 20:49
    Deleting COM ports using Device Manager does not remove the .inf files from the Windows\INF folder. When you install driver packages, their inf files are installed in that folder and renamed to OEMnn.inf where "nn" is just the next available number. (My enumports.hta shows the name of .inf file for you)

    There are Microsoft tools for uninstalling device driver packages:
    https://msdn.microsoft.com/en-us/library/windows/hardware/ff553525(v=vs.85).aspx

    I usually just delete the files and registry entries manually rather than installing any of development tools mentioned in the above link.

    I am attacking another html application which gives detailed info on installed drivers OEM and others as well

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2015-10-21 20:55
    Ron, thanks for the insight. This is an education! I asked Cameron if there would be a downside to running the fix, and he assured me that there would not be. I'll test to see if that has affected how it reacts to having multiple FTxxx/Propellers attached to one hub.

    On a Win 7 machine their uninstall utility did in fact exorcise the ghosts in the registry listings for serial ports and usb controllers.
    http://www.ftdichip.com/Support/Utilities.htm#CDMUninstaller
    VID=0402, PID=blank
    The nice thing is that it did it all at once, whereas doing it manually is verrrry slow

    Then their IgnoreSerialNumber utility + reinstall of the vcp/d2xx driver did in fact make it so that new devices no longer materialize new ghosts.
    http://www.ftdichip.com/Support/Utilities/IgnoreSerialNo.exe
    http://www.ftdichip.com/Drivers/CDM/CDM v2.10.00 WHQL Certified.exe

    The uninstall also worked on a Win8 machine, but so far it refuses to install IgnoreSerialNumber. The driver does reinstall though, with a fresh slate for ports, but each new device continues to add an entry for a port a USB controller.

    One thing Cameron said was to avoid USB 3.0 ports. Not sure why.


  • Then their IgnoreSerialNumber utility + reinstall of the vcp/d2xx driver did in fact make it so that new devices no longer materialize new ghosts.
    How are the ports assigned if you have several of those devices plugged in simultaneously. What happens when you unplug one and plug in another? Hopefully it would go:

    Plug-in: P4
    Plug-in: P4,P5
    Plug-in: P4,P5,P6
    Unplug P5: P4,P6
    Plug-in: P4,P5,P6

    Thanks,
    -Phil
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2015-10-22 01:06
    Phil, plugging/unplugging FT231X devices in sequence does happen as you surmised. A device replugged gets its old port number back. However, a new device gets the next sequential number, even if lower numbers are currently unused.
    unplug 5: 4,6
    replug the same one, 4,5,6
    but plug a new one, 4,6,7
    There are no hidden devices shown on the ports or usb controllers list though.

    The settings hold through resets. So, I have to wonder what is going to happen as the port number increases up into the hundreds? The hidden ghosts have been exorcised from the device manager, but all that history has to be stored somewhere.

    Oddly, the FT232RL is a bit different. Each new one connected takes the lowest number previously used by an FT232RL and does not spawn a new one unless all the previous ones are currently in use. (prop plug, stamp/usb, my own FT232RL). That would seem to make more sense.

    I haven't tried it yet with non-FTDI serial devices.
  • I ended up with 3 COM ports. Some of the newer propeller boards are VID 0403 PID 6015 (FTX series according to the IgnoreSerialNo.exe)
    while the older ones are VID 0403 PID 6001(FT232R according to the IgnoreSerialNo.exe)

    The old Parallax oscilloscope has it's own...

    new%20FTDI%20ports.JPG
    1412 x 285 - 86K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-10-22 02:05
    unplug 5: 4,6
    replug the same one, 4,5,6
    but plug a new one, 4,6,7

    But if it's ignoring serial numbers, how does it know that the new one is a new one? I should think it would just fill in the gap that was left by the old one. Doesn't this put you right back where you started?

    -Phil
  • My thought exactly. It's the same thing moved somewhere else. Back to FTDI for comment.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-22 04:44
    Being a 'security and licensing feature', I don't think that MS ever really wanted the Registry to be fully understood by the general public. They built the whole brand identity around servicing proprietary software that depends upon it.

    While you are sitting there waiting for your Windows to start, you might ponder that most of the delay is likely due to having the Registry verify the integrity of the OS at start-up.

    I suppose there are situations where a computer system might need to track the serial numbers of FTDI USB devices, but for most of us.. it is just a pile of trivial data -- bloat or clutter. The feature certainly go in the way of the OPs work.

    It is almost as if NSA is trying to put a serial number on every bit of hardware that might assist breaking into a computer. Just use your BIOS to turn off a bootable USB device, or sell computers with a BIOS that won't support remote loading of OSes.
  • Heater.Heater. Posts: 21,230
    Loopy,

    Being able to tie a particular USB/serial adapter to a particular device name "/dev/ttyUSB0" or "COM1:" or whatever is very useful if you have a bunch of devices and you are plugging them in and out now and then. It allows that you don't have to always plug the same device into the same USB port on your machine. It means you don't have to always go in and find the device name in your applications every time you use them.

    Plug and play you know.

    But it seems there is then the opposite problem. You may sequentially use a lot of different instances of a similar device. Which is the subject of this thread "We have to program several hundred Propeller chips each with its own FT231X USB port". In this case all those different devices would be better coming up as the same device name /dev/USB0" or "COM1:" or whatever.

    Plug and pray :)

    This is all easy to achieve under Linux with it's udev rules. I'm told it's much easier to do these things with a GUI based OS though :)





  • The Windows Registry is not a "security and licensing feature". The information Microsoft records concerning licensing and activation of the Windows operating system is not even stored in the Registry.

    The Registry is a database consisting of several files, one of which actually only exists in memory. The Registry not an executable program, it cannot verify anything. It is used mostly to store settings for the the operating system and software used by the operating system. Its use by non-operating system software and applications is optional for the most part.

Sign In or Register to comment.