LVGL display Zephyr wrong color

Hello, I’m building the LVGL that uses NRF52840 with zephyr (NCS 2.2.0).
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.

  1. I have used GC9A01 https://www.waveshare.com/1.28inch-lcd-module.htm
  2. This one is in the simulation tool
    report1
  3. This one is a realistic image

    You can see the background has changed to white and the minute changed to yellow.

My config LVGL in the project config:

  • CONFIG_LVGL=y
  • CONFIG_LV_MEM_CUSTOM=y
  • CONFIG_LV_FONT_MONTSERRAT_14=y
  • CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=8
  • CONFIG_LV_Z_VDB_SIZE=10
  • CONFIG_LV_Z_DOUBLE_VDB=n
  • CONFIG_SPI=y
  • CONFIG_GC9A01=y
  • CONFIG_LV_COLOR_DEPTH_16=y
  • CONFIG_LV_COLOR_16_SWAP=y
  • CONFIG_LV_MEM_SIZE_KILOBYTES=25
  • CONFIG_LV_MEM_ADDR=0x0
  • CONFIG_LV_MEM_BUF_MAX_NUM=16

Thank you.!!!

Don’t know, maybe setting CONFIG_LV_COLOR_16_SWAP=n will help!?

I have changed the config to CONFIG_LV_COLOR_16_SWAP=n, but still, get error,


That is when I changed it to CONFIG_LV_COLOR_16_SWAP=n.
Also, I found that it only displays pictures wrong color. If it is a label text it will be fine

Hi all, because my init of the gc9a01 is wrong, that’s why it has displayed the wrong color. I have fixed it.
Now I have a good display.


My config init gc9a01

GC9A01A_INREGEN2, 0,
0xEB, 1, 0x14,
GC9A01A_INREGEN1, 0,
GC9A01A_INREGEN2, 0,
0xEB, 1, 0x14,
0x84, 1, 0x40,
0x85, 1, 0xFF,
0x86, 1, 0xFF,
0x87, 1, 0xFF,
0x88, 1, 0x0A,
0x89, 1, 0x21,
0x8A, 1, 0x00,
0x8B, 1, 0x80,
0x8C, 1, 0x01,
0x8D, 1, 0x01,
0x8E, 1, 0xFF,
0x8F, 1, 0xFF,
0xB6, 2, 0x00, 0x00,
GC9A01A_MADCTL, 1, 0x18,
GC9A01A_PIXFMT, 1, COLOR_MODE_16_BIT, //0x06,

0x90, 4, 0x08, 0x08, 0x08, 0x08,
0xBD, 1, 0x06,
0xBC, 1, 0x00,
0xFF, 3, 0x60, 0x01, 0x04,
GC9A01A1_VREG1A,1, 0x13,
GC9A01A1_VREG1B,1, 0x13,
GC9A01A1_VREG2A,1, 0x22,

0xBE, 1, 0x11,
ILI9341_GMCTRN1, 2, 0x10, 0x0E,
0xDF, 3, 0x21, 0x0c, 0x02,

GC9A01A_GAMMA1, 6, 0x45, 0x09, 0x08, 0x08, 0x26, 0x2A,
GC9A01A_GAMMA2, 6, 0x43, 0x70, 0x72, 0x36, 0x37, 0x6F,
GC9A01A_GAMMA3, 6, 0x45, 0x09, 0x08, 0x08, 0x26, 0x2A,
GC9A01A_GAMMA4, 6, 0x43, 0x70, 0x72, 0x36, 0x37, 0x6F,

0xED, 2, 0x1B, 0x0B,
0xAE, 1, 0x77,
0xCD, 1, 0x63,
0x70, 9, 0x07, 0x07, 0x04, 0x0E, 0x0F, 0x09, 0x07, 0x08, 0x03,
ILI9341_FRAMERATE, 1, 0x34,
0x62, 12, 0x18, 0x0D, 0x71, 0xED, 0x70, 0x70,
0x18, 0x0F, 0x71, 0xEF, 0x70, 0x70,
0x63, 12, 0x18, 0x11, 0x71, 0xF1, 0x70, 0x70,
0x18, 0x13, 0x71, 0xF3, 0x70, 0x70,
0x64, 7, 0x28, 0x29, 0xF1, 0x01, 0xF1, 0x00, 0x07,
0x66, 10, 0x3C, 0x00, 0xCD, 0x67, 0x45, 0x45, 0x10, 0x00, 0x00, 0x00,
0x67, 10, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x54, 0x10, 0x32, 0x98,
0x74, 7, 0x10, 0x85, 0x80, 0x00, 0x00, 0x4E, 0x00,
0x98, 2, 0x3e, 0x07,
// GC9A01A_TEON, 0,
GC9A01A_TEON, 1, GC9A01A_INVOFF,
GC9A01A_INVON, 0,
GC9A01A_SLPOUT, 0x80, // Exit sleep
GC9A01A_DISPON, 0x80, // Display on
0x00                  // End of list
1 Like

Looks great!

Hi @DucTuan, I am also trying to implement the GC9A01 with Zephyr on nRF52840. Would you let me know what you are using for the drivers for this display? Thank you!

Hi @Wyatt_Smith I used the GC9A01 driver of this repo

thank you!

Thanks for sharing that @DucTuan! I’ve been trying to get this driver working with the nRF52840-DK but I’m having some trouble.

I haven’t been able to successfully compile the ZSWatch project for the nRF52840-DK even after making a custom .overlay file.
C:/ncs/v2.5.0/zephyr/include/zephyr/device.h:85:41: error: '__device_dts_ord_DT_CHOSEN_zephyr_bt_hci_rpmsg_ipc_ORD' undeclared (first use in this function)
This seems like a configuration error that is related to BLE in the ZSWatch project.

I have also tried to extract the GC9A01 driver from the project and use it in a standalone application but also running into compilation issues.
in function 'lvgl_init': C:/ncs/v2.5.0/zephyr/modules/lvgl/lvgl.c:235: undefined reference to '__device_dts_ord_146'

I’m looking for help to get this driver working with the nRF52840 so if you have any advice or source code I would really appreciate it! Thank you again :slightly_smiling_face:

Do you use same display that I used? Ok i will push my code to the github and send you.
Thank you.

Yeah I am using the same display as you. Thank you!

hope this can help you

I think the board “smart_watch_tuan_nrf52840” is running. could you chose this board when build this project
Thank you.

Thank you! I will try it out :smiley:

Thanks @DucTuan! I was able to use this to get it working :smiling_face: