Display ILI9341

Started by Eric976, September 14, 2021, 03:24:13 PM

Previous topic - Next topic

Eric976

I'm trying to make a TFT display with the controller ILI9341 works.

The wiring is as following:
1 GND => GND
2 RESET => PB1
3 SCL => SCK from SPI0
4 D/C => PB2
5 CS => CS from SPI0
6 SDA => MOSI from SPI0
7 SDO => MISO from SPI0
8 GND => GND
9 VDD => 3.3V

And my overlay is as following:
/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun50i-a64\0olimex,a64-olinuxino";
        description = "Enable ILI9341 display";

        fragment@0 {
                target = <&spi0>;
                __overlay__ {
                        status = "okay";
                };
        };

        fragment@1 {
                target = <&pio>;

                __overlay__ {
                        ili9341_pins: ili9341_pins {
                                pins = "PB1", "PB2"; /*RESET, DC_RS*/
                                function = "gpio_out", "gpio_out" ;
                        };
                };
        };

        fragment@2 {
                target = <&spi0>;

                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;

                        /*cs-gpios = <&pio 1 0 0>;*/ /* PB0 */

                        ili9341: ili9341@0 {
                                compatible = "ilitek,ili9341";
                                reg = <0>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&ili9341_pins>;
                                spi-max-frequency = <16000000>;
                                rotate = <90>;
                                bgr;
                                fps = <25>;
                                buswidth = <8>;
                                reset-gpios = <&pio 1 1 1>; /*RESET=PB1*/
                                dc-gpios = <&pio 1 2 0>; /*DC_RS=PB2*/
                                /*led-gpios = <&pio 1 3 0>;*/ /*LED=PB3*/
                                debug = <0>;
                        };
                };
        };
};

I'm getting these messages:
olimex@a64-olinuxino:~$ dmesg | grep fb
[    8.180624] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    8.193622] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
[    8.194321] fb_ili9341 spi0.0: fbtft_property_value: buswidth = 8
[    8.194334] fb_ili9341 spi0.0: fbtft_property_value: debug = 0
[    8.194342] fb_ili9341 spi0.0: fbtft_property_value: rotate = 90
[    8.194350] fb_ili9341 spi0.0: fbtft_property_value: fps = 25
[    8.213439] fb_ili9341 spi0.0: error -EINVAL: Failed to request reset GPIO
[    8.310289] fb_ili9341: probe of spi0.0 failed with error -22

What am I missing?

I'm looking forward to a return.
Thanks in advance.

LubOlimex

I know people had been successful in getting it work previously.

Are you using the UEXT pads to establish the hardware connections? It has SPI0 exposed on pads #7,#8,#9,#10 also 3.3V on pad #1 and GND on pad #2.

Did you enable spi0 with olinuxin-overlay command? It should be

sun50i-a64-spi0.dtbo           Enable SPI0 bus
and you might also need to enable:

spi0-spidev.dtbo               Enable spidev on SPI0
Technical support and documentation manager at Olimex

Eric976

Just to keep registered, it worked, the overlay I used is presented below. Just it is enough...
Checking the dmesg command it'll be possible to check which FB (framebuffer) is being used, then you can test to play a video using the command "mplayer -vo fbdev:/dev/fb1 Test.mp4"

/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun50i-a64\0olimex,a64-olinuxino";
        description = "Enable ILI9341 display";

        fragment@0 {
                target = <&spi0>;

                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;

                        status = "okay";
                        cs-gpios = <&pio 1 3 0>; /* PB3 */

                        ili9341: ili9341@0 {
                                compatible = "ilitek,ili9341";
                                reg = <0>;
                                pinctrl-names = "default";
                                /*pinctrl-0 = <&ili9341_pins>;*/
                                spi-max-frequency = <16000000>;
                                rotate = <90>;
                                bgr;
                                fps = <25>;
                                buswidth = <8>;
                                reset-gpios = <&pio 1 0 1>; /*RESET=PB0*/
                                dc-gpios = <&pio 1 1 0>; /*DC_RS=PB1*/
                                /*led-gpios = <&pio 1 2 0>;*/ /*LED=PB2*/
                                debug = <0>;
                        };
                };
        };
};