Wrong color display with lvgl 8.3

Hello, I’m building the LVGL.
I have simulated with LVGL simulation tools and it showed true color, but when I load the code and use the screen and display it → screen displays the wrong color.

My code:
int main_lvgl(void)
/LittlevGL init/

/*Linux frame buffer device init*/

/*A small buffer for LittlevGL to draw the screen's content*/
static lv_color_t buf[DISP_BUF_SIZE];

/*Initialize a descriptor for the buffer*/
static lv_disp_draw_buf_t disp_buf;
lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);

/*Initialize and register a display driver*/
static lv_disp_drv_t disp_drv;
disp_drv.draw_buf   = &disp_buf;
disp_drv.flush_cb   = fbdev_flush;
disp_drv.hor_res    = 1024;
disp_drv.ver_res    = 768;

static lv_indev_drv_t indev_drv_1;
lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/
indev_drv_1.type = LV_INDEV_TYPE_POINTER;

/*This function will be called periodically (by the library) to get the mouse position and state*/
indev_drv_1.read_cb = evdev_read;
lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1);

/*Set a cursor for the mouse*/
lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */
lv_img_set_src(cursor_obj, &mouse_cursor_icon);           /*Set the image source*/
lv_indev_set_cursor(mouse_indev, cursor_obj);             /*Connect the image  object to the driver*/


/*Create a Demo*/
// lv_example_get_started_1();

/*Handle LitlevGL tasks (tickless mode)*/
while(1) {

return 0;



  1. with config #define LV_COLOR_16_SWAP 1, see color_failed_swap_0.png

  2. with config #define LV_COLOR_16_SWAP 1, see color_failed_swap_1.png

  3. my lv_conf.h
    lv_conf.h (23.3 KB)

  4. my lv_drv_conf.h
    lv_drv_conf.h (14.6 KB)

Please check and fix it.
Thank you.!!!


are you sure your display uses 16-bit color?

Thanks Tinus.

I’m not sure. How to know exactly if the device is using 16-bit color?

You will have to look at the datasheet to find that out.

One thing you could try, in lv_conf.h change
#define LV_COLOR_DEPTH 16 (default) to #define LV_COLOR_DEPTH 32 to see if that changes anything.

Thanks Tinus.