I'm having a heck of a time trying to figure out how to allocate SPI RAM memory with the Lolin D32 Pro v2. I can't figure out how to get SPI RAM accessed at all.
Board specs are here:
https://docs.wemos.cc/en/latest/d32/d32_pro.html
The PSRAM should actually be listed at 8mb (https://www.amazon.com/Genuine-Original ... 07QDFP3WC/), but in either case, I can't any available PSRAM memory listed.
I'm using Visual Code Studio / Platform IO.
Here is the code I've written:
Code: Select all
heap_caps_print_heap_info(MALLOC_CAP_SPIRAM);
// just to verify
multi_heap_info_t info;
heap_caps_get_info(&info, MALLOC_CAP_SPIRAM);
Serial.printf("total PSRAM size = %lu\n", info.total_free_bytes + info.total_allocated_bytes );
Heap summary for capabilities 0x00000400:
Totals:
free 0 allocated 0 min_free 0 largest_free_block 0
total PSRAM size = 0
From the notes here:
https://docs.espressif.com/projects/esp ... alloc.html
----
External SPI Memory
When external RAM is enabled, external SPI RAM under 4MiB in size can be allocated using standard malloc calls, or via heap_caps_malloc(MALLOC_CAP_SPIRAM), depending on configuration. See Configuring External RAM for more details.
---
So, it should work. Althought this is the ESP-IDF programming guide, but function calls are same as I'd use with PlatformIO.
If I allocate with heap_caps_malloc(..., MALLOC_CAP_SPIRAM), the returned pointer is NULL, as you'd expect.
I tried putting these into sdkconfig.h(temporarily) to try to solve the problem, but to no avail - based on some various research.
Code: Select all
#define CONFIG_SPIRAM_BOOT_INIT 1
#define CONFIG_ESP32_SPIRAM_SUPPORT 1
#define CONFIG_SPIRAM_IGNORE_NOTFOUND 0
#define CONFIG_SPIRAM_USE_MEMMAP 1
#define SPIRAM_USE_MALLOC 1
Best,
Scott