Working devicetree for ST7789v display

I have several of these 135x240 display modules that work effortlessly with all of my development platforms, all except for nRF Connect of course.

ST7789v 135x240 1.14" display module

I can't even get Zephyr's bare minimum display driver sample to work after a week of struggle. Note that I've had easy success with the ubiquitous SSD1306 display module, so I'm not completely clueless, but I've hit a brick wall with this ST7789v.

Zephyr's generic ST7789v driver only offers two variations, neither of which match this hardware, so I've tried copying the relevant devicetree settings from other in-tree boards that seemingly share the same panel (such as the M5StickC Plus), but still no success.

Details:

I'm using the nRF5340 Audio DK which is fixed at 1v8, so I'm correctly level-shifting the SPI signals to 3v3 for the display module, and I'm using the appropriate Arduino SPI header pins on the DK for the connections, with the backlight directly tied to 3v3 and always on.

I've edited the in-tree st7789v_waveshare_240x240.overlay file in an attempt to match the hardware, and then added the following line to CMakeLists.txt:

set(SHIELD st7789v_waveshare_240x240)

There are no compilation or runtime errors, and according to the debug log the driver is continually writing to the SPI bus, but while the backlight is clearly on, the display remains blank:

ST7789v display remains blank

Again, this exact technique worked as expected for the I2C SSD1306, so I'm assuming that my SHIELD overlay is still incorrect, which I've included below:

/ {
	chosen {
		zephyr,display = &st7789v_st7789v_waveshare_240x240;
	};
};

&arduino_spi {
	status = "okay";
	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>;            /* D10 */

	st7789v_st7789v_waveshare_240x240: st7789v@0 {
		compatible = "sitronix,st7789v";
		spi-max-frequency = <20000000>;
		reg = <0>;
		cmd-data-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>;  /* D9 */
		reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>;     /* D8 */
		width = <135>;    // width = <240>;
		height = <240>;   // height = <240>;
		x-offset = <53>;  // x-offset = <0>;
		y-offset = <40>;  // y-offset = <0>;
		vcom = <0x28>;    // vcom = <0x19>;
		gctrl = <0x35>;
		vrhs = <0x10>;    // vrhs = <0x12>;
		vdvs = <0x20>;
		mdac = <0x00>;
		gamma = <0x01>;
		colmod = <0x55>;  // colmod = <0x05>;
		lcm = <0x2c>;
		porch-param = [0c 0c 00 33 33];
		cmd2en-param = [5a 69 02 00];  // cmd2en-param = [5a 69 02 01];
		pwctrl1-param = [a4 a1];
		pvgam-param = [d0 00 02 07 0a 28 32 44 42 06 0e 12 14 17];  // pvgam-param = [D0 04 0D 11 13 2B 3F 54 4C 18 0D 0B 1F 23];
		nvgam-param = [d0 00 02 07 0a 28 31 54 47 0e 1c 17 1b 1e];  // nvgam-param = [D0 04 0C 11 13 2C 3F 44 51 2F 1F 1F 20 23];
		ram-param = [00 F0];
		rgb-param = [40 02 14];  // rgb-param = [CD 08 14];
	};
};

Does anyone have a working devicetree for this display that they can share, or an example I could study? I've exhausted every combination of settings I can think of, but cannot find the correct configuration. I don't need the obscene overhead of LVGL, just a functioning driver.

Minutia:

  • nRF Connect SDK/toolchain v2.7.0
  • nRF5340 Audio DK (PCA10121 v1.0.0)
  • VS Code and Plugins (latest 2024-12-02)
Parents
No Data
Reply
  • As per my original post, I'm working from the Zephyr Display Driver sample.

    Regarding the I2C SSD1306, I simply added a single set(SHIELD) line to CMakeLists.txt and was done. The only difference being that I connected to (and level-shifted) the DK's Arduino I2C header pins.

    The SPI ST7789V, unfortunately, has not been so straightforward. Knowing that its devicetree would need the correct memory aperture and timing settings, I searched GitHub for similar display panels, and thought myself so clever for copying the M5StickC Plus configuration, but was obviously not clever enough.

    I mentioned the level-shifting and backlight details because those are common pitfalls that I've already researched and avoided. I've also read the LVGL on a TFT LCD Display guide that you suggested, along with Helsing's Printing to an I2C OLED Display post. I confidently understand the mechanics and infrastructure, I'm just stuck on the correct devicetree.

Children
  • ace.johnny said:
    As per my original post, I'm working from the Zephyr Display Driver sample.

    Understood, the reason for why I ask it to look at the configurations that you've added to prj.conf. As the sample zephyr\samples\drivers\display\ does not include many configurations. 

    ace.johnny said:
    The only difference being that I connected to (and level-shifted) the DK's Arduino I2C header pins.

    There is a difference in regards to I2C vs SPI, and as you point out the need for a level shifter. 

    Have you verified that the correct signals on the SPI lines? 

    A colleague of mine does have an ST7789v and tested with his nRF5340DK

    / {
        chosen {
            zephyr,display = &st7789v_ips_240x240;
        };
    };
     
    &arduino_spi {
        status = "okay";
        cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>;    /* D10 */
     
        st7789v_ips_240x240: st7789v@0 {
            compatible = "sitronix,st7789v";
            spi-max-frequency = <20000000>;
            reg = <0>;
            cmd-data-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>;  /* D9 */
            reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>; /* D8 */
            width = <240>;
            height = <240>;
            x-offset = <0>;
            y-offset = <0>;
            vcom = <0x19>;
            gctrl = <0x35>;
            vrhs = <0x12>;
            vdvs = <0x20>;
            mdac = <0x00>;
            gamma = <0x01>;
            colmod = <0x05>;
            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];
        };
    };

    This is lvgl example built for nrf5340dk_nrf5340_cpuapp_ns.overlay and with the following configurations in prj.conf

    CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=8
    CONFIG_MAIN_STACK_SIZE=2048
     
    CONFIG_DISPLAY=y
    CONFIG_DISPLAY_LOG_LEVEL_ERR=y
     
    CONFIG_LOG=y
     
    CONFIG_LVGL=y
    CONFIG_LV_MEM_CUSTOM=y
    CONFIG_LV_USE_LOG=y
    CONFIG_LV_USE_LABEL=y
    CONFIG_LV_USE_BTN=y
    CONFIG_LV_USE_IMG=y
    CONFIG_LV_FONT_MONTSERRAT_14=y
     
    # SPI ST7789
    CONFIG_ST7789V=y
    CONFIG_ST7789V_RGB565=y
     
    # ST7789 Settings for LVGL
    CONFIG_LV_Z_BITS_PER_PIXEL=16
    CONFIG_LV_COLOR_DEPTH_16=y
    CONFIG_LV_COLOR_16_SWAP=y

    Have a look at this .pdf as well: nRF5340_5F00_Display1.3.pdf

    I hope this helps. 


    Kind regards,
    Øyvind

Related