Snapshot into SPIRAM on ESP32-S3


I am attempting to take a snapshot into a buffer created in SPIRAM by heap_caps_malloc(). Following code is executed within a task which handles LVGL. Task watchdog is triggered with the task being stuck on lv_snapshot_take_to_buf().

Buffer size of 1152000 bytes is calculated by lv_snapshot_buf_size_needed(). Display resolution is 800 * 480.

Could you please recommend how to troubleshoot this problem?

What MCU/Processor/Board and compiler are you using?

ESP32-S3-WROOM-1U-N8R2 / esp-idf-v5.0.1

What LVGL version are you using?


Code to reproduce

uint32_t buffer_size = lv_snapshot_buf_size_needed(lv_scr_act(), LV_IMG_CF_TRUE_COLOR_ALPHA);
printf("Buffer size required: %ld\n", buffer_size);

uint8_t * snapshot_buffer_p = (uint8_t*)heap_caps_malloc(buffer_size, MALLOC_CAP_SPIRAM);

lv_img_dsc_t snapshot_dsc;
lv_res_t lv_res;
lv_res = lv_snapshot_take_to_buf(lv_scr_act(), LV_IMG_CF_TRUE_COLOR_ALPHA, &snapshot_dsc, snapshot_buffer_p, buffer_size);