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

Cannot get access to /dev/ttyACM0

Post by garnold » Wed Mar 10, 2021 10:45 pm

I'm trying to program a Pico with Thonny. When I look in the interpreter list inside of Thonny I do not see the Pico as an option. After following some very helpful guides on the web I have learned that this is some kind of permissions thing. I've been able to get access to the Pico via the REPL and can turn an LED on and off. This confirms that the board is good and that I am using the correct port name. What I still cannot do is get Thonny to see the Pico. Does anyone have some advice they might share please? Thank you!

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 » Wed Mar 10, 2021 11:52 pm

If you add your user to the dialout group then you should have permissions:

Code: Select all

usermod -a -G dialout $USER
After doing that you'll need to at least logout, perhaps reboot. Use the id command to verify that dialout appears in the list of groups.

garnold
Posts: 7
Joined: Sat Mar 06, 2021 11:32 pm

Re: Cannot get access to /dev/ttyACM0

Post by garnold » Thu Mar 11, 2021 12:17 am

Thank you for your reply. I've tried this with no success. I have logged out and back in to test. I have not completely rebooted and will give that a try to rule that out.

garnold
Posts: 7
Joined: Sat Mar 06, 2021 11:32 pm

Re: Cannot get access to /dev/ttyACM0

Post by garnold » Thu Mar 11, 2021 1:01 am

dhylands wrote:
Wed Mar 10, 2021 11:52 pm
If you add your user to the dialout group then you should have permissions:

Code: Select all

usermod -a -G dialout $USER
After doing that you'll need to at least logout, perhaps reboot. Use the id command to verify that dialout appears in the list of groups.
OK, well apparently a complete reboot was required to get my user account added to the group. If I run the Id command as you recommended I get the following results.

uid=1000(garnold) gid=1000(garnold) groups=1000(garnold),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare)

Still no luck seeing the Pico in Thonny. Again, I tested with the REPL and was able to get access.

Here is another link with some instructions but they are for Fedora. I do not know enough about Linux to start mixing and matching thing from different OS's. I just wanted to post this here because possibly someone with more knowledge then I could help me from what is being stated here. https://discussion.fedoraproject.org/t/ ... roup/24147

garnold
Posts: 7
Joined: Sat Mar 06, 2021 11:32 pm

Re: Cannot get access to /dev/ttyACM0

Post by garnold » Thu Mar 11, 2021 2:14 am

Very sorry for all the posts. So I decided to give a NodeMCU a try. Flashed just fine and I was able to connect to it perfectly from Thonny. I picked the ESP8266 interpreter and the serial port was in the drop down list. Not sure what's up with the Pico. I was able to program it just fine when I was running a standard Mac OS on this Macbook Pro. Ubuntu seems to be making it tough on me?

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 » Thu Mar 11, 2021 7:51 am

@garnold, do I understand correctly that `/dev/ttyACM0` is present but Thonny simply doesn't see it?

Please select the default back-end in Thonny (button at the lower-right corner) and try following commands on the Python 3 REPL:

Code: Select all

Python 3.7.9 (bundled)
>>> import serial.tools.list_ports as lp
>>> lp.main()
/dev/ttyACM0        
1 ports found
>>> serial.__version__
'3.5'
Tell me whether you get any ports, your PySerial version, Thonny version and how you installed Thonny (apt, pip, or downloading binary bundle)
Aivar Annamaa
https://thonny.org

garnold
Posts: 7
Joined: Sat Mar 06, 2021 11:32 pm

Re: Cannot get access to /dev/ttyACM0

Post by garnold » Fri Mar 12, 2021 2:32 am

After typing in your commands, here is the response.

Python 3.8.5 (/usr/bin/python3)
>>> import serial.tools.list_ports as lp
>>> lp.main()
/dev/ttyACM0
1 ports found
>>> serial.__version__
Traceback (most recent call last):
File "<pyshell>", line 1, in <module>
NameError: name 'serial' is not defined
>>>

I installed Thonny with apt. Does this information help? Thank you.

garnold
Posts: 7
Joined: Sat Mar 06, 2021 11:32 pm

Re: Cannot get access to /dev/ttyACM0

Post by garnold » Fri Mar 12, 2021 2:47 am

It seems as though Thonny does see this port but simply does not have the Raspberry Pi Pico in the interpreter list. See the attached image.
Screenshot from 2021-03-11 21-40-15.png
Screenshot from 2021-03-11 21-40-15.png (153.67 KiB) Viewed 16928 times

fdufnews
Posts: 76
Joined: Mon Jul 25, 2016 11:31 am

Re: Cannot get access to /dev/ttyACM0

Post by fdufnews » Fri Mar 12, 2021 7:29 am

Are you sure Thonny is up to date? The release on the repo is 3.2.7, currently on thonny.org the release is 3.3.6.
Maybe you can load the last release at thonny.org
Last edited by fdufnews on Sun Mar 14, 2021 6:35 pm, edited 2 times in total.

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 » 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)
Aivar Annamaa
https://thonny.org

Post Reply