ESP32 WROVER reboots on heap_caps_calloc(MALLOC_CAP_IRAM_8BIT)

simonjo
Posts: 21
Joined: Wed Sep 30, 2020 9:16 am

ESP32 WROVER reboots on heap_caps_calloc(MALLOC_CAP_IRAM_8BIT)

Postby simonjo » Wed Apr 12, 2023 10:12 am

Hi,

My application requires IRAM memory, but when I use heap_caps_calloc(1, 784, MALLOC_CAP_IRAM_8BIT) it returns 0.

This is on a WROVER.

When using heap_caps_calloc(1, 784, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) I get a valid return pointer.


Why the differences, what am I missing?

MicroController
Posts: 1733
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32 WROVER reboots on heap_caps_calloc(MALLOC_CAP_IRAM_8BIT)

Postby MicroController » Wed Apr 12, 2023 2:31 pm

From the TRM: "The CPU can read and write data through the instruction bus, but only in a word aligned manner; non-word-aligned access will cause a CPU exception."

Hence, CAP_IRAM + 8BIT is not valid/possible on the ESP32.

See also https://esp32.com/viewtopic.php?t=23891#p94825

ESP_Mahavir
Posts: 190
Joined: Wed Jan 24, 2018 6:51 am

Re: ESP32 WROVER reboots on heap_caps_calloc(MALLOC_CAP_IRAM_8BIT)

Postby ESP_Mahavir » Thu Apr 13, 2023 4:58 am

Hello,

It is possible to allocate memory from ESP32 IRAM region in FreeRTOS unicore mode with certain performance penalty. Please refer to https://docs.espressif.com/projects/esp ... ble-memory.

Who is online

Users browsing this forum: Bing [Bot] and 116 guests