Cannot get access to /dev/ttyACM0

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
garnold
Posts: 7
Joined: Sat Mar 06, 2021 11:32 pm

Re: Cannot get access to /dev/ttyACM0

Post by garnold » Wed Mar 17, 2021 12:27 am

aivarannamaa wrote:
Fri Mar 12, 2021 7:30 am
From the screenshot I see that you have older Thonny, which doesn't know about Pico.

The "MicroPython (generic)" back-end together with the port it's showing, should work, though.

If you want newer Thonny, then you can `apt remove thonny` and install a Thonny+Python bundle with following command:

Code: Select all

bash <(wget -O - https://thonny.org/installer-for-linux)
OK that was the problem, it was an older version. I was installing with the Thonny installer and thought I was doing it correctly. What was that script from?

So, now that the Pico problem is solved, can you help me figure out why the Thonny UI is so tiny? This is not a Thonny issue, I have been having this issue with many other apps as well and have been asking all over the place for help with no success. The older version of Thonny did not have this issue but the one I just grabbed does. I wonder what is up?
Screenshot from 2021-03-16 20-23-25.png
Screenshot from 2021-03-16 20-23-25.png (211.34 KiB) Viewed 5849 times

User avatar
aivarannamaa
Posts: 171
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: Cannot get access to /dev/ttyACM0

Post by aivarannamaa » Wed Mar 17, 2021 7:40 am

@garnold, which distro and which version are you using? Please also tell your screen resolution

You could try different font scaling mode at "Tools => Options => General".

Please let me know, whether you had success or not.

I've seen such reports before (https://github.com/thonny/thonny/issues/1113), but I haven't been able to reproduce.
Aivar Annamaa
https://thonny.org

Doug
Posts: 2
Joined: Mon May 24, 2021 1:20 pm

Re: Cannot get access to /dev/ttyACM0

Post by Doug » Mon May 24, 2021 1:56 pm

Thank you aivarannamaa for your helpful advice [to others previously], you really helped me out. I now have Thonny 3.3.10 running sweetly on my Chomebook OS91 beta. The version of Thonny available in the ChromeOS/Crostini Linux Apps was well out of date which caused my confusion not being able to 'see' the RP2040 files list.
If you want newer Thonny, then you can `apt remove thonny` and install a Thonny+Python bundle with following command:

CODE: SELECT ALL
bash <(wget -O - https://thonny.org/installer-for-linux)
This is probably the wrong place to ask, but how do we get the ChromeOS version bumped from 3.1.2-1 to the RP2040 compatible current version? I'm sure being able to run Thonny/RP2040 would go down a treat in schools - I love it! :-)

Thank you.

User avatar
aivarannamaa
Posts: 171
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: Cannot get access to /dev/ttyACM0

Post by aivarannamaa » Mon May 24, 2021 3:09 pm

Thonny 3.1.2 probably comes from the stable Debian repo: https://packages.debian.org/source/stable/thonny

You need to first get the new version to the Debian Testing. From https://tracker.debian.org/pkg/thonny you can see that I'm one of the uploaders, but that's misleading -- I can only prepare the package but I don't actually have the permission to upload to the repository.

I'll try to find time for preparing the package this weekend and then I'll contact the other uploader about actual uploading.

I don't know what it takes to get the new version from Debian testing to Debian stable.

TBH, I'd rather not handle packaging for Linux repos myself. If you know someone who is interested in Thonny and has the skills and permission to upgrade packages in Debian and/or Ubuntu, then let him/her know that `thonny` package could use a new maintainer.
Aivar Annamaa
https://thonny.org

Doug
Posts: 2
Joined: Mon May 24, 2021 1:20 pm

Re: Cannot get access to /dev/ttyACM0

Post by Doug » Mon May 24, 2021 3:37 pm

Thanks for your reply Aivar.
If you know someone who is interested in Thonny and has the skills....
Sadly, no. I'm merely an amateur playing at these things. There is a Raspberry Pi club that used to meet in our town (Exeter,UK) but I've rather lost touch since all the Covid-19 'lock-downs' etc.

I'll try to find some support by way of the RP foundation forums and see what might happen. Maybe I'll post a link to your helpful advice so others might find it too.

All the best, Doug

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Cannot get access to /dev/ttyACM0

Post by pythoncoder » Tue Jun 08, 2021 3:54 am

I am experiencing intermittent problems accessing my Pi Pico on /dev/TTYACM0. The problem occurs after a power cycle (disconnecting and reconnecting the USB lead), and sometimes needs several power cycles before I can reconnect. When /dev/TTYACM0 is inaccessible it doesn't matter what tool I use to access it - mpremote, rshell and miniterm.py all fail:

Code: Select all

$ mpremote mount .
no device found
[adminpete@capybara]: /mnt/qnap2/data/Projects/MicroPython/micropython-micro-gui
$ rshell -p /dev/ttyACM0 --editor nano
Importing macros for MICRO GUI
Default macro file rshell_macros loaded OK.
Using buffer-size of 128
Connecting to /dev/ttyACM0 (buffer-size 128)...
failed to access /dev/ttyACM0
[adminpete@capybara]: /mnt/qnap2/data/Projects/MicroPython/micropython-micro-gui
$ miniterm.py /dev/ttyACM0 115200
could not open port '/dev/ttyACM0': [Errno 5] could not open port /dev/ttyACM0: [Errno 5] Input/output error: '/dev/ttyACM0'
[adminpete@capybara]: /mnt/qnap2/data/Projects/MicroPython/micropython-micro-gui
$ ls -l /dev/ttyACM*
crw-rw---- 1 root dialout 166, 0 Jun  8 04:39 /dev/ttyACM0
[adminpete@capybara]: /mnt/qnap2/data/Projects/MicroPython/micropython-micro-gui
$ 
Once the RP2 is running I can disconnect and reconnect all day without issue. It is only the connection after a power cycle that is unreliable. My USB lead is short and firmware is yesterday's daily build.

I have never seen this problem on Pyboards, ESP32 or ESP8266 so it has the look of an RP2 bug to me. Is anyone else experiencing this?
[EDIT]
On reflection this could be an electrical problem. I am powering a display from the Pico 3V3 supply. While total current is fine at about 60mA, it's possible that decoupling capacitors on the display are slowing the risetime of the supply and making boot unreliable. I will investigate.
Peter Hinch
Index to my micropython libraries.

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: Cannot get access to /dev/ttyACM0

Post by hippy » Wed Jun 09, 2021 2:49 pm

pythoncoder wrote:
Tue Jun 08, 2021 3:54 am
I am experiencing intermittent problems accessing my Pi Pico on /dev/TTYACM0. The problem occurs after a power cycle (disconnecting and reconnecting the USB lead)
Yours might not be the same problem - and certain aspects of what you describe suggests it isn't - but I have suffered problems with the ACM-CDC drivers breaking under Raspberry Pi OS on USB disconnection or issuing a reset. That can prevent /dev/ttyACM0 from appearing, sometimes freezes my Pi, can require a power-pull to reboot or shutdown.

Even if not that it might be worth checking if there's any useful information from 'dmesg' when you cannot access the port.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Cannot get access to /dev/ttyACM0

Post by pythoncoder » Thu Jun 10, 2021 5:09 pm

Good idea. Here is the relevant output:

Code: Select all

[ 1752.750204] usb 1-1: new full-speed USB device number 5 using xhci_hcd
[ 1752.901103] usb 1-1: New USB device found, idVendor=2e8a, idProduct=0005, bcdDevice= 1.00
[ 1752.901108] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1752.901111] usb 1-1: Product: Board in FS mode
[ 1752.901113] usb 1-1: Manufacturer: MicroPython
[ 1752.901115] usb 1-1: SerialNumber: e66038b7132d1534
[ 1753.518499] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
[ 1753.518752] usbcore: registered new interface driver cdc_acm
[ 1753.518752] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 1759.586815] cdc_acm 1-1:1.0: acm_port_activate - usb_submit_urb(ctrl irq) failed
[adminpete@capybara]: ~
$ 
Presumably the last three lines are trying to tell us something? By contrast here is the output when the port was accessible

