Programmer not recognizing correct ports

I have a Linux machine that I use to program my Arduino Uno boards. I have difficultys getting them to communicate with the Uno because the IDE does not recognize the correct port that is hooked up to the Uno. My computer has 3 sets of USB ports with various things hooked up to them. A printer, keyboard, mouse, camera, cellphone link, arduino uno, Stmicro Nucleo, and an SD card reader. My first Uno board always wanted to use ttyS0 whether it was on it or not so lots of time trying to get it to respond to ttyS0 instead of ttyACM0. The serial monitor always has ttyS0 there even if it is grayed out. My new Uno worked after a dozen trys but after a disconnect it no longer works. I can use the lsusb command on the termnal to find out what is assigned. Uno is on bus 3 device 12. the device lock was set for ttys8 when I checked last. The error message on attempt to download sketches is that the programmer is not in sync. At the bottom of the IDE page it shows the device is trying to use ttyS0. It is not the current correct one.

I think the IDE program needs to be fixed so it reads and reports all ports so you can choose the correct one from the Tools menu. Or maybe it could automatically read the ports and find out what port the Uno is on and use it.

Thanks for your concern for developing programming by doing the Arduino line.

In Linux the device names allocated to Arduino boards are dynamically allocated when the boards are connected and often change when the boards are disconnected and then re-connected. This is a pain in the **** but using 'udev' (Google is your friend) one can allocated fixed names.

Each port on a USB hub has an 'address' (my terminology) that is a static function of the position of the port in the USB hierarchy. This address is fixed as long as the USB topology is not changed. One creates a file in the /etc/udev/rules.d directory that contains lines which define the names. For example my udev file is named 99-usb-serial.rules and contains lines looking like

SUBSYSTEM=="tty", KERNELS=="1-3.4.4:1.0", SYMLINK+="ttyUSB99-nano", GROUP="dialout"

This tells udev to create the symbolic link in /dev named "ttyUSB99-nano that is a member of group "dialout" with USB address "1-3.4.4:1.0"

One first disconnects the Arduino and lists the ttys in /dev using "ls /dev/tty*" then one re-connects the Arduino and again lists the devices in /dev. The Arduino will show up with a device name of the form ttyUSBx where 'x' is a number.

One can find the USB address of a particular port by using the command "udevadm info --attribute-walk /dev/ttyUSBx" ; it will be the first "SUBSYSTEMS==" value.

Each time the Arduino is plugged in the device name may be different but the symbolic name will be the same and it is this symbolic name one uses in the Arduino IDE.

Installation of udev is easy using "sudo apt-get install udev" and you may need to add yourself to the "dialout" group

This all may seem like hard work but once one gets over the initial learning curve it becomes fairly painless.