mu icon indicating copy to clipboard operation
mu copied to clipboard

Raspberry Pi 400 "Could not find an attached device"

Open rtyley opened this issue 3 years ago • 6 comments

What were you trying to do?

Use Mu on a Raspberry Pi 400 to read the Serial out of a rp2040 CircuitPython device, wanted to see the Serial output

What steps did you take to trigger the issue?

Press 'Serial' menu button

What did you expect to happen?

Expected Mu's built in serial monitor to operate

What actually happened?

Mu gave a "Could not find an attached device" error - the video below shows the issue being recreated. Note that screen /dev/ttyACM0 115200 worked, and was able to display serial output - but Mu's in-built Serial view failed:

https://user-images.githubusercontent.com/52038/179762346-579a049a-fb49-465a-b4dd-ccfa38de4d89.mov

Operating System Version

Raspberry Pi OS (raspbian) 11 (bullseye)

Mu Version

1.0.3

Other Info

Tested with 2 different CircuitPython devices:

  • Keybow 2040 running CircuitPython 7.3.1
  • Pimoroni Pico LiPo 16MB running CircuitPython 7.2.5

Both devices are read ok with Mu running on my Ubuntu laptop and also on my Mac OS M1 Mac.

This issue seems similar/related to https://github.com/mu-editor/mu/issues/1596 / https://github.com/mu-editor/mu/issues/1543, though to be clear, I'm encountering the problem on a Raspberry Pi 400, rather than a M1 Mac

Editor Log

2022-07-19 12:04:50,402 - root:112(run) INFO: 



-----------------



Starting Mu 1.0.3

2022-07-19 12:04:50,403 - root:113(run) INFO: uname_result(system='Linux', node='raspberrypi', release='5.15.32-v7l+', version='#1538 SMP Thu Mar 31 19:39:41 BST 2022', machine='armv7l')

