Framebuffer on psram

Has anyone succeeded in setting up a framebuffer on psram?

Never used external ram before, it would be a good start to use the PSRAM supplied in the PicoCalc!

The chip used is the ESP-PSRAM64H (https://cdn-shop.adafruit.com/product-files/4677/4677_esp-psram64_esp-psram64h_datasheet_en.pdf).
I found a lib for the RP2040 and RP2350. But probably need some adjustment to work with the hardware configuration of the PicoCalc.
Also sparkfun do a lib implement malloc/free/etc. functions to support 2350 SRAM and PSRAM. It uses a tlsf implementation from Espressif.

I’ve read somewhere (and confirmed by the RP2350 architecture) that the PSRAM and external Flash share the same QSPI bus. Depending on the software implementation, this can lead to slowdowns or even a crash.

I’d like to try writing the framebuffer with the CPU (or 2nd core) in PSRAM. And let the DMA/PIO do the PSRAM<=>LCDSPI transfer.

1 Like

There has been discussion on https://www.thebackshed.com/forum/ViewForum.php?FID=16 and (my understanding is that) the PicoMite maintainer has said that the PSRAM is too slow to be used as a PicoMite framebuffer.

YMMV,

Tom

1 Like

Yeah, the helloworld example in the PicoCalc repo has a benchmark of the PSRAM and its top performance with the pico1 is 900KB/s, which is way too low for what is necessary for 320x320x3 at 60fps (18 MB/s). Even rgb565 at 30fps is 6 MB/s.

Maybe PSRAM can be used as backbuffer with a selective update of small regions.

2 Likes

Milk-v duo (SG2002). 64Mb to 256Mb ddr ram
Luckfox Lyra (RK3506G2). 128Mb dd3 ram.

If only we could install Picomite/MMBasic on the Luckfox… maybe the Milk-v ??

There is another forum post about the Lyra. I have one but I have not been able to make it work yet.

PSRAM with rp2040 seem to be useless indeed…

But I saw some peoples got ~25/20 MB/s on 32-bit uncached R/W with non-overclocked rp2350, 38/26 MB/s after overclocking and some tuning!

1 Like

After a deep reading of the screen datasheet, the max framerate reachable in theory is about 12 Hz.
That in the case you want to push the entire 320x320x16 framebuffer of course.

The PSRAM shouln’t be the bottleneck, neither on rp2040, nor on rp2350…

Maybe we can do some ā€œtile-ingā€ of the screen areas, pushing only the updated ones. We can double the framerate just by updating the half of the pixels!

1 Like

I think you’re missing one point: the speeds you mention here apply to cases where PSRAM is connected via QSPI.

However, the QSPI lines of the RP2350 MCU chip are not exposed through the 40-pin header on the Pi Pico 2/2W boards. So, whatever is available on the PicoCalc mainboard definitely can’t be connected to that QSPI interface.

As of now, I believe only the Pimoroni Pico Plus 2/2W boards have a PSRAM chip on the board, and it’s connected through QSPI.

1 Like

@1more And yes indeed, the PSRAM on the picocalc is only connected on standard GPIO… (no doubt because it was designed for rp2040).
This invalid the speed values I said at the beginning.

At this point, rather than remaking the picocalc PCB, I’m thinking of making a ā€œyet another pico custom boardā€. In order to connect the screen in parallel mode (through a direct flex interface).

But first, let’s receive it and do some tests!

Just to make sure we’re on the same page:

the fact that PSRAM on PicoCalc is connected to the Pico’s GPIO instead of QSPI isn’t a limitation of PicoCalc itself, but rather a limitation of Pico-compatible modules. As of now, there are no mass-produced 40-pin modules based on the RP2040 or RP2350 that expose the QSPI lines on the 40-pin header.

This is because these modules are typically designed to be pin-compatible with the Raspberry Pi Pico 1/2, which didn’t expose the QSPI lines in the first place.

And if you find or create a module that does expose the QSPI lines on 40-pin header, it will, by definition, no longer be pin-compatible with the rest of the Pico-based boards.

I can see that it’s a question of keeping pins-compatible as possible, which is valid for picocalc main board side.

I can embbed the PSRAM like the Pimoroni Pico Plus 2 does, this keep the pins-out compatible but makes the picocalc’s PSRAM useless (and adds electricity consumption). A ā€˜dedicated’ pico-card may sacrifice compatibility (only for the custom pico-board) for efficiency, and avoid doing a remake of the picocalc mainboard (too much rework just for testing).

However, other cards like Luckyfox or Milk-V, cannot exceed 20-25 MHz of SPI either given the screen specs… The QSPI PSRAM of the Pimoroni Pico Plus 2 or others will not be useful (for framebuffer) as long as the TFT-SPI bandwidth is not increased.