Mu REPL with CircuitPython?

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Mu REPL with CircuitPython?

Post by dhalbert »

On tonight's video, Lady Ada was using the REPL feature in Mu to talk to CircuitPython. I tried to replicate this. Per the README in Mu's github repo, I downloaded the latest Windows Mu build from http://ardublockly-builds.s3-website-us ... t/windows/. The latest release build (0.9.13) of Mu does not know about the Adafruit USB id's, but this newer build does. I also put CircuitPython 0.8.3 on my Feather M0 Basic.

Mu opens the REPL, but it shows as blank and I cannot type into it. When I open the REPL COM port with putty, it works fine. When I close putty and reopen Mu, I can then see usual message about soft-reset in the REPL pane, but I can't type into the REPL. Output from print() statements in main.py does not show up in the Mu REPL.

What should I be doing to get this to work? I didn't install any extra drivers -- Mu says for WIndows one needs to install the mbed serial port driver, but says it's not necessary on Windows 10.

I watched the video after the Youtube chat was gone, so if you discussed this in the chat, sorry for missing it.

User avatar
tannewt
 
Posts: 3315
Joined: Thu Oct 06, 2016 8:48 pm

Re: Mu REPL with CircuitPython?

Post by tannewt »

What board are you using? I'm not on Windows so I can't help much. I'll ask ladyada about her setup.

User avatar
adafruit2
 
Posts: 22192
Joined: Fri Mar 11, 2005 7:36 pm

Re: Mu REPL with CircuitPython?

Post by adafruit2 »

does the serial port work in general, like with putty?

User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Mu REPL with CircuitPython?

Post by dhalbert »

Thanks - I'm using a Feather M0 Basic. It's an early model, from when it just came out. Originally it did not come with the BOOTPROT fuse set to protect the bootloader. I did set that fuse using openocd but did not reload the original bootloader (it did not appear to be changed).

It wasn't clear to me which version of Mu ladyada was using. There was on icon on her desktop that said "mutoo" or "mufoo", but I'm not sure that was what she was running. She's running Windows 7; I am using Windows 10.

I have a newer Feather M0 Basic I bought a couple of weeks ago. I'll try that one as well tonight or over the weekend. The changes to support Adafruit devices in Mu are in this commit: https://github.com/mu-editor/mu/pull/19 ... 4f99089cc7. I'll check and see which USB VID/PIDs I'm seeing on my boards.

mu/logic.py:

Code: Select all

 BOARD_IDS = set([
    (0x0D28, 0x0204),  # micro:bit USB VID, PID
    (0x239A, 0x800B),  # Adafruit Feather M0 CDC only USB VID, PID
    (0x239A, 0x8016),  # Adafruit Feather M0 CDC + MSC USB VID, PID
    (0x239A, 0x8013),  # Adafruit Metro M0 CDC only USB VID, PID
    (0x239A, 0x8015)   # Adafruit Metro Mo CDC + MSC USB VID, PID
Last edited by dhalbert on Fri Jan 20, 2017 3:43 pm, edited 1 time in total.

User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Mu REPL with CircuitPython?

Post by dhalbert »

adafruit2 wrote:does the serial port work in general, like with putty?
Yes, it does, and the MSC works too.

Did you need to install the mbed driver? I would think not.

User avatar
adafruit2
 
Posts: 22192
Joined: Fri Mar 11, 2005 7:36 pm

Re: Mu REPL with CircuitPython?

Post by adafruit2 »

nope...dunno what the issue is. maybe try resetting a bit and/or resetart mu?

User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Mu REPL with CircuitPython?

Post by dhalbert »

adafruit2 wrote:nope...dunno what the issue is. maybe try resetting a bit and/or resetart mu?
I tried several times and in different orders. Which build of Mu are you using? Is it a standard daily one from the AWS server or did Tony build one for you?

User avatar
adafruit2
 
Posts: 22192
Joined: Fri Mar 11, 2005 7:36 pm

Re: Mu REPL with CircuitPython?

Post by adafruit2 »

i run it from github repo with python3 run.py

User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Mu REPL with CircuitPython?

Post by dhalbert »

I spent some more time on this today. The mu logfile shows it's opening the proper port (the same port that putty uses successfully), but I don't see any output. I also tried on a Windows 7 machine and had the same issue.

I was using the latest prebuilt Windows mu build. I then cloned mu from github, "pip install"d the right libraries, and got it to run that way. But the REPL still has the same problem. The code is pretty simple, but there's some issue getting it to read data from the port. I put in some logging to see whether it was reading to and writing from the port. Writing is happening, but I never see anything read.

I will give up for now: it's not that important and putty works fine for me. I note that Tony submitted a bug about packaging and version issues with the Windows version some time back, so I assume there could still be some problems.

User avatar
cartere
 
Posts: 19
Joined: Thu Jan 19, 2017 10:35 am

Re: Mu REPL with CircuitPython?

Post by cartere »

First accessed M0 data logger with putty and put in REPL mode by hitting 'any key', exit putty.

Using the code from the latest repository, start with py run.py.

Access the board from the Mu REPL and everything seems to work fine ctrl-D works and the REPL survives the soft reboot.

This is on a Windows 10 machine.

User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Mu REPL with CircuitPython?

Post by dhalbert »

cartere wrote:Using the code from the latest repository, start with py run.py.
Thanks. Did you pip install PyQt5 and QScintilla? Python 3.5 or an earlier one? Are you using 32-bit or 64-bit Python? (I realize I've been testing with 64-bit).

I can wake up the REPL the way you did. I go to putty and get the startup message. When I quit putty and open the REPL in mu, I see the same startup message, but it doesn't appear to take input. I never see the ">>>" prompt.

EDIT: I had a short program in main.py that blinked for a few seconds and then finished. If I tried to get to the REPL from putty after it finished, I could not. I deleted main.py and now can get to the REPL from both putty and mu. However, I still have to start up the REPL from putty - I can't do it straight from mu.

So I have a technique - thanks for your help and suggestion.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”