This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Zephyr ILI9341 Display Driver Compilation Errors - Missing Devicetree Properties

I'm trying to use an ILI9341 display with nRF52840 in Zephyr (v4.1.99). The build fails with multiple errors about missing Devicetree properties when compiling display_ili9xxx.c:

error: 'DT_N_S_soc_S_spi_40003000_S_ili9341_0_P_gamset_LEN' undeclared
error: 'DT_N_S_soc_S_spi_40003000_S_ili9341_0_P_ifctl' undeclared
error: 'DT_N_S_soc_S_spi_40003000_S_ili9341_0_P_etmod' undeclared
[20+ similar property errors...]

This is my overlay file:

&spi1 {
    status = "okay";
    cs-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;

    ili9341: ili9341@0 {
        compatible = "ilitek,ili9341";
        reg = <0>;
        spi-max-frequency = <8000000>;
        
        // Add these required properties:
        spi-cpol;
        spi-cpha;
        
        dc-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
        reset-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
        backlight-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;

        // Add display inversion mode (try true or false)
        display-inversion;
        // or display-inversion = <1>; 
        // or display-inversion = <0>; if the first doesn't work

        width = <240>;
        height = <320>;
        rotation = <0>;
        
        // These might help if you still have issues:
        pixel-format = "rgb565";
        // cmd-data-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; // Alternative to dc-gpios
    };
};

I tried fixing the issue by modifying the prj.conf file, but it's still not working. Here's my current prj.conf:

CONFIG_SPI=y
CONFIG_GPIO=y
CONFIG_DISPLAY=y
CONFIG_DISPLAY_INIT_PRIORITY=90
CONFIG_ILI9341=y

This is part from zephyr.dts which include spi1:

spi1: spi@40004000 {
			compatible = "nordic,nrf-spi";
			#address-cells = < 0x1 >;
			#size-cells = < 0x0 >;
			reg = < 0x40004000 0x1000 >;
			interrupts = < 0x4 0x1 >;
			max-frequency = < 0x7a1200 >;
			easydma-maxcnt-bits = < 0x10 >;
			status = "okay";
			pinctrl-0 = < &spi1_default >;
			pinctrl-1 = < &spi1_sleep >;
			pinctrl-names = "default", "sleep";
			cs-gpios = < &gpio0 0xf 0x1 >;
			ili9341: ili9341@0 {
				compatible = "ilitek,ili9341";
				reg = < 0x0 >;
				spi-max-frequency = < 0x7a1200 >;
				spi-cpol;
				spi-cpha;
				dc-gpios = < &gpio0 0xe 0x1 >;
				reset-gpios = < &gpio0 0xd 0x1 >;
				backlight-gpios = < &gpio0 0x10 0x0 >;
				display-inversion;
				width = < 0xf0 >;
				height = < 0x140 >;
				rotation = < 0x0 >;
				pixel-format = "rgb565";
			};
		};

