Inquiry on ST7789V MIPI-DBI Driver Configuration in NCS 2.9.0

Dear,

I recently upgraded my project from NCS 2.4.0 to NCS 2.9.0 and encountered an issue with the ST7789V display driver.

Previously, I used SPI0 to interface with the ST7789V display, and the configuration in my device tree worked fine. However, after upgrading to NCS 2.9.0, I noticed that the driver type for ST7789V has changed to MIPI-DBI, and my previous device tree configuration is no longer applicable.

I have reviewed the nRF Connect SDK documentation, but I could not find any clear guidance on how to correctly configure MIPI-DBI for ST7789V in the new version. Below is my previous device tree configuration that worked in NCS 2.4.0:

&spi0 {
	st7789v@0 {
		compatible = "sitronix,st7789v";
		reg = <0x0>;
		cmd-data-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
		label = "ST7789V";
		status = "okay";
		spi-max-frequency = <2000000>;
		width = <240>;
		height = <280>;
		x-offset = <0>;
		y-offset = <20>;
		vcom = <0x32>;
		gctrl = <0x35>;
		vrhs = <0x15>;
		mdac = <0x00>;
		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 08 0e 09 09 05 31 33 48 17 14 15 31 34];
		nvgam-param = [d0 08 0e 09 09 15 31 33 48 17 14 15 31 34];
		ram-param = [00 f8];
		rgb-param = [cd 08 14];
		vdvs = <0x20>;
		reset-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
		supply-gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
	};

	status = "okay";
	cs-gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
};

&spi0_default {
	group1 {
		psels = <NRF_PSEL(SPIM_SCK, 0, 3)>, <NRF_PSEL(SPIM_MOSI, 0, 4)>;
	};
};

/ {
	chosen {
		zephyr,display = &{/soc/spi@40003000/st7789v@0/};
	};
};

Could you please advise on:

  1. How to correctly configure the device tree for ST7789V using MIPI-DBI in NCS 2.9.0?
  2. Are there any specific changes in the SPI or display subsystem that I need to consider?
  3. Is there an example or reference documentation available for migrating from the old driver to the new one?

I appreciate your support and look forward to your guidance.

Best regards,

emmovo

Parents
  • Hello,

    You can see this documentation (Migration guide to Zephyr v3.7.0) to know how to define MIPI-DBI device. 

    #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h> should be added in the MIPI_DBI bindings device tree.

    /* Legacy GC9X01 display definition */
    &spi0 {
        gc9a01: gc9a01@0 {
            status = "okay";
            compatible = "galaxycore,gc9x01x";
            reg = <0>;
            spi-max-frequency = <100000000>;
            cmd-data-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
            ...
        };
    };
    
    /* New display definition with MIPI DBI device */
    
    #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
    
    ...
    
    mipi_dbi {
        compatible = "zephyr,mipi-dbi-spi";
        dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
        reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
        spi-dev = <&spi0>;
        #address-cells = <1>;
        #size-cells = <0>;
    
        gc9a01: gc9a01@0 {
            status = "okay";
            compatible = "galaxycore,gc9x01x";
            reg = <0>;
            mipi-max-frequency = <100000000>;
            ...
        };
    };
    

  • I am having the same issue. I think I am close...

    for SDK 2.7 this works perfectly

    #include <zephyr/dt-bindings/display/panel.h>
    
    / {
    	chosen {
    		zephyr,display = &gs91010;
    	};
    };
    
    
     
    &spi3 {
    	status = "okay";
    
    	gs91010: gc9x01x@0 {
    		compatible = "galaxycore,gc9x01x";
    		reg = <0>;
    		spi-max-frequency = <100000000>;
    		width = <240>;
    		height = <240>;
    		pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
    		cmd-data-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;	
    		reset-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
    		display-inversion; 
    		orientation = "180"; // Set to rotate the display
    		// gamma settings can be added if needed
    	};
    
    	cs-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
    };
    
    &spi3_default {
    	group1 {
    		psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
    				<NRF_PSEL(SPIM_MISO, 0, 4)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 29)>;
    		nordic,drive-mode = <NRF_DRIVE_H0H1>;
    	};
    };

    Now when switching to SDK 2.9

    #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
    
    / {
    	chosen {
    		zephyr,display = &gs91010;
    	};
    };
    
    mipi_dbi {
        compatible = "zephyr,mipi-dbi-spi";
        dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
        reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
        spi-dev = <&spi0>;
        #address-cells = <1>;
        #size-cells = <0>;
    
        gc9a01: gc9a01@0 {
            status = "okay";
            compatible = "galaxycore,gc9x01x";
            reg = <0>;
            mipi-max-frequency = <100000000>;
            width = <240>;
    		height = <240>;
    		pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
    		cmd-data-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;	
    		reset-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
    		display-inversion; 
    		orientation = "180"; // Set to rotate the display
        };
    };

    But I get errors such as
    "Node mipi_dbi defined outside of root scope. Only reference nodes and the root node itself are allowed

    mipi_dbi/"

    "devicetree error: ./nrf52840dk_nrf52840.overlay:23 (column 1): parse error: expected '/' or label reference (&foo)
    CMake Error at C:/ncs/v2.9.0/zephyr/cmake/modules/dts.cmake:295 (execute_process):"

    I have read the various update guidelines, but that does not help me solve this problem

  • Hello,

    The error shows mipi_dbi is defined out of the root scope. You can try to add this inside the root. 

    #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
    
    / {
        chosen {
            zephyr,display = &gc9a01;
        };
    
        mipi_dbi {
            compatible = "zephyr,mipi-dbi-spi";
            dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
            spi-dev = <&spi0>;
            #address-cells = <1>;
            #size-cells = <0>;
    
            gc9a01: gc9a01@0 {
                status = "okay";
                compatible = "galaxycore,gc9x01x";
                reg = <0>;
                mipi-max-frequency = <100000000>;
                width = <240>;
                height = <240>;
                pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
                display-inversion;
                orientation = "180"; // Set to rotate the display
            };
        };
    };

