machine.reset() on Pico W causes [Errno 2] No such file or directory: '/dev/ttyACM0'

457 views
Skip to first unread message

Arpad Jordan

unread,
Feb 4, 2023, 11:36:06 AM2/4/23
to thonny
I connect to REPL of my Raspberry Pi Pico W from Thonny running on my Raspberry Pi Zero W via USB successfully via /dev/ttyACM0

But whenever I execute machine.reset() I loose /dev/ttyACM0 permanently with error message cycling: [Errno 2] No such file or directory: '/dev/ttyACM0'

I can only recover by rebooting both.

When I issue machine.reset() in a minicom -D /dev/ttyACM0 session after a short interruption with an error message the session reconnects to /dev/ttyACM0 by pressing Enter.

This suggests to me that this has something to do with the difference Thonny and minicom handles machine.reset() so someone might can shed some light into this here.

Arpad Jordan

unread,
Feb 11, 2023, 5:50:40 AM2/11/23
to thonny
I realised from dmesg on Pi Zero W that machine.reset() on /dev/ttyACM0 causes the Pico W actually connecting back on /dev/ttyACM1 for some reason:

[ 1782.275948] usb 1-1: USB disconnect, device number 2
[ 1782.476026] Indeed it is in host mode hprt0 = 00021501
[ 1782.895736] usb 1-1: new full-speed USB device number 3 using dwc_otg
[ 1782.896170] Indeed it is in host mode hprt0 = 00021501
[ 1783.279255] usb 1-1: New USB device found, idVendor=2e8a, idProduct=0005, bcdDevice= 1.00
[ 1783.279305] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1783.279325] usb 1-1: Product: Board in FS mode
[ 1783.279341] usb 1-1: Manufacturer: MicroPython
[ 1783.279357] usb 1-1: SerialNumber: e6614c311b903c31
[ 1783.297138] cdc_acm 1-1:1.0: ttyACM1: USB ACM device

I can change the interpreter in Thonny to this new device and now machine.reset() on this new /dev/ttyACM1 causes the Pico W connecting back to /dev/ttyACM0 again:

[ 1913.026915] usb 1-1: USB disconnect, device number 3
[ 1913.226846] Indeed it is in host mode hprt0 = 00021501
[ 1913.596674] usb 1-1: new full-speed USB device number 4 using dwc_otg
[ 1913.597136] Indeed it is in host mode hprt0 = 00021501
[ 1913.948698] usb 1-1: New USB device found, idVendor=2e8a, idProduct=0005, bcdDevice= 1.00
[ 1913.948748] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1913.948768] usb 1-1: Product: Board in FS mode
[ 1913.948785] usb 1-1: Manufacturer: MicroPython
[ 1913.948800] usb 1-1: SerialNumber: e6614c311b903c31
[ 1913.968457] cdc_acm 1-1:1.0: ttyACM0: USB ACM device

--
You received this message because you are subscribed to a topic in the Google Groups "thonny" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/thonny/Dw6myx5_TGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to thonny+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thonny/0a5c6874-899d-4d84-8a54-8cb169c3ef82n%40googlegroups.com.

Arpad Jordan

unread,
Feb 14, 2023, 12:52:15 AM2/14/23
to thonny
I further realised that using Tools / Options / Interpreter / Port / <Try to detect port automatically> provides a reasonable experience automatically alternating between devices /dev/ttyACM[0,1].

I still prefer the behaviour of minicom that closes the device early enough for the kernel to enumerate machine.reset() pico with the same device name but I can appreciate Thonny is a much more complex application and I still enjoy using it :)

Reply all
Reply to author
Forward
0 new messages