Path: csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Don Kuenz Newsgroups: sci.electronics.design Subject: Re: Windows USB question Date: Tue, 14 Nov 2017 18:00:27 -0000 (UTC) Organization: A noiseless patient Spider Lines: 58 Distribution: world Message-ID: <20171114a@crcomp.net> References: Injection-Date: Tue, 14 Nov 2017 18:00:27 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="a7511082335c683dd809e337bc3fce1e"; logging-data="23108"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18V5rsOJ/yf3yu1J08Fw7JW" Cancel-Lock: sha1:kYk8sUVIdFRLDERmfn+zxPWYr6I= Xref: csiph.com sci.electronics.design:485182 David Brown wrote: > On 13/11/17 19:43, John Larkin wrote: >> >> >> Some times we want to use a USB port, often through an FTDI serial >> converter chip, to talk to a device or to a test set. Under Windows, >> the COMn port seems to come up with random n. >> > > The one FTDI device plugged into the /same/ USB port on the PC will get > the same COM number each time. Plug it into a different physical port > (or hub), and it can get a different COM number. If this is on a test > machine and you use the same FTDI devices each time, some labelling > should help get the same devices in the same ports each time. > Alternatively, glue is quite a good solution. > > There are a couple of ways around this. FTDI had an extra "secret" > driver configuration setting that fixes the COM number based on the > physical port number. This is designed for production and testing when > the cards being produced have FTDI chips. I don't know if this still > works on current Windows. > > Another way is to forget the COM port drivers. Use the FTDI dll's and > their specific functions. They let you easily check for all FTDI > devices attached to the PC, and identify them based on device serial > number and/or physical port. Then you can open the devices and read and > write to them much like a COM port. > >> Sometimes we write a program to scan all the comm ports, looking for >> our target device. That can be messy. >> >> Does anyone know of a way to reserve or nail a USB com port? >> Apparently that is not a problem with Linux. >> > > Yes, Linux is /massively/ easier in this way. I have a USB hub stuck to > my desk, plugged into my Linux machine. When I put an FTDI device into > port X on the hub, I have a serial port /dev/ttySerial_X. If the device > has two UARTs, I get /dev/ttySerial_X1 and /dev/ttySerial_X2. You can > set things up as you want - it's just a couple of lines of udev > configuration file. My favorite OS, FreeBSD, probably does likewise. The only problem is that most people don't use FreeBSD nor Linux. Most people use some version of Windows. My onsite kit includes an ancient Windows Vista tablet "beater" with a FTDI RS-232 dongle. The dongle perpetually vacillates between COM1 and COM5 whenever it's plugged in. Sleuthing out the latest COM port's more of a nuisance than anything. This thread, along with FTDI Application Note 123, helps me to understand why the vacillations occur. This thread also enhances my appreciation as to the many permutations that a vendor must foresee and accommodate in order to keep USB as seamless as possible for the masses. Thank you, -- Don Kuenz, KB7RPU