microrepl icon indicating copy to clipboard operation
microrepl copied to clipboard

Support Raspberry Pi

Open bennuttall opened this issue 9 years ago • 8 comments

Current status: urepl fails to open on Raspberry Pi.

ImportError: cannot import name comports

I'll do some more digging and post my findings here.

bennuttall avatar Dec 14 '15 17:12 bennuttall

Ok by installing the latest version of Serial I seem to have got it working.

I uninstalled the apt packages for Serial for py2 & py3:

sudo apt-get purge python-serial python3-serial -y

And installed the latest serial from PyPI:

sudo pip install pyserial --upgrade
sudo pip3 install pyserial --upgrade

I thought it would be harder than that but ok.

I will pass this on to my team and get it packaged for Raspbian.

bennuttall avatar Dec 14 '15 17:12 bennuttall

On a related note, how do you reset the microbit? I have one running some code created using the web interface, I think, and I can't connect to it using urepl. Is there a method of reflashing it?

bennuttall avatar Dec 14 '15 17:12 bennuttall

Hi @bennuttall great stuff!

The only thing urepl brings to the party is that it auto-discovers the correct USB-serial port for the micro:bit. You could just use a "regular" tool like picocom (see the bottom of the README here: https://github.com/bbcmicrobit/micropython).

In terms of re-flashing the device, try this file as a very recent build from master with "vanilla" MicroPython (i.e. no Python script automatically installed with it).

https://github.com/ntoll/upyed/raw/master/firmware.hex

Give me a couple of days and we'll have this working in "mu". ;-)

ntoll avatar Dec 14 '15 20:12 ntoll

Great - thanks. I'm keen to write code in Python on the Pi that can talk to the microbit but also do regular Python stuff like GPIO and requests! I'll have a play

bennuttall avatar Dec 14 '15 22:12 bennuttall

Agh I'm giving this another try and failing to get it running again.

@ntoll Can you give it a try and let me know how you get on?

bennuttall avatar Jan 12 '16 14:01 bennuttall

On a Pi, I mean

bennuttall avatar Jan 12 '16 14:01 bennuttall

Will do.

ntoll avatar Jan 12 '16 14:01 ntoll

Here's how to make it work:

git clone https://github.com/ntoll/microrepl.git
cd microrepl
sudo apt-get install python3-serial
python3 microrepl.py

However, I suggest this tool if not used - rather it's better to use, say, picocom like this:

sudo apt-get install picocom
picocom /dev/ttyACM0 -b 115200

Or even better, just use the REPL built into Mu.

ntoll avatar Jan 12 '16 19:01 ntoll