mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.41k stars 435 forks source link

Could not find an attached device #1596

Closed jmlippincott closed 3 years ago

jmlippincott commented 3 years ago

Bug Report

What were you trying to do?

Open Serial monitor or Plotter within Mu

What steps did you take to trigger the issue?

Press 'Serial' or 'Plotter' menu button

What did you expect to happen?

Expected the built in serial monitor or plotter function to operate

What actually happened?

Error message: Could not find an attached device

Why is this difference problematic? (it might not be a bug!)

Technical Info

Other Info

Editor Log

Mu Log.txt

carlosperate commented 3 years ago

Thanks for the report @jmlippincott, could you try to access the Mu Serial with an attached device and and send us the log immediately after the error is shown? This will help us see more information about what might be happening.

jmlippincott commented 3 years ago

That's the confusing piece here; the device is attached and Mu is able to edit/save the code.py from the device. I've attached the most recent log, immediately following an attempt to open Mu Serial. I've also attached a screenshot to show the REPL from the device, active in my Mac OSX terminal (iTerm 2 + oh-my-zsh), next to the window of Mu Editor showing the code.py loaded from the device, while also showing the "Could not find an attached device" error.

screenshot_22

Mu Log.txt

carlosperate commented 3 years ago

Thanks for adding the new log with the extra info. This is the relevant part:

2021-05-26 12:27:06,147 - mu.interface.main:942(show_message) DEBUG: Could not find an attached device.
2021-05-26 12:27:06,147 - mu.interface.main:943(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.
2021-05-26 12:27:29,218 - mu.modes.base:474(toggle_repl) INFO: Toggle REPL on.
2021-05-26 12:27:32,072 - mu.interface.main:942(show_message) DEBUG: Could not find an attached device.
2021-05-26 12:27:32,073 - mu.interface.main:943(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.
2021-05-26 12:27:35,169 - mu.modes.base:474(toggle_repl) INFO: Toggle REPL on.

So it's not seeing the serial device at all (I was hoping maybe it was a permission error). By any chance are you running Mu on an M1 macOS?

jmlippincott commented 3 years ago

I am, yes! Sorry, didn't realize that was a relevant piece of information. screenshot_23

carlosperate commented 3 years ago

Only relevant because it was a known issue with detecting the serial port in the M1: https://github.com/mu-editor/mu/issues/1543

Normally the CPU architecture is captured in the log, but because Mu runs with Rosetta it reports as x86_64.

One thing you can try to do is update the adafruit_board_toolkit dependency, which contains a fix. From the directory where Mu.app is installed (likely /Applications) you could try:

mu-editor.app/Contents/Resources/Python/bin/python3.8 -m pip install --upgrade adafruit_board_toolkit
jmlippincott commented 3 years ago

Fixed! Thanks so much! screenshot_24 screenshot_25

carlosperate commented 3 years ago

Awesome, glad you got it working! Thanks so much for the report and all the testing, let us know if you find something else 👍

dhalbert commented 3 years ago

Glad and relieved to see the fix works in real life.