Why does xQueueCreate doesn't use PSRAM?
Posted: Sat Jul 22, 2023 3:55 pm
Hello,
hope you can help me. I've migrated my app from ESP-IDF 4.4.5 to 5.1 and have a problem with xQueueCreate.
My ESP32 has 8MB PSRAM, and ESP-IDF is configured to use the PSRAM also for malloc (Make RAM allocatable using malloc() as well is checked).
In IDF 4.4.5 xQueueCreate used the PSRAM for large queue. But now in 5.1 it doesn't use the PSRAM. Here is my code:
The log:
So xQueueCreate for 5262 elements of 21 bytes doesn't use the PSRAM. But allocating the same amount 5262 * 21 via malloc it uses PSRAM.
How can I achieve that xQueueCreate also use the PSRAM? It does this in ESP-IDF 4.4.5.
hope you can help me. I've migrated my app from ESP-IDF 4.4.5 to 5.1 and have a problem with xQueueCreate.
My ESP32 has 8MB PSRAM, and ESP-IDF is configured to use the PSRAM also for malloc (Make RAM allocatable using malloc() as well is checked).
In IDF 4.4.5 xQueueCreate used the PSRAM for large queue. But now in 5.1 it doesn't use the PSRAM. Here is my code:
- void app_main()
- {
- ESP_LOGI("app", "MALLOC_CAP_SPIRAM = %d", (int)heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
- QueueHandle_t x = xQueueCreate(5262, 21);
- ESP_LOGI("app", "x = %d", (int)x);
- ESP_LOGI("app", "MALLOC_CAP_SPIRAM = %d", (int)heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
- void* y = malloc(5262 * 21);
- ESP_LOGI("app", "y = %d", (int)y);
- ESP_LOGI("app", "MALLOC_CAP_SPIRAM = %d", (int)heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
- }
- I (381) esp_psram: Adding pool of 4096K of PSRAM memory to heap allocator
- I (390) spi_flash: detected chip: gd
- I (392) spi_flash: flash io: dio
- I (397) coexist: coex firmware version: ebddf30
- I (402) app_start: Starting scheduler on CPU0
- II (407) app_start: Starting scheduler on CPU1
- (407) main_task: Started on CPU0
- I (417) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
- I (417) main_task: Calling app_main()
- I (427) app: MALLOC_CAP_SPIRAM = 4192136
- I (427) app: x = 1073628860
- I (437) app: MALLOC_CAP_SPIRAM = 4192136
- I (437) app: y = 1065355388
- I (437) app: MALLOC_CAP_SPIRAM = 4081628
- I (447) main_task: Returned from app_main()
How can I achieve that xQueueCreate also use the PSRAM? It does this in ESP-IDF 4.4.5.