LVGL in Zephyr application using ST7789 display

Description

I am trying to use LVGL to display text in application which run on Zephyr.
I found the driver available for display: zephyr/drivers/display/display_st7789v.c at main · zephyrproject-rtos/zephyr · GitHub
My application is compiled and running, however I cannot see any text display.
I tested display earlier without library and working fine.
Anything missing in prj.conf and DTS file (Refer below section for DTS node and prj.conf)?
Do I need to call any initialization function before calling example function?

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

MCU : STM32H5 series, Display: ST7789

What do you want to achieve?

I wanted to run LVGL in Zephyr application and display simple text.

What have you tried so far?

I followed below steps for integration:

  1. Added below configuration in prj.conf:
CONFIG_DISPLAY=y
CONFIG_LVGL=y
CONFIG_LV_Z_MEM_POOL_SIZE=8192
CONFIG_LV_FONT_MONTESERRAT_12=y
  1. Added Display node in SPI node as display is connected to MCU over SPI.
    DTS node:
chosen {
		zephyr,display = &display;
	};
&spi5{
      status = "okay";
      pinctrl-names = "default";
      display:st7789v@0{
         compatible = "sitronix,st7789v";
         reg = <0>;
         spi-max-frequency = <5000000>;
         width = <320>;
         height = <240>;
         .
         .
         .
         All required properties here
     };
};

3. compile and flash the application code.

Code to reproduce

/**

  • Basic example to create a “Hello world” label
    */
    void lv_example_get_started_1(void)
    {
    /Change the active screen’s background color/
    lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);

    /Create a white label, set its text and align it to the center/
    lv_obj_t * label = lv_label_create(lv_screen_active());
    lv_label_set_text(label, “Hello world”);
    lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
    lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
    }


## Screenshot and/or video
If possible, add screenshots and/or videos about the current state.

Hi @FW_developer,
recently I used st7789v and LVGL library under Zephyr and it works, so I can say that you have wrong device-tree definition.
st7789v uses mipi-dbi bus instead of SPI (in simple words mipi-dbi is SPI with additional pins).
In my case device-tree definition looks as follows:

	mipi_dbi1 {
		compatible = "zephyr,mipi-dbi-spi";
		reset-gpios = <&portb 5 GPIO_ACTIVE_LOW>;
		dc-gpios = <&portb 4 GPIO_ACTIVE_HIGH>;
		spi-dev = <&sercom4>;
		write-only;
		#address-cells = <1>;
		#size-cells = <0>;

		chart_display: st7789v@0 {
			compatible = "sitronix,st7789v";
			mipi-max-frequency = <30000000>;
			reg = <0>;
			width = <320>;
			height = <240>;
			x-offset = <0>;
			y-offset = <0>;
			vcom = <0x19>;
			gctrl = <0x35>;
			vrhs = <0x12>;
			vdvs = <0x20>;
			mdac = <0x60>;  // rotates by 270 degrees
			gamma = <0x01>;
			colmod = <0x55>;
			lcm = <0x2c>;
			porch-param = [0c 0c 00 33 33];
			cmd2en-param = [5a 69 02 01];
			pwctrl1-param = [a4 a1];
			pvgam-param = [D0 04 0D 11 13 2B 3F 54 4C 18 0D 0B 1F 23];
			nvgam-param = [D0 04 0C 11 13 2C 3F 44 51 2F 1F 1F 20 23];
			ram-param = [00 F0];
			rgb-param = [CD 08 14];
			mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
			status = "okay";

@Rik Thanks for response and it worked on SPI as well with changes mdac = <0x60>; // rotates by 270 degrees.
Only issue I can see is my screen background is flickering which is easily noticeable.
What could be the reason? Is it something related to LVGL settings?
I checked refresh period ( LV_DEF_REFR_PERIOD ), and it is default and 30 msec.

@FW_developer - I’d suggest to fix your dts file. You should define st7789v under MIPI-DBI node as in my example. In your current implementation there is no definition for RESET and DC pin which may lead to unexpected behaviors (as flickering screen background).

@Rik Ok I will try this. Another question, I have started zephyr recently, where I need to refer node label “mipi_dbi1” in my DTS. I can create this node in DTS file but not getting how to utilize it so that MIPI-DBI will be used instead of SPI ?