2022-07-19 12:04:50,403 - root:114(run) INFO: Python path: ['/usr/share/mu-editor', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages/IPython/extensions']

2022-07-19 12:04:50,403 - root:115(run) INFO: Language code: en_GB

2022-07-19 12:04:50,670 - mu.logic:543(__init__) INFO: Setting up editor.

2022-07-19 12:04:50,670 - mu.logic:560(__init__) DEBUG: Creating directory: /home/adorable/.local/share/mu

2022-07-19 12:04:50,671 - mu.logic:315(get_admin_file_path) DEBUG: Creating admin file: /home/adorable/.local/share/mu/settings.json

2022-07-19 12:04:50,671 - mu.logic:562(__init__) INFO: Settings path: /home/adorable/.local/share/mu/settings.json

2022-07-19 12:04:50,671 - mu.logic:315(get_admin_file_path) DEBUG: Creating admin file: /home/adorable/.local/share/mu/session.json

2022-07-19 12:04:50,672 - mu.logic:563(__init__) INFO: Session path: /home/adorable/.local/share/mu/session.json

2022-07-19 12:04:50,672 - mu.logic:564(__init__) INFO: Log directory: /home/adorable/.cache/mu/log

2022-07-19 12:04:50,672 - mu.logic:565(__init__) INFO: Data directory: /home/adorable/.local/share/mu

2022-07-19 12:04:50,705 - mu.logic:578(setup) INFO: Available modes: python, adafruit, microbit, debugger, pygamezero

2022-07-19 12:04:50,706 - mu.logic:582(setup) DEBUG: Creating directory: /home/adorable/mu_code

2022-07-19 12:04:50,706 - mu.logic:590(setup) DEBUG: Creating directory: /home/adorable/mu_code/images

2022-07-19 12:04:50,707 - mu.logic:597(setup) DEBUG: Creating directory: /home/adorable/mu_code/fonts

2022-07-19 12:04:50,708 - mu.logic:600(setup) DEBUG: Creating directory: /home/adorable/mu_code/sounds

2022-07-19 12:04:50,708 - mu.logic:603(setup) DEBUG: Creating directory: /home/adorable/mu_code/music

2022-07-19 12:04:51,401 - mu.logic:1147(change_mode) INFO: Workspace directory: /home/adorable/mu_code

2022-07-19 12:04:51,404 - mu.logic:625(restore_session) INFO: Restoring session from: /home/adorable/.local/share/mu/session.json

2022-07-19 12:04:51,404 - mu.logic:626(restore_session) DEBUG: {}

2022-07-19 12:04:51,404 - mu.logic:1104(select_mode) INFO: Showing available modes: ['python', 'adafruit', 'microbit', 'debugger', 'pygamezero']

2022-07-19 12:04:55,314 - mu.logic:1110(select_mode) INFO: New mode selected: adafruit

2022-07-19 12:04:55,441 - mu.interface.main:723(show_message) DEBUG: Could not find an attached Adafruit CircuitPython device.

2022-07-19 12:04:55,442 - mu.interface.main:724(show_message) DEBUG: Python files for Adafruit CircuitPython devices are stored on the device. Therefore, to edit these files you need to have the device plugged in. Until you plug in a device, Mu will use the directory found here:



 /home/adorable/mu_code



...to store your code.

2022-07-19 12:04:58,919 - mu.logic:1147(change_mode) INFO: Workspace directory: /home/adorable/mu_code

2022-07-19 12:04:58,984 - mu.logic:678(restore_session) INFO: Starting with blank file.

2022-07-19 12:04:59,077 - mu.logic:1147(change_mode) INFO: Workspace directory: /home/adorable/mu_code

2022-07-19 12:05:02,969 - mu.modes.base:231(find_device) WARNING: Could not find device.

2022-07-19 12:05:02,970 - mu.modes.base:232(find_device) DEBUG: Available ports:

2022-07-19 12:05:02,970 - mu.modes.base:233(find_device) DEBUG: ['PID:0x08c6 VID:0x16d0 PORT:ttyACM0', 'PID:0x0000 VID:0x0000 PORT:ttyAMA0']

2022-07-19 12:05:02,972 - mu.interface.main:723(show_message) DEBUG: Could not find an attached device.

2022-07-19 12:05:02,974 - mu.interface.main:724(show_message) DEBUG: Please make sure the device is plugged into this computer.



It must have a version of MicroPython (or CircuitPython) flashed onto it before the REPL will work.



Finally, press the device's reset button and wait a few seconds before trying again.

2022-07-19 12:05:06,484 - mu.modes.base:259(toggle_repl) INFO: Toggle REPL on.

2022-07-19 12:07:50,059 - mu.modes.base:231(find_device) WARNING: Could not find device.

2022-07-19 12:07:50,059 - mu.modes.base:232(find_device) DEBUG: Available ports:

2022-07-19 12:07:50,059 - mu.modes.base:233(find_device) DEBUG: ['PID:0x08c6 VID:0x16d0 PORT:ttyACM0', 'PID:0x0000 VID:0x0000 PORT:ttyAMA0']

2022-07-19 12:07:50,062 - mu.interface.main:723(show_message) DEBUG: Could not find an attached device.

2022-07-19 12:07:50,062 - mu.interface.main:724(show_message) DEBUG: Please make sure the device is plugged into this computer.



It must have a version of MicroPython (or CircuitPython) flashed onto it before the REPL will work.



Finally, press the device's reset button and wait a few seconds before trying again.

2022-07-19 12:07:52,401 - mu.modes.base:259(toggle_repl) INFO: Toggle REPL on.

2022-07-19 12:08:20,621 - mu.logic:1075(show_admin) INFO: Showing logs from /home/adorable/.cache/mu/log/mu.log

2022-07-19 12:14:33,674 - mu.modes.base:231(find_device) WARNING: Could not find device.

2022-07-19 12:14:33,676 - mu.modes.base:232(find_device) DEBUG: Available ports:

2022-07-19 12:14:33,676 - mu.modes.base:233(find_device) DEBUG: ['PID:0x08c6 VID:0x16d0 PORT:ttyACM0', 'PID:0x0000 VID:0x0000 PORT:ttyAMA0']

2022-07-19 12:14:33,682 - mu.interface.main:723(show_message) DEBUG: Could not find an attached device.

2022-07-19 12:14:33,683 - mu.interface.main:724(show_message) DEBUG: Please make sure the device is plugged into this computer.



It must have a version of MicroPython (or CircuitPython) flashed onto it before the REPL will work.



Finally, press the device's reset button and wait a few seconds before trying again.

2022-07-19 12:14:38,932 - mu.modes.base:259(toggle_repl) INFO: Toggle REPL on.

2022-07-19 12:14:41,503 - mu.modes.base:231(find_device) WARNING: Could not find device.

2022-07-19 12:14:41,503 - mu.modes.base:232(find_device) DEBUG: Available ports:

2022-07-19 12:14:41,504 - mu.modes.base:233(find_device) DEBUG: ['PID:0x08c6 VID:0x16d0 PORT:ttyACM0', 'PID:0x0000 VID:0x0000 PORT:ttyAMA0']

2022-07-19 12:14:41,506 - mu.interface.main:723(show_message) DEBUG: Could not find an attached device.

2022-07-19 12:14:41,506 - mu.interface.main:724(show_message) DEBUG: Please make sure the device is plugged into this computer.



It must have a version of MicroPython (or CircuitPython) flashed onto it before the REPL will work.



Finally, press the device's reset button and wait a few seconds before trying again.

2022-07-19 12:14:42,626 - mu.modes.base:259(toggle_repl) INFO: Toggle REPL on.

2022-07-19 14:06:34,615 - mu.logic:1075(show_admin) INFO: Showing logs from /home/adorable/.cache/mu/log/mu.log

rtyley avatar Jul 19 '22 13:07 rtyley

I've realised that Raspberry Pi OS (Debian bullseye) has a fairly old version of Mu: 1.0.3, from January 2020:

https://packages.debian.org/bullseye/mu-editor

image

On Mac, I'm using Mu 1.1.1, which works well, but there is no more recent version of Mu than 1.0.3 available I can find that will run on 32-bit Debian Bullseye (Mu's downloads offers Linux AppImage Package (Experimental)), but that is 64bit & x86 (rather than ARM), so far as I can see).

