Screen drift while using animimg - how to load all images into ram?

I’m using esp32 with ESPIDF and LVGL 8.3.
I’m experiencing screen drift - which is not LVGL’s fault - explained here. But to combat this I need to store the images in ram, not access them from flash each time. I have already set:

CONFIG_LV_IMG_CACHE_DEF_SIZE=80
CONFIG_LV_MEM_CUSTOM=y

But even just using 2 images in the animimg animation makes the screen drift. I definitely have enough RAM to store these, since I have external RAM on this board. Any ideas?

Hi @robotanical ,

I found enabling the bounce buffer worked for me:

    esp_lcd_rgb_panel_config_t panel_config = {
        .data_width = 16, // RGB565 in parallel mode, thus 16bit in width
        .psram_trans_align = 64,
        .num_fbs = LCD_NUM_FB,
		.bounce_buffer_size_px = 10 * LCD_H_RES,       // I added this line in the panel configuration
        .clk_src = LCD_CLK_SRC_DEFAULT,
        .disp_gpio_num = PIN_NUM_DISP_EN,
        .pclk_gpio_num = PIN_NUM_PCLK,
        .vsync_gpio_num = PIN_NUM_VSYNC,
        .hsync_gpio_num = PIN_NUM_HSYNC,
        .de_gpio_num = PIN_NUM_DE,
        .data_gpio_nums = {
            PIN_NUM_DATA0,
            PIN_NUM_DATA1,
            PIN_NUM_DATA2,
            PIN_NUM_DATA3,
            PIN_NUM_DATA4,
            PIN_NUM_DATA5,
            PIN_NUM_DATA6,
            PIN_NUM_DATA7,
            PIN_NUM_DATA8,
            PIN_NUM_DATA9,
            PIN_NUM_DATA10,
            PIN_NUM_DATA11,
            PIN_NUM_DATA12,
            PIN_NUM_DATA13,
            PIN_NUM_DATA14,
            PIN_NUM_DATA15,
        },

If this doesn’t work try setting PCLK to a lower value as well…

Kind Regards,

Pete

Thank for the answer @pete-pjb, but I’m afraid that’s not gonna help - I’m already using the double frame buffer - since I wanted more FPS - right now I’m around 12 FPS for reference. And I’m aware that this issue might be fixed by lowering SPIRAM usage but I really want the animations to run smoothly so I want to lower flash usage instead, and load all images to RAM so they can be nicely displayed.

Hi @robotanical ,

In my opinion, to achieve your goals, I would look for a CPU Board with a bit more horsepower as 800 x 480 for the ESP32S3 is really pushing it’s capabilities.

Kind Regards,

Pete

Though the drift doesn’t exist when loading images from C arrays, so it seems to be the only way to get it to work. I really don’t want to have to convert 30+ images and then change all 30+ C files, so I’m trying to find another way.

The point is from what I understand - the images in the animimg should cache - I have set the LV_IMG_CACHE_DEF_SIZE=80, but the definitely don’t - at least not all of them. And in general I definitely have enough RAM, so maybe there’s another memory related setting I don’t see?