Will I benefit by having an ESP with PSRAM?


#1

Hello !

I would like to know if having PSRAM on my ESP32 module will help with this library.
https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/modules-and-boards.html#wroom-solo-and-wrover-modules

As you can see in the documentation the ESP32-WROVER-B has 8MB of PSRAM.
From what I’ve read, the ESP32 usually has around 500kb of RAM. So, after the WiFi, TCP/IP, Cache and Freertos take their fair share of the RAM, my code + SmartMatrix library will use the rest, correct ?

But what about the 8 freaking MB of PSRAM ? What are those for ? Can I use them for something ? Not me, me, because I lack the coding skills to actually do something like that, but somebody who actually knows what he’s doing.
Should it be possible for the SmartMatrix library to use 8 MB of RAM instead of the ~200kb leftover ?


#2

I did have a quick look at this and that PSRAM is not directly accessible, you have to talk to it via a bus.
As a result, I very much doubt it will do DMA, which in turn means SmartMatrix won’t be able to use it for its DMA buffers.
This does not mean it can’t be used at all, but I doubt it would just allow 128x128 on ESP32 though.
I still think you can hit 128x128 on ESP32 if you are willing to sacrifice quality somewhat. Personally 16bpp would be more than enough for my uses.
SmartMatrix was not really designed with high sizes in mind, it was designed with high quality in mind (like 32bpp).
Without having looked at the code internals, I still think it could be modified to use half the memory it currently uses, or maybe even less (again, at the expense of quality)
Ironically, when hitting higher pixel counts, neopixels come back ahead on CPU memory usage, given that you don’t need to do all that PWM color mixing in software (which in turn uses more CPU RAM and cycles)


#3

But 16bpp isn’t available, right ?
I wouldn’t mind lower quality. My project is pretty simple in the display part.


#4

No 16bpp is not available, probably because @Louis is a perfectionist :slight_smile:
That said the rPi driver lets you select the 12 to 1 bit per pixel color channel (IIRC) to improve speed/memory use at the expense of quality.


#5

It’s not available because it’s not trivial to add, but with all the refactoring done in the teensylc branch it is much easier to add than in the main branch. It’s on the “someday/maybe” list


#6

This is what ESP_Sprite said.


#7

It’s possible I could move the non-DMA background layer buffers to PSRAM, but as you noted “DMA buffers are the bulk of the memory usage of Smartmatrix”. Moving those buffers would free up DMA RAM for use in refreshing the panel though.