Parents
  • Hi,

     

    It looks like you are setting up a legacy way of declaring a display node. Please see here for the new mipi-dpi setup:

    https://docs.nordicsemi.com/bundle/ncs-2.9.1/page/zephyr/releases/migration-guide-3.7.html#display

     

    Please see here for an example implementation of your device:

    https://github.com/nrfconnect/sdk-zephyr/blob/v4.0.99-ncs1/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts#L66-L101

     

    PS: you should use the NRF_SPIM hardware module instead of the NRF_SPI module that you are currently pointing towards in your device tree node.

    NRF_SPIM is DMA capable, so will be much faster than the NRF_SPI.

    Change this line:

    compatible = "nordic,nrf-spi";

    To:

    compatible = "nordic,nrf-spim";

     

    Kind regards,

    Håkon

  • Thank you very much. This is my overlay file now. But it is still do not show anything:

    / {
        chosen {
            zephyr,display = &ili9341;
        };
    
        mipi_dbi {
            compatible = "zephyr,mipi-dbi-spi";
            dc-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;      // DC/RS pin
            reset-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;    // RESET pin
            write-only;
            #address-cells = <1>;
            #size-cells = <0>;
            spi-dev = <&spi1>;
    
            pinctrl-0 = <&spi1_default>;
            pinctrl-names = "default";
    
            ili9341: ili9341@0 {
                compatible = "ilitek,ili9341";
                reg = <0>;
                mipi-max-frequency = <4000000>;
                width = <240>;
                height = <320>;
                rotation = <180>;
    
                pwctrla = [39 2c 00 34 02];
                pwctrlb = [00 c1 30];
                timctrla = [85 00 78];
                timctrlb = [00 00];
                pwseqctrl = [64 03 12 81];
                pumpratioctrl = [20];
                disctrl = [08 82 27 04];
                vmctrl1 = [45 15];
                vmctrl2 = [90];
                enable3g = [00];
                ifctl = [01 00 06];
                ifmode = [c2];
                gamset = [01];
                frmctr1 = [00 1b];
                pwctrl1 = [10];
                pwctrl2 = [10];
                pgamctrl = [0F 29 24 0c 0e 09 4e 78 3c 09 13 05 17 11 00];
                ngamctrl = [00 16 1b 04 11 07 31 33 42 05 0c 0a 28 2f 0f];
            };
        };
    };
    
    &spi1 {
        status = "okay";
        cs-gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; // CS pin displeja
        pinctrl-0 = <&spi1_default>;
        pinctrl-1 = <&spi1_sleep>;
        pinctrl-names = "default", "sleep";
    };
    
    &pinctrl {
        spi1_default: spi1_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,       // SCK
                        <NRF_PSEL(SPIM_MOSI, 0, 30)>;      // MOSI
            };
        };
    
        spi1_sleep: spi1_sleep {
            group1 {
                // Sleep stanje prazno
            };
        };
    };
    

    And this is my simple main.c:

    #include <zephyr/kernel.h>
    #include <zephyr/device.h>
    #include <zephyr/drivers/display.h>
    #include <lvgl.h>
    
    #define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
    #include <zephyr/logging/log.h>
    LOG_MODULE_REGISTER(main);
    
    void main(void)
    {
        const struct device *display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
    
        if (!device_is_ready(display_dev)) {
            printk("Display not ready\n");
            return;
        }
    
        display_blanking_off(display_dev);
        lv_obj_clean(lv_scr_act()); // Očisti ekran
    
        lv_obj_t *rect = lv_obj_create(lv_scr_act());
        lv_obj_set_size(rect, 240, 320);
        lv_obj_set_style_bg_color(rect, lv_color_hex(0xFF0000), 0);  // Crvena pozadina
        lv_obj_center(rect);
    
        while (1) {
            lv_task_handler();
            k_msleep(10);
        }
    }
    
    

  • Hi,

     

    I assume you are able to successfully compile now? 

    Does the log show any issues?

     

    Have you probed the pins to see if the communication is as expected with the display?

     

    Kind regards,

    Håkon

  • I am also using same setup, nrf52840DK with ILI9341 display on ncs 2.9.0, but I get these errors:

    *** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
    [00:00:00.587,066] <err> os: ***** MPU FAULT *****
    [00:00:00.587,066] <err> os: Data Access Violation
    [00:00:00.587,066] <err> os: MMFAR Address: 0x22
    [00:00:00.587,097] <err> os: r0/a1: 0x00000000 r1/a2: 0x00000005 r2/a3: 0x00000001
    [00:00:00.587,097] <err> os: r3/a4: 0x00000000 r12/ip: 0xffffffff r14/lr: 0x00022997
    [00:00:00.587,127] <err> os: xpsr: 0x41000000
    [00:00:00.587,127] <err> os: Faulting instruction address (r15/pc): 0x0002327c
    [00:00:00.587,158] <err> os: >>> ZEPHYR FATAL ERROR 19: Unknown error on CPU 0
    [00:00:00.587,219] <err> os: Current thread: 0x20001580 (unknown)
    [00:00:01.752,471] <err> os: Halting system

  • I have a similar error here
    It seems to be a malloc issue in lvgl_init before reaching the main.
    C:\ncs\v3.1.0\modules\lib\gui\lvgl\src\draw\lv_image_decoder.c:65
     
    void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count)
    {
        lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t));
        /*Initialize the cache*/
        lv_image_cache_init(image_cache_size); // malloc of 64 works here
        lv_image_header_cache_init(image_header_count); // malloc of 64 fail here
    }
     


    The crash happen later, in a lv_label_set_text called in the main

    [00:00:00.789,337] <err> lvgl: (0.778, +10)      lv_obj_get_style_prop: Asserted at expression: obj != NULL (NULL pointer) lv_obj_style.c:33
    then
    [00:00:00.705,505] <err> os: ***** BUS FAULT *****
    [00:00:00.705,535] <err> os:   Precise data bus error
    [00:00:00.705,535] <err> os:   BFAR Address: 0x18808fa
    [00:00:00.705,535] <err> os: r0/a1:  0x018808f3  r1/a2:  0x0000005a  r2/a3:  0x2000af60
    [00:00:00.705,566] <err> os: r3/a4:  0x018808f3 r12/ip:  0x00000000 r14/lr:  0x00007c17
    [00:00:00.705,596] <err> os:  xpsr:  0x210f0000
    [00:00:00.705,596] <err> os: Faulting instruction address (r15/pc): 0x00028b24
    [00:00:00.705,627] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
    [00:00:00.705,657] <err> os: Current thread: 0x20001020 (unknown)
    [00:00:00.838,867] <err> os: Halting system
     
    LVGL version: 9.3 (last, june 2025)
    nRF Connect v3.1.0
    board nRF 52840 dk
    screen 
    2.8" TFT LCD - ILI9341
    zephyr 4.1
