MicroPython on PicoSystem

I’ve copied the .uf2 file to the PicoSystem and I can run the demos but I can’t work out how to get my python program onto the PicoSystem. An online tutorial for a different RP2040 pico board said to call the script main.py so I tried copying a main.py file to the PicoSystem but it didn’t do anything.

Do I have to build a new .uf2 file with my script included? Is there some other way that I’m just not seeing? How does this thing work?

No you should not have to build a new uf2 file at all.

What program are you using to write your code? If thorny if you have the pico connected then when you press save it should ask you if you want to save it on the pico or the computer if you want the code to run on the pico when powered away from the PC on a battery then save it as main.py to the pico.

This link shows the save dialog that should pop up:

https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/5

DO NOT drag the file over when the pico is connect as a hdd after pressing the bootsel button this will not work.

I was creating the file in vi and dragging it over.

I have now tried using thorny but I don’t get the dialog to let me run the code on the PicoSystem. I’ve tried holding down A on switch on and not holding it down but neither work.

Since then I’ve tried CircuitPython and this does work. I can cd into the directory, create a file using vi and it runs. MicroPython doesn’t mount the PicoSystem as a directory whether I hold down A or not, should it?

I don’t need to get this working since I can use CircuitPython but it would be nice to have this as an option as well.

I would start from scratch and follow the instructions here these worked perfect for me.

https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico

Remember if you are using it with any pimoroni based pack then you will need the pimoroni specific uf2 file found on their github.

You should only have to push the bootsel button when flashing a new uf2 file to the Pico.

I’ve tried using a fresh install of the OS on my Pi 4 in case there is some conflict with something I had installed. Using the relevant parts of the link you gave me I got it work from the shell but not from the editor.

BTW are you using the device described in that link? I’m using the little handheld game device they are calling the PicoSystem. Maybe this works differently, the getting started page for MicroPython on this device is a lot shorter and less detailed.

I did miss that in you are using a picosystem in the original post and I assumed you were using a standard raspberry pi pico so apologies for that.

However looking at the details on the product website it should behave like a standard Pico I believe when trying to put you own code onto it, so I don’t believe the details I have provided are incorrect.

If it is still not working perhaps email pimoroni support for some advice.

Sorry I don’t think I can help further.

@Peter, did you have any luck with getting MicroPython working? I meant to reply sooner but hadn’t joined the forum when I first saw this.

When you tried copying main.py over, was it to a drive named RPI-RP2? that is the label for the hdd that MrObvious suggested. I have the PicoSystem, I just confirmed. You hold the X button and power on to get that drive. If you have the Pimoroni MicroPython UF2 on the PicoSystem, holding the A button and powering on shows a PicoSystem logo, plays a sound then shows a few demos you can run, and it lists any other .py files you have uploaded to the filesystem on the PicoSystem.

MicroPython doesn’t share the filesystem like CircuitPython does with its CIRCUITPY drive. I’ve still only used Thonny to work with MicroPython on a RP2040 based device, I don’t know exactly how Thonny copies the files to the PicoSystem or how it reads what files are there already, I’ll get to learning that eventually.

I just tested three different UF2 files:

I had to use the first because the Thonny install based on the instructions MrObvious linked to didn’t work, it had some error about an expired certificate.

The rp2-pico-20220117-v1.18.uf2 file worked and I could create a main.py file in Thonny and use the code print("Hello World") to see output on the console but likely not the screen without a lot of code if it’s even possible.

pimoroni-pico-v1.18.1-micropython-v1.18.uf2 is a file I had downloaded recently while testing for a different post (Need some RV3028, Pico, Micro Python, Date Time, help). That was using a Raspberry Pi Pico but that does work on the PicoSystem and seems to have a picosystem frozen module but looking on GitHub (pimoroni-pico/picosystem.py at main · pimoroni/pimoroni-pico · GitHub) it seems to be a minimal example not the PicoSystem API from Pimoroni.

picosystem-v0.1.2-micropython-v1.17.uf2 is the file for the PicoSystem API from Pimoroni.

And something interesting about those testes:

  • The rp2 and pimoroni-pico versions seem to share the same MicroPython area in flash memory used for the filesystem on the Pico / PicoSystem
  • Flashing with the picosystem file shows different files
  • They don’t overlap because swapping back and forth between those .UF2 files does not delete the main.py files
  • changes to the main.py while on the rp2 UF2 are shown when running the pimoroni-pico UF2 and vice versa
  • While I was testing C++ on the Pico, I found the nuke example on the page: GitHub - raspberrypi/pico-examples
    • That nuke example erases everything on the flash memory, maybe only possible in a C++ UF2 file, it states: “An example of a NO_FLASH binary (UF2 loaded directly into SRAM and runs in-place there).”

Basically, there are all sorts of interesting things to learn about the RP2040, Raspberry Pi Pico and PicoSystem then the growing selection of other boards and devices created using the RP2040. Which is partly why I got carried away and this ended up a long post :).

Thank you for the interesting reply. Once I got the C++ SDK to work I stopped trying with python, I’ve been spending my time on the PicoSystem trying to write a game in C++, it’s not complete but it’s getting there and is a bit playable.

I might have another go at python sometime. If I’m understanding this correctly with the MicroPython version you use Thonny to write your code to the PicoSystem rather than manually copying it to a directory. I tried this but couldn’t get it to work. When I get the time I might go through this again and see it I can work out how to do it.

1 Like

It’s been a while but I thought I’d mention that I have got this to work now. The thing I had missed was setting the interpreter in Thonny, once I did that it was easy. Now I’ve finished my first C++ game (it took a long time but I got a bit discouraged a few times) I’ll have a go with python and see what I can do with it.