Description
What MCU/Processor/Board and compiler are you using?
I am using ESP32S3 MCU with esp-idf v5.5 toolchain. I also used lvgl/lvgl 9.0 component from espressif component registry (NOT the esp_port_lvgl)
What do you want to achieve?
I want to allocate buffers for display, create display, setup its refresh callback, color format I1 and post some widgets. Display refresh callback should call abort() - just for prototyping. The buffer size should be 5 000 bytes (200 pixels * 200 pixels / 8 pixels/byte = 5 000, using I1 (8 pixels/byte) BW color format)
What have you tried so far?
I tried experimenting. The issue is that buffer with size 5 000 bytes does not work and refresh callback is never called. When resizing to at least 5 008 words, it works.
I also tried googling, searching in docs, asking AI…
Code to reproduce
#include "lvgl.h"
#include "esp_log.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include <stdio.h>
// flush callback implementation
void my_flush_cb(lv_display_t * display, const lv_area_t * area, uint8_t * px_map)
{
abort(); // abort the program
}
// timer callback implementation
uint32_t my_get_millis(void)
{
return esp_timer_get_time() / 1000; // return system time from boot
// (similar to arduino IDE `millis()`
// (the division by 1 000 is necessary as I found it in docs and ` esp_timer_get_time() ` returns microseconds)
}
// main function
void app_main(void)
{
lv_init(); // initialize lvgl
lv_tick_set_cb(my_get_millis); // setup tick callback
static uint8_t buf[5000]; // this causes the error. Size 5 000 words (which should be OK) causes display refresh callback not being called. Size at least 5 008 words works normally.
lv_display_t * display = lv_display_create(200, 200);
printf("testpoint 0.0\n");
lv_display_set_color_format(display, LV_COLOR_FORMAT_I1); // setup color fomat
printf("testpoint 0.1\n");
lv_display_set_buffers(display, buf, NULL /* no 2nd buffer */, sizeof(buf) /* buffer size is computed automatically here */, LV_DISPLAY_RENDER_MODE_FULL); // setup buffers
printf("testpoint 0.2\n");
lv_display_set_flush_cb(display, my_flush_cb); // setup flush callback
printf("testpoint 0.3\n");
/* EXAMPLE CODE */
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello world");
/* END EXAMPLE CODE */
lv_refr_now(display); // program stucks here. After commenting out whole line, the refresh callback is not called
printf("testpoint 1\n");
while (1)
{
lv_timer_handler(); // update lvgl time
vTaskDelay(pdMS_TO_TICKS(10)); // wait for a while
}
}
Screenshot and/or video
None