PicoCalc MicroPython Port Status

Just letting the forums know that there is another successful MicroPython port for the PicoCalc.
Located here: GitHub - zenodante/PicoCalc-micropython-driver, it is aimed primarily at the Pico 2, but does also support the Pico 1.

I have just added support for the Pimoroni Pico Plus 2 as well, namely the 8MB of onboard PSRAM, and the PR should be up later tonight.

I have included SD support as well.

We have been doing most of the work in the software-development chat in the discord, so you could potentially be more updated there, the main dev is gg05580.

7 Likes

Awesome, thanks!
I got this loaded onto my Pico 2 W a few days ago and have been doing some testing. Here’s a quick report for others jumping in:

:white_check_mark: Install Process (what worked for me):

  • Hold the BOOTSEL button on the Pico 2 W board while plugging in via the micro-USB port
  • It mounts as a USB drive
  • Drop in the .uf2 file — once copied, it auto-reboots
  • Use Thonny (or similar) to upload:
    • main.py, fbconsole.py, and picocalc.py
    • Upload to internal storage, not the SD card
  • Unplug from USB and reboot

:warning: Notes & Caveats:

  • If powered via the micro-USB (BOOTSEL) port, main.py does not auto-launch
  • But you can connect via Thonny/serial and run Python manually
  • If powered via USB-C, you can’t connect via Thonny

:speaker_high_volume: Audio:

  • Docs say audio is on GPIOs 28 (L) and 27 (R)
  • In my testing, I get actual sound output on GPIOs 26 and 27
  • Also: looks like sound pins overlap with Wi-Fi — if you’re using sound, don’t try to use Wi-Fi at the same time?
  • Volume knob affects speaker volume! If volume is turned down, no sound from speakers. Spent ‘some time’ troubleshooting sound because of this.

:floppy_disk: SD Card:

  • I’m using the sdcard.py module with this wiring:
SCLK: 18  
MOSI: 19  
MISO: 16  
CS:   17

:framed_picture: Framebuffer & Graphics:

  • Tested basic primitives like line() and square()
  • Default display mode appears to be 16-color palette-mapped

:prohibited: PSRAM:

  • PicoCalc includes 8MB of external PSRAM, but MicroPython doesn’t seem to detect or use it yet

Yea we’re adding in sdpcard.py at this point, along with two basic functions for management, they should be in today or tomorrowish.
Theyre being added to have functionality similar to that of the Picomite firmware, where the SD is mounted on boot.

Main dev is aiming for vt100 coverage rather than 16-color.

PSRAM support is split between the latest PR and a future one, but a preliminary bin for it should be available on the same timeline as the SD functions.

2 Likes

Nevermind I misunderstood, PSRAM support specifically for the Pimoroni boards is done, I will pull a base Pico 2 out and begin working on the internal PSRAM support today.

1 Like

Update on the Audio and PSRAM:
Audio:
According to the Pico 2W schematics the WiFi definitely does not overlap with the speakers, although they are on consecutive pins. GPIO 23-25 are devoted to the WiFi on the pico, while GPIO 26 and 27 are the left and right speaker respectively which matches the schematics.

EDIT:
The PWM pins used for audio do overlap the ADC though.

PSRAM:
TLDR The external PSRAM is not really able to be “used” to extend Micropython’s RAM due to its differences from the Pimoroni PSRAM.

From what I understand the Pimoroni PSRAM utilizes being piggybacked on the device flash to essentially function as a “RAM disk” which can be used to mostly seamlessly expand the existing RAM. The external clockwork PSRAM however is unable to do this, and as a result has to be used explicitly.

3 Likes

I spent some time searching for relevant repos and downloading trying a few to get a working Python PicoCalc.

Here is a script which will automatically download all the necessary repos and move the neccessary files around and compile them.

Thanks to laika and gg for giving their talents to the community.

2 Likes

This could be modified to support the Pimoroni as well, you would just need to clone a few extra things, and use the Pimoroni board definitions.

Extra Steps:
Clone: GitHub - LaikaSpaceDawg/micropython-cppmem: A very basic tracked allocator to replace new/delete on RP2040/RP2350 MicroPython for C++ modules
Which is my minor fork of the original with bugfixes so it still compiles.

Clone: GitHub - pimoroni/pimoroni-pico: Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython. into the micropython folder

Copy the board definitions and manifest_pico2.py from: pimoroni-pico-rp2350/micropython/board at main · pimoroni/pimoroni-pico-rp2350 · GitHub into path/to/micropython/ports/rp2/boards/
(or wherever else you cloned micropython)

