ESP32-WROVER with 8 MB/64 MBit PSRAM better in unexpected way (Hint: SPI)

The ESP32-WROVER module by Espressif is an upgrade of the popular ESP-WROOM-32 module, which not only has the 240 Mhz Dual Core CPU with Wifi and 4 MB Flash on board, but also has an additional 4 MB or 8 MB of PSRAM added to the internal >400 Kbit RAM.

For a microcontroller module it is very powerful, and building electronics with it has the additional advantage of very low unit costs, with a module available for around $3 (with higher unit count). For electronics with Wifi it is currently one of the cheapest options available.

To add the ease of programming to the advantages, we develop low.js, a port of Node.JS for the ESP32-WROVER.

PSRAM details

The PSRAM can be used just like normal RAM. You can malloc() memory and free() the memory when it is no longer used.

It can be configured to be accessed with 40 Mhz and 80 Mhz, just like the Flash, which can also be configured to be accessed with 40 Mhz and 80 Mhz. As the PSRAM and the Flash chips are part of the module, they behave the same all the time, and as 80 Mhz/80 Mhz is stable, there is no reason not to choose this option.

… with the exception of that this blocks another an additional SPI peripheral. With the 80 Mhz/80 Mhz option SPI0, SPI1, and either VSPI or HSPI are used by the system. The user program has only one SPI peripherial available for its own use.

Why to use the 64 MBit module

The problem with the 64 MBit module is that it is not really gives you more RAM. The ESP-IDF can only add 32 MBit (4 MB) of PSRAM to the memory map, so you can only malloc() and free() within 4 MB. Of course you can still use the himem API with the upper 4 MB of memory, but this is slow, and to change libraries to pull a block of memory into the memory map before usage and remove it after usage is typically not feasable.

Yesterday, only after studying the source code of ESP-IDF, the development framework of the ESP32, we noticed that the 64 MBit module has another advantage: in the 80 Mhz/80 Mhz configuration it does not block 3 SPI peripherials any more. Only 2 SPI peripherials are used, the user program still has access to VSPI and HSPI.

So if you wonder why the 64 MBit PSRAM module is getting more popular: This is one of the reasons.

As a side note, in the newest ESP-IDF source code it seems like newer 32 MBit modules also do not/will not require VSPI/HSPI any more either. I do not think it is visible in any documentation which 32 MBit module you get when you buy a 32 MBit ESP32-WROVER however.

We will update low.js soon to reflect these possibilities.