Rcayot
Posts: 24
Joined: Sun Jan 26, 2020 8:24 pm

help with disappearing serial port

Sun Oct 25, 2020 12:38 am

Every once in a while, my Raspberry Pi 4B when running Arduino IDE will lose the port the board is connected to. I usually reboot and the correct serial port appears in the Arduino IDE.

for example, the board is always attached to the /dev/ttyACM1. When I get into trouble the IDE does not 'see' any port but the /dev/ttyACM0 port.

How can I check the status of the serial ports? Can I reset them from the shell?

Any help would be appreciated. A link to a good serial (really usb) Debian resource for basic troubleshooting would be helpful as well.

Roger

User avatar
DougieLawson
Posts: 40825
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: help with disappearing serial port

Sun Oct 25, 2020 12:47 am

They're assigned when the kernel detects the device. The only way to change a device is to disconnect (so the kernel forgets it) and re-attach it. Or if the device isn't powered from the USB connection to power cycle it.

There are no controls for this that you can use to get the kernel to forget a device unless you can for the kernel to unload the active device driver (with sudo rmmod ...; sudo modprobe ...).
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

cleverca22
Posts: 2901
Joined: Sat Aug 18, 2012 2:33 pm

Re: help with disappearing serial port

Sun Oct 25, 2020 12:49 am

Code: Select all

udevadm info -a -p /sys/class/tty/ttyUSB0 | less
if you run this on a given serial port, you can see exactly which device it is, and what driver is powering it
in my case:

Code: Select all

    ATTRS{interface}=="FT232R USB UART"

Rcayot
Posts: 24
Joined: Sun Jan 26, 2020 8:24 pm

Re: help with disappearing serial port

Sun Oct 25, 2020 12:15 pm

I ran the command:

udevadm info -a -p /sys/class/tty/ttyACM1 | less

and it said no such device,

I ran:

udevadm info -a -p /sys/class/tty/ttyACM0 | less

and it gave me a long report. Why has ACM1 disappeared? This was run after a fresh reboot.

Roger

cleverca22
Posts: 2901
Joined: Sat Aug 18, 2012 2:33 pm

Re: help with disappearing serial port

Sun Oct 25, 2020 6:36 pm

linux assigns ports starting at number 0
if 0 is still in-use when you plug the device in, then it becomes 1 instead

Return to “Troubleshooting”