FlexGUI 4.0.4 + MicroPython: assistance loading upython.binary into the P2 board
Ken Gracey
Posts: 7,392
READme.txt says the following:
=====
How do I load the upython.binary file into the P2 board? Using a terminal program, like PST, or some other method? Are there any total-noob instructions out there?
Thanks,
Ken Gracey
Parallax Inc.
=====
This is a basic port of MicroPython to the Parallax P2 Eval board.
To run it, load the upython.binary file into the P2 board. It will
talk on the standard serial line at 230400 baud. It will also try to
talk to a VGA board based at pin 48 and a USB keyboard based at pin 16
(using the standard P2 eval A/V and serial host expansion boards). The
USB driver used is garryj's excellent single COG keyboard/mouse driver
(although I haven't implemented mouse support yet).
=====To run it, load the upython.binary file into the P2 board. It will
talk on the standard serial line at 230400 baud. It will also try to
talk to a VGA board based at pin 48 and a USB keyboard based at pin 16
(using the standard P2 eval A/V and serial host expansion boards). The
USB driver used is garryj's excellent single COG keyboard/mouse driver
(although I haven't implemented mouse support yet).
How do I load the upython.binary file into the P2 board? Using a terminal program, like PST, or some other method? Are there any total-noob instructions out there?
Thanks,
Ken Gracey
Parallax Inc.
Comments
You may also be able to use Chip's pnut.exe
If you also want VGA and USB you'll have to follow the directions in README.txt.
Success on loading upython.binary using these instructions. Not interested in VGA/keyboard stuff just yet.
After I compose some MicroPython code, like this:
from pye import pyb
. . how do I get this loaded into the P2?
Thanks,
Ken Gracey
After the upython.binary is loaded, we can use the same menu to load MicroPython code, right?
Is there a need to use REPL to get MicroPython code running?
Thanks,
Ken Gracey
micropython is an interactive interpreter, so you can just type commands at it and try them out. If you find a sequence you like, you can save it to an SD card. The pye editor makes it possible to do this entirely within micropython.
FlexGUI doesn't really understand anything about micropython, it's just being used for the terminal window and ability to download the binary. Chip's PNut could also be used for the download, if you then open a terminal window for the interaction with the P2 interpreter.
BTW the FlexGUI terminal window does understand ANSI escape sequences, so while typing commands at micropython you can use the cursor keys, Home, and End to move around the line you're typing. Cursor up and down scroll through previous commands that you typed.
OK, got the usage straight from your three messages above. Thanks!
Will report back.
Ken Gracey
Is the process like this?
(1) Type code into FlexGUI, like this:
(2) Select all, copy
(3) Special => Terminal only window
(4) ctrl-E to enter paste mode
(5) ctrl-V to paste? This creates a [?] character in the terminal. Expected that my program would show up.
This is where I am stuck.
Thanks,
Ken Gracey
Close. You can't use ctrl-V to paste, that just sends the ctrl-V character to the terminal. Instead select the little terminal icon next to "Propeller Output" on terminal window title bar, then go to Edit > Paste. Ignore the accelerator key there that says Ctrl-V, that doesn't work.
So excited to see this thread. Just what I will need to start playing. I received my P2 Evaluation Board shipping notice today.
Questions:
(1) Is only processor 1 available to MicroPython (if possible, I'd rather use the word "processor" for the audience, should it become one)?
(2) When I reset the P2 Eval Board the program does not run again. Is it stored in RAM only? Is this where the SD card comes in?
And I'm curious about the extent of reusability of other MicroPython code, too. Any general comments there?
Thanks Eric, David and Roy!
Ken Gracey
I assume you can program the uPython binary to SD or flash.
But, can you have it run some Python code you want at startup?
Ken Gracey
For some reason I haven't had the same luck with Roger's Native P2 MicroPython. I've tried 4 different cards and they all behave slightly differently during boot
I need to get back to that and dig deeper. I have already tried padding out the images to a 512 byte sector boundary and that didn't do it. Perhaps it made things worse (checksum etc)
Regardless, the process is nominally simple, just take the binary and put it in the root directory of the SD card, renaming it to _BOOT_P2.BIX
You can also put programs (eg the Pye editor) in that directory, for subsequent import into micropython
It involves copying the compiled binary (from Pnut, Flexgui etc) onto a uSD card as "_BOOT_P2.BIX"
Okay, that's working for me. Now how to I invoke loadp2 to just connect to the serial port without downloading anything? I tried this and it gave me the dreaded "Could not find a P2".
What uSD card are you using David?
Ah yes its all coming back
We have a double bookcase as work chocked full with interesting old mags David. Some are yours. Byte, Dr Dobbs, Circuit Cellar, wireless world, edn. Too good to throw away. I think the PC Mags have long since been turfed
on linux 'screen' works
For what it is worth: https://forums.parallax.com/discussion/comment/1472297/#Comment_1472297
have not worked on it or anything propeller related since forever, real life work is consumming every hour of my life at the moment. Thought I had a git repo with my changes but unfortunately not
changes were mainly to replace fixed 115200 baudrate to 230400
If you want to get the Pye editor up under MicroPython, this is what I found I needed to do (detailed list of instructions)
https://forums.parallax.com/discussion/comment/1473775/#Comment_1473775