Reply
  • I have a similar error here
    It seems to be a malloc issue in lvgl_init before reaching the main.
    C:\ncs\v3.1.0\modules\lib\gui\lvgl\src\draw\lv_image_decoder.c:65
     
    void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count)
    {
        lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t));
        /*Initialize the cache*/
        lv_image_cache_init(image_cache_size); // malloc of 64 works here
        lv_image_header_cache_init(image_header_count); // malloc of 64 fail here
    }
     


    The crash happen later, in a lv_label_set_text called in the main

    [00:00:00.789,337] <err> lvgl: (0.778, +10)      lv_obj_get_style_prop: Asserted at expression: obj != NULL (NULL pointer) lv_obj_style.c:33
    then
    [00:00:00.705,505] <err> os: ***** BUS FAULT *****
    [00:00:00.705,535] <err> os:   Precise data bus error
    [00:00:00.705,535] <err> os:   BFAR Address: 0x18808fa
    [00:00:00.705,535] <err> os: r0/a1:  0x018808f3  r1/a2:  0x0000005a  r2/a3:  0x2000af60
    [00:00:00.705,566] <err> os: r3/a4:  0x018808f3 r12/ip:  0x00000000 r14/lr:  0x00007c17
    [00:00:00.705,596] <err> os:  xpsr:  0x210f0000
    [00:00:00.705,596] <err> os: Faulting instruction address (r15/pc): 0x00028b24
    [00:00:00.705,627] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
    [00:00:00.705,657] <err> os: Current thread: 0x20001020 (unknown)
    [00:00:00.838,867] <err> os: Halting system
     
    LVGL version: 9.3 (last, june 2025)
    nRF Connect v3.1.0
    board nRF 52840 dk
    screen 
    2.8" TFT LCD - ILI9341
    zephyr 4.1
Children
Related