NRF9161DK LVGL DISPLAY

Hi, 

I am trying to use an ST7789 display with the NRF9161DK, I was following this guide but got no luck:

https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/peripherals/posts/lvgl-on-a-tft-lcd-display-with-the-nrf9160-dk.

I'm lost on the approach, I switched to a zephyr sample LVGL and configured it for the NRF9161DK and the ST7789, but have some errors configuring the diplay;

ncs\v2.6.1\zephyr\samples\subsys\display\lvgl and ncs\v2.6.1\zephyr\samples\modules\lvgl\demos. 

Wich one should I use?

And the most important question, am I on the rigth path? Can I configure one of the LVGL Zephyr samples to work with the ST7789 and the nrf9161DK?

Can you give me some guidance please?

Thank You

  • Hi Daniel

    The devzone blog is some years old and there has been a lot of changes to Zephyr and our SKD since the time it was written so I would presume some steps are no longer possible to follow. 

    I think I would start with the ncs\v2.6.1\zephyr\samples\modules\lvgl\demos as it is a simple "hello world" sample. Could you post the error you got when you tried to use the sample?

    I think you will need to build your application with the dshield flag like seen here: https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/boards/shields/st7789v_generic/doc/index.html 

    What is your VDD_GPIO  configured to? The display need 3V3

    Regards

    Runar

  • Hi runsiv,

    Thank you so much for your help, I followed your instructions and it built and flashed perfectly, now I have another problem, the screen doesn't show anything, I tested two screen and nothing (and both examples). 

    Everything looks fine, i tested the pins and they deliver 3.3v except for p0.11 p0.12 and p0.13, I dont have an oscilloscope in hand, so can't test the spi, the only thing that can be wrong is on P0.13 and P.0.11.

    I don't know where the spi is initialized, but my overlay looks like this:

    and this is the st7789 240x240 overlay I have:

    /*
     * Copyright (c) 2019 Jan Van Winkel <[email protected]>
     * Copyright (c) 2019 PHYTEC Messtechnik GmbH
     *
     * SPDX-License-Identifier: Apache-2.0
     */

    / {
        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 = <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];
        };
    };
    the board is set at 3.3v and the backlight of the lcd is on.
    One of the LCDs has pins: GND,VCC,SCL,SDA,RES,DC,BLK (waveshare 240x240)
    The other: GND VCC SCL SDA RES DC CS BLK (240X280)
    Thank you,
    Daniel
  • Hi Daniel

    Can you also show me your pin control related to &arduino_spi? 

    I would expect your overlay to look something like this(for as an example)

    arduino_spi: &spi3 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>, /* D10 */
    		   <&gpio0 20 GPIO_ACTIVE_LOW>;
    	pinctrl-0 = <&spi3_default>;
    	pinctrl-1 = <&spi3_sleep>;
    	pinctrl-names = "default", "sleep";
    
    	gd25wb256: gd25wb256e3ir@1 {
    		compatible = "jedec,spi-nor";
    		status = "disabled";
    		reg = <1>;
    		spi-max-frequency = <8000000>;
    		size = <268435456>;
    		has-dpd;
    		t-enter-dpd = <3000>;
    		t-exit-dpd = <40000>;
    		sfdp-bfp = [
    			e5 20 f3 ff  ff ff ff 0f  44 eb 08 6b  08 3b 42 bb
    			ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
    			10 d8 00 ff  44 7a c9 fe  83 67 26 62  ec 82 18 44
    			7a 75 7a 75  04 c4 d5 5c  00 06 74 00  08 50 00 01
    			];
    		jedec-id = [c8 65 19];
    	};
    };
    

    I would also expect  a status="okay" inside the st7789v_st7789v_waveshare_240x240. I would also verify that you have enabled the peripheral in your prj.conf

    Regards

    Runar

  • This is how my pin control definition looks like (the same apparently):

    arduino_spi: &spi3 {
        compatible = "nordic,nrf-spim";
        status = "okay";
        cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>, /* D10 */
                <&gpio0 20 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi3_default>;
        pinctrl-1 = <&spi3_sleep>;
        pinctrl-names = "default", "sleep";
    
        gd25wb256: gd25wb256e3ir@1 {
            compatible = "jedec,spi-nor";
            status = "disabled";
            reg = <1>;
            spi-max-frequency = <8000000>;
            size = <268435456>;
            has-dpd;
            t-enter-dpd = <3000>;
            t-exit-dpd = <40000>;
            sfdp-bfp = [
                e5 20 f3 ff  ff ff ff 0f  44 eb 08 6b  08 3b 42 bb
                ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
                10 d8 00 ff  44 7a c9 fe  83 67 26 62  ec 82 18 44
                7a 75 7a 75  04 c4 d5 5c  00 06 74 00  08 50 00 01
                ];
            jedec-id = [c8 65 19];
        };
    };
    I also enabled spi in main: #include <zephyr/drivers/spi.h>
     
    , and this is my prj.conf:
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_LOG=y
    CONFIG_SHELL=y
    
    CONFIG_LVGL=y
    CONFIG_LV_Z_MEM_POOL_SIZE=49152
    CONFIG_LV_Z_SHELL=y
    CONFIG_LV_USE_MONKEY=y
    
    CONFIG_DISPLAY=y
    CONFIG_INPUT=y
    
    CONFIG_LV_FONT_MONTSERRAT_12=y
    CONFIG_LV_FONT_MONTSERRAT_14=y
    CONFIG_LV_FONT_MONTSERRAT_16=y
    
    # Benchmark Demo
    CONFIG_LV_USE_FONT_COMPRESSED=y
    
    CONFIG_SPI=y
    
    Still no errors, and nothing on screen.
    Thank you,
    Daniel
  • Ah, you are missing 

    CONFIG_ST7789V=y
    Which is needed to enable the driver for the display. 
    Regards
    Runar
Related