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.

6 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.

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.