ESP-IDF : Is it possible to detect if SPI_RAM is available ?
Posted: Wed May 17, 2023 7:33 am
Good morning,
I have written a program using an Esp32S3-WROOM-1 module having an external SPI_RAM (2Mo).
In order to use the external SPI_RAM, I enabled it in the firmware and I used the
heap_caps_malloc method with the MALLOC_CAP_SPIRAM parameter.
Here, everyting is ok.
The problem is that I have to change my Esp32S3 component and I need to use an Esp32S3Mini which have no external SPI_RAM.
So, I have disabled the use of external SPI_RAM in the sdkconfig file but I get an error when I
execute the heap_caps_malloc method with the MALLOC_CAP_SPIRAM parameter. => The program crashes.
Is there a way to detect if SPI_RAM is present and enabled in the firmware so that I can execute the
heap_caps_malloc method with the MALLOC_CAP_SPIRAM parameter without any error ?
Or is there a way to execute the method heap_caps_malloc so that it tries to allocate memory from SPI_RAM if it is present and enabled
or from internal DRAM in the other case ?
Thank you for your help.
Best regards,
Thomas TRUILHE
I have written a program using an Esp32S3-WROOM-1 module having an external SPI_RAM (2Mo).
In order to use the external SPI_RAM, I enabled it in the firmware and I used the
heap_caps_malloc method with the MALLOC_CAP_SPIRAM parameter.
Here, everyting is ok.
The problem is that I have to change my Esp32S3 component and I need to use an Esp32S3Mini which have no external SPI_RAM.
So, I have disabled the use of external SPI_RAM in the sdkconfig file but I get an error when I
execute the heap_caps_malloc method with the MALLOC_CAP_SPIRAM parameter. => The program crashes.
Is there a way to detect if SPI_RAM is present and enabled in the firmware so that I can execute the
heap_caps_malloc method with the MALLOC_CAP_SPIRAM parameter without any error ?
Or is there a way to execute the method heap_caps_malloc so that it tries to allocate memory from SPI_RAM if it is present and enabled
or from internal DRAM in the other case ?
Thank you for your help.
Best regards,
Thomas TRUILHE