Since the internal RAM of the microcontrollers is quite low in general, an additional external RAM can be added. Even, if the ESP32 is a microcontroller that has a lot of RAM, it may not be sufficient, especially when you want to handle huge files JSON or HTML files
- The PSRAM is an additional external RAM of 4 MB which is present in some ESP32 modules:
The ESP32 communicates with the PSRAM by SPI. This is why it is also called SPI RAM. The 3rd SPI bus of the ESP32 is used to communicate with the flash memory (which contains the program) and with the PSRAM.
There is an ambiguity about the amount of real memory in the PSRAM. The real size of the PSRAM (on the silicon chip) is not 4MB but 8MB. However, only 4MB can be easily accessed by the software. To use the 8 MB of PSRAM, it is quite complex Use 8 MB of PSRAM . This said 4 MB more RAM is already huge (8 times the internal RAM)!
The advantage of an external RAM is to be able to relieve the internal RAM for the storage of important data:
- We can for example:
Download large Json files
Store entire HTML WEB pages
Make a powerful web server
Create huge arrays
Read and manipulate data from large files from the SPIFFS or SD card