Finally, download pimoroni-pico-rp2350/pimoroni_pico_import.cmake at main · pimoroni/pimoroni-pico-rp2350 · GitHub into path/to/micropython/ports/rp2/. It should then be included by copying the following to path/to/micropython/ports/rp2/CmakeLists.txt. Which will include the import, as well as enabling the device PSRAM.
NOTE: It should be placed after pico_sdk_init().
NOTE TWO: PSRAM support was only merged into micropython around three days ago, so you must clone/pull the most recent version for the following code to run.

set(PIMORONI_PICO_PATH ${MICROPY_DIR}/pimoroni-pico/)
include(pimoroni_pico_import.cmake)
list(APPEND MICROPY_DEF_BOARD
    "MICROPY_HW_ENABLE_PSRAM=1"
    "MICROPY_GC_SPLIT_HEAP=1"
    "MICROPY_HW_BOARD_NAME=\"Pimoroni Pico Plus 2 (PSRAM)\""
)

You can then continue building as normal from

cd /path/to/micropython/ports/rp2/
mkdir build && cd build

It can then be compiled using something along the lines of:

cmake .. -DUSER_C_MODULES="/absolute/path/to/PicoCalc-Micropython/micropython.cmake;/absolute/path/to/micropython-cppmem/micropython.cmake" -DMICROPY_BOARD=PIMORONI_PICO_PLUS2
make

As it will mix-in both the cppmem library nessecary for the PSRAM, and the Picocalc drivers.

1 Like

i can update it, but cant test it.
someone else would have to.

I could test it for you if you want.

new release!
call the code editor from REPL
now the REPL and editor both run on vt100 terminal emulator.

9 Likes

How do you run once you’ve typed in code?

Currently there’s some useful helper functions hiding in picocalc_system.py. if you type:

from picocalc_system import run
run("my_test.py")

It’ll run your my_test.py code. There are also files, disk, memory definitions you might find handy to import if you’re using the REPL as a CLI.

2 Likes

As an update to the build instructions for the latest version changing the structure slightly, you must now declare vtterminal and picocalcdisplay as separate user modules, it just changed the cmake arguments slightly.

Updated command would be something like:

cmake .. -DUSER_C_MODULES="/absolute/path/to/PicoCalc-Micropython-driver/picocalcdisplay/micropython.cmake;/absolute/path/to/PicoCalc-Micropython-driver/vtterminal/micropython.cmake;/absolute/path/to/micropython-cppmem/micropython.cmake" -DMICROPY_BOARD=PIMORONI_PICO_PLUS2
make

Just be careful, it is case sensitive and I could’ve typed this post up wrong.

It boots into the REPL, which is the “Read Evaluate Print Loop” (essentially a fancy python idle).
As such, code will run line by line as you enter it.

If you want more traditional programs you can use the new editor functionality, or write them on a connected device and upload them.

Updated to the latest firmware from yesterday. I am using the RPI_PICO core board, but when I execute the edit command in REPL, it keeps freezing, and I can only restart picocalc.

Did you removed all py files in lib?

Yes, I only copied boot.py to the Pico’s built-in storage, without any other files or directories.

When I switched back to the version at https://github.com/zenodante/PicoCalc-micropython-driver/tree/58635637e7fddc743614d58818cf78f0b9425863, and replaced the boot.py in the Pico’s internal storage with the old version of main.py , then restarted picocalc, the edit command started working normally.

1 Like

That could be the ram size issue? Have you tried the uf2 from picocalc repo?

Laika, I’m trying to layer your additions on top of the process described by S34N’s script, as you suggested, but needed some clarification (giving #s to keep tracking issues easier):

  1. (removed, figured it out)

  2. When you say…

…you mean copy all the subdirs and contents, plus manifest_pico2.py into the folder you cite, is that correct?

  1. In your cmake launch line, per…

You have a reference to “/absolute/path/to/PicoCalc-Micropython/micropython.cmake” but there’s no such repo/directory mentioned previously, and if you meant zenodante/PicoCalc-micropython-driver repo, there’s no micropython.cmake at root of repo any longer.

I suspect this is why I still get the board ID rejected issuing that cmd, saying it doesn’t know the PIMORONI_PICO_PLUS2 board, and then stopping.

That’s all, just wanted to confirm #2, and get the right answer for #3. Any help/info you can provide is greatly appreciated! Thanks!

-John W