I also notice that PR https://github.com/mu-editor/mu/pull/2263 may apply, because I've renamed my CircuitPython device from CIRCUITPY to LEGO-TARDIS (but even renaming it back to CIRCUITPY doesn't fix the problem on the Raspberry Pi).

rtyley avatar Jul 19 '22 14:07 rtyley

You are right, the main issue is that debian package is at v1.0.3, which is very old and predates the RP2040 devices, so Mu v1.03, which at the time used USB VID and PIDs, doesn't have the values for this devices in the source code.

Unfortunately due to the current dependencies Mu uses it is not compatible with Python 3.8, so there is no simple way to install it in Raspbian Bullseye, which comes with Python 3.9.

That being said, the main limiting factor for the Python 3.8 max version is PyQt, and to install Mu from source in PiOS you need to use the PyQt5 packages from apt, so you might be able to get it working by following the dev instructions but using the --ignore-requires-python flag for the pip install step: https://mu.readthedocs.io/en/latest/setup.html#raspberry-pi

pip install -e ".[dev]" --ignore-requires-python

carlosperate avatar Jul 19 '22 14:07 carlosperate

You are right, the main issue is that debian package is at v1.0.3, which is very old and predates the RP2040 devices, so Mu v1.03, which at the time used USB VID and PIDs, doesn't have the values for this devices in the source code.

Unfortunately due to the current dependencies Mu uses it is not compatible with Python 3.8, so there is no simple way to install it in Raspbian Bullseye, which comes with Python 3.9.

That being said, the main limiting factor for the Python 3.8 max version is PyQt, and to install Mu from source in PiOS you need to use the PyQt5 packages from apt, so you might be able to get it working by following the dev instructions but using the --ignore-requires-python flag for the pip install step: https://mu.readthedocs.io/en/latest/setup.html#raspberry-pi

pip install -e ".[dev]" --ignore-requires-python

Hello amigo, I tried this solution but it fails to run the run.py file. I Have collected the log file for the installation process mu_editor_installation-log.txt

as well as the error message which is the following error_message.txt

thanks for your help

xav-e avatar Apr 07 '24 17:04 xav-e