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.39k stars 433 forks source link

Mu can't detect circuitpython if you change the usb interface name in circuit python #2428

Open darkyellow opened 1 year ago

darkyellow commented 1 year ago

What were you trying to do?

Edit code for Raspberry Pi Pico W

What steps did you take to trigger the issue?

I built circuitpython but changed the code to update the USB_INTERFACE_NAME, afdter doing this and flashing the new firmware

What did you expect to happen?

Mu to continue detecting circuitpython

What actually happened?

Mu was not able to detect the pico W board. The board was working fine and doing what it was programmed to do.

Operating System Version

Window 11

Mu Version

1.2.0

Other Info

When I rebuilt circuitpython with the original USB_INTERFACE_NAME it was again able to detect the pico W board

Editor Log

2023-06-29 05:50:41,438 - mu.interface.main:1047(show_message) DEBUG: Could not find an attached device. 2023-06-29 05:50:41,438 - mu.interface.main:1048(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.


After Reverting change


2023-06-29 09:15:10,147 - mu.interface.main:1075(show_confirmation) DEBUG: Detected new Raspberry Pi Pico device. 2023-06-29 09:15:10,147 - mu.interface.main:1076(show_confirmation) DEBUG: Would you like to change Mu to the RP2040 mode? 2023-06-29 09:15:25,932 - mu.modes.base:61(get_default_workspace) INFO: Using workspace C:\Users\XXXX\mu_code from settings file 2023-06-29 09:15:25,932 - mu.logic:1583(change_mode) INFO: Workspace directory: C:\Users\XXXX\mu_code 2023-06-29 09:15:25,932 - mu.logic:756(check_usb) INFO: pico device connected on port: COM8(VID: 0x2E8A, PID: 0x0005, manufacturer: 'Microsoft')

dhalbert commented 1 year ago

This is expected behavior: Mu detects the board by looking at the CDC interface name, using https://github.com/adafruit/Adafruit_Board_Toolkit. See compatible_board() in https://github.com/mu-editor/mu/blob/master/mu/modes/circuitpython.py. You could change the code there or in the toolkit to detect your board. But the current choice is for vanilla boards.

Because CircuitPython can present two serial channels, the interface name is used to detect the correct one (the REPL one, not the data one).

Mu used to use a list of USB VID/PID's, but that required constant maintenance.

You don't have to use Mu: you could use PyCharm or VSCode, or use Mu in a "manual" mode and upload code to CIRCUITPY yourself. You can use any terminal program (tio is good) to connect to the right port.