Code: Select all

[ 2005.267403] usb 1-1: new full-speed USB device number 7 using xhci_hcd
[ 2005.417953] usb 1-1: New USB device found, idVendor=2e8a, idProduct=0005, bcdDevice= 1.00
[ 2005.417956] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2005.417958] usb 1-1: Product: Board in FS mode
[ 2005.417959] usb 1-1: Manufacturer: MicroPython
[ 2005.417961] usb 1-1: SerialNumber: e66038b7132d1534
[ 2005.421230] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
[adminpete@capybara]: ~
$ 
Peter Hinch
Index to my micropython libraries.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Cannot get access to /dev/ttyACM0

Post by dhylands » Thu Jun 10, 2021 5:51 pm

Not sure if this is relevant, but I thought I'd throw it out there. Have you tried putting a hub between your RPi and your host. Sometimes adding/removing a hub helps.

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: Cannot get access to /dev/ttyACM0

Post by hippy » Thu Jun 10, 2021 7:36 pm

Code: Select all

[ 1759.586815] cdc_acm 1-1:1.0: acm_port_activate - usb_submit_urb(ctrl irq) failed
I would also guess that is the issue when things don't work. I have no idea what it means or how to resolve it. "Try a hub" sounds like good advice.

Just for reference I see much the same as you get when it works. This was plugging a Pico in to a Pi 3B (non-plus) shortly after a fresh reboot. It's running my own MicroPython build with 'tusb' configured for three ACM ports ...

Code: Select all

[   33.944488] usb 1-1.4: new full-speed USB device number 7 using dwc_otg
[   34.080790] usb 1-1.4: unable to get BOS descriptor or descriptor too short
[   34.101914] usb 1-1.4: New USB device found, idVendor=2e8a, idProduct=c003, bcdDevice= 1.00
[   34.101935] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   34.101952] usb 1-1.4: Product: GenUsb-3C
[   34.101967] usb 1-1.4: Manufacturer: GenUsb
[   34.101983] usb 1-1.4: SerialNumber: E660081007307531
[   34.186120] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device
[   34.189714] cdc_acm 1-1.4:1.2: ttyACM1: USB ACM device
[   34.201242] cdc_acm 1-1.4:1.4: ttyACM2: USB ACM device
[   34.202361] usbcore: registered new interface driver cdc_acm
[   34.202377] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

Post Reply