esp-who icon indicating copy to clipboard operation
esp-who copied to clipboard

matrix3du item alloc failed when working with AmazonFreeRTOS

Open Ascarron opened this issue 5 years ago • 4 comments

I am trying to run the esp-who face detectionon the ESP-EYE using the AmazonFreeRTOS built upon the custom idf. When running the project I get the following error during image capture:

matrix3du item alloc failed.
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

I have enabled the SPI RAM (Component Config > ESP32 Specific > Support for External SPI RAM). What changes are necessary for the correct heap allocation? I tested it by lowering the resolution to QQVGA but it still crashes when doing the face detection. Even though for heap initialization in FreeRTOSConfig.h is set to: #define configTOTAL_HEAP_SIZE ( ( size_t ) (256 * 1024) ) when I call xPortGetFreeHeapSize() the output is only 65536

Ascarron avatar Jul 31 '19 17:07 Ascarron

Not sure if the os support mapping external memory to heap. You can try to allocate about 300KB space to see if SPI RAM works.

XiaochaoGONG avatar Aug 05 '19 11:08 XiaochaoGONG

Yes the mapping to the external memory works. To test this I did image_matrix = dl_matrix3du_alloc(1, 160, 120, 3); and the memory is allocated with a decrease in free heap size. If I try to increase the dimensions any more than this the allocation fails.

Ascarron avatar Aug 05 '19 17:08 Ascarron

160x120x3 = about 57KB, which is still allocated in the internal memory. It seems you didn't successfully enable the SPI RAM. You may transfer this issue to esp-idf.

XiaochaoGONG avatar Sep 04 '19 12:09 XiaochaoGONG

Has there been any updates on this issue and how to solve it? I am having the same problem when allocating 57KB of memory. The PSRAM is enabled using build flags in platformio.ini file:

    -DBOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue

farshad-a avatar Aug 31 '21 23:08 farshad-a