lvgl / lv_binding_micropython

LVGL binding for MicroPython
MIT License
250 stars 161 forks source link

ESP32S3 cannot request from SPI RAM #221

Closed yplwrt closed 2 years ago

yplwrt commented 2 years ago

In ESP32S3 application, set ''SPI RAM access method'' to ''Make RAM allocatable using malloc() as well'', use ''self.buf1 = esp.heap_caps_aligned_calloc(64, 1, self.buf_size, esp.MALLOC_CAP.SPIRAM)'' will report the following error message:

Guru Meditation Error: Core 0 panic'ed (LoadStoreAlignment). Exception was unhandled.

Core 0 register dump: PC : 0x4038047e PS : 0x00060233 A0 : 0x803849b8 A1 : 0x3fce8930
0x4038047e: compare_and_set_native at /home/ft/esp/esp-idf/components/esp_hw_support/include/soc/compare_set.h:25 (inlined by) spinlock_acquire at /home/ft/esp/esp-idf/components/esp_hw_support/include/soc/spinlock.h:103 (inlined by) xPortEnterCriticalTimeout at /home/ft/esp/esp-idf/components/freertos/port/xtensa/port.c:288

amirgon commented 2 years ago

In Micropython, when building an ESP32 board with SPI ram (such as GENERIC_SPIRAM), SPI ram is reserved exclusively for Python memory allocations. You cannot allocate it with heap_caps_aligned_calloc.

When you allocate a Python object (for example a bytearray) it's already allocated in SPI RAM.