The ESP32 microcontroller has only a few hundred kilobytes of internal RAM. Fortunately the ESP32 AudioKit or ESP32 Wrover provide 8MB PSRAM where 4MB can be directly addressed.

More information how to use PSRAM in Arduino can be found here. The only thing to highlight is that PSRAM can not be allocated in global variables! This is quite unfortunate because I preferably like to do this, so that the compiler can inform about the total memory usage.

Many FAUST examples are using more RAM that is available on an ESP32. Therefore I have added PSRAM support to the FAUST integration. Here is an example how to use this.

Finally there is a more generic way that can be used e.g. if you want to use PSRAM with any library that is not under your control. You can call the following “magical” function:

#include "esp_heap_caps.h"

const int limit = 10000;
heap_caps_malloc_extmem_enable(limit);

Then, when external memory is available and activated, the allocation strategy is to initially try
to satisfy smaller allocation requests with internal memory and larger requests
with external memory
. This sets the limit between the two.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published.