Reply
  • Hello,

    The error shows mipi_dbi is defined out of the root scope. You can try to add this inside the root. 

    #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
    
    / {
        chosen {
            zephyr,display = &gc9a01;
        };
    
        mipi_dbi {
            compatible = "zephyr,mipi-dbi-spi";
            dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
            spi-dev = <&spi0>;
            #address-cells = <1>;
            #size-cells = <0>;
    
            gc9a01: gc9a01@0 {
                status = "okay";
                compatible = "galaxycore,gc9x01x";
                reg = <0>;
                mipi-max-frequency = <100000000>;
                width = <240>;
                height = <240>;
                pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
                display-inversion;
                orientation = "180"; // Set to rotate the display
            };
        };
    };

Children
  • Hi Kazi,

    Tried your code.


    devicetree error:

    nrf52840dk_nrf52840.overlay:37 (column 29): parse error: expected number or parenthesized expression

    That is cause by "pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;"
    If I remove that line and recompile


    C:/Users/BjornOlsen/Documents/GitHub/nestlab/build/zephyr/include/generated/devicetree_generated.h:15794:50: error: 'DT_N_S_mipi_dbi_S_gc9a01_0_P_width' undeclared here (not in a function); did you mean 'DT_N_S_mipi_dbi_S_gc9a01_0_P_reg'?
    15794 | #define DT_CHOSEN_zephyr_display DT_N_S_mipi_dbi_S_gc9a01_0

    so now it seems to complain about width.

    I feel I am getting closer, but not quite there yet.

  • Hello,

    For the first error, it seems the PANEL_ was not defined. It should be in the devicetree file as header file

    #include <zephyr/dt-bindings/display/panel.h>

    Can you try this first and see if you get the second error?

  • Hello.

    I get the same error.
    But it resolved the issue with pixel-format which I could include.


    here is the full overlay.

    #include <zephyr/dt-bindings/display/panel.h>
    #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
    
    / {
        chosen {
            zephyr,display = &gc9a01;
        };
    
        mipi_dbi {
            compatible = "zephyr,mipi-dbi-spi";
            dc-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
            spi-dev = <&spi3>;
            #address-cells = <1>;
            #size-cells = <0>;
    
            gc9a01: gc9a01@0 {
                status = "okay";
                compatible = "galaxycore,gc9x01x";
                reg = <0>;
                mipi-max-frequency = <100000000>;
                pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
                width = <240>;
                height = <240>;
                display-inversion;
                orientation = "180"; // Set to rotate the display
            };
        };
    };
    
    &spi3_default {
    	group1 {
    		psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
    				<NRF_PSEL(SPIM_MISO, 0, 4)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 29)>;
    		nordic,drive-mode = <NRF_DRIVE_H0H1>;
    	};
    };

  • OK I did a completely clean build. now it works 100% all good.

  • Great! so with these two

    #include <zephyr/dt-bindings/display/panel.h>
    #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>

    header files and the overlay file I attached before solved the issue?

Related