use fb_ili9341 failed


Recommended Posts

I had build armbian 3 days ago, kernel ="5.8.13", with NanopiNEO, I want use a TFT screen, type is ILI9341, when I use "armbian-config" open spi_spidev, no /dev/spi* created, and screen does not work. here is config:

#

# cat /etc/modprobe.d/fbtft.conf
options fbtft
options fb_ili9341 name=fb_ili9341 gpios=rest:0,cs:67,dc:2,led:3 speed=48000000 fps=26 rotate=90 bgr=1 txbuflen=65536 debug=3

here is armbian-hardware-monitor.log

 

Other:  ttyS0 can't login, 

 

Does somebody can help me, thinks very much!

 

armbian-hardware-monitor.log

Link to post
Share on other sites
Donate and support the project!

After several days of study, I know that the new kernel version has cancelled the fbtft_device.ko method to drive fbtft, and changed it to the DT method. I also learned about the pinctrl subsystem, and tried to write an overlay by myself. After loading, the kernel has been found SPI device. The screen still doesn’t light up after the device is turned off. I don’t know the reason. I’m still looking for it. Can you help me?

dmesg output :

[   12.229733] [drm] Initialized ili9341 1.0.0 20180514 for spi0.0 on minor 0
[   12.706426] ili9341 spi0.0: fb0: ili9341drmfb frame buffer device

This is my overlay file, with DT fs check is OK!

/dts-v1/;
/plugin/;
/ {
        compatible = "allwinner,sun8i-h3";

        fragment@0 {
                target = <&spi0>;
                __overlay__ {
                        status = "okay";
                        spidev {
                                compatible = "adafruit,yx240qv29", "ilitek,ili9341";
                                reg = <0>;
                                spi-max-frequency = <32000000>;
                                txbuflen = <32768>;
                                rotate = <90>;
                                fps = <33>;
                                bgr = <0>;
                                buswidth = <8>;
                                dc-gpios = <&pio 0 2 1>;         /* PA2 pin13 */
                                reset-gpios = <&pio 0 0 1>;  /* PA0 pin11 */
                                led-gpios = <&pio 0 3 1>;        /* PA3 pin15 */
                                debug = <0>;
                                status="okay";
                        };
                };
        };
};

The Dupont wire connection method just like:

 * wire link:

 * ILI9341_PIN#      NanoPI-NEO_PIN#

 * SCK        <--->  23 GPIOC2

 * SDI/MOSI   <--->  19 GPIOC0

 * SDO/MISO   <--->  21 GPIOC1 

 * CS         <--->  24 [linux gpio=67] gpioC3 

 * DC/RS      <--->  13 [linux gpio=2] GPIOA2

 * RESET      <--->  11 [linux gpio=0] GPIOA0

 * VCC        <--->  4

 * GND        <--->  6

 * LED        <--->  15 [linux gpio=3] GPIOA3

 

Link to post
Share on other sites

/*
 * Device Tree overlay for ILI9341 LCD

 */

/*

 * wire link:

 * ILI9341_PIN#      NanoPI-NEO_PIN#

 * SCK        <--->  23 GPIOC2

 * SDI/MOSI   <--->  19 GPIOC0

 * SDO/MISO   <--->  21 GPIOC1 

 * CS         <--->  24 gpioC3 spi0_pins 

 * DC/RS      <--->  22 GPIOA1

 * RESET      <--->  7  GPIOG11

 * VCC        <--->  4

 * GND        <--->  6

 * LED        <--->  12 GPIOA6

 *

 * Device Tree overlay for ili9341 2.2inch TFT LCD

 * 5.x 内核

 */

/dts-v1/;

/plugin/;

/ {

        compatible = "allwinner,sun8i-h3";

 

        fragment@0 {

                target = <&spi0>;

                __overlay__ {

                        status = "okay";

                };

        };

 

        fragment@1 {

                target = <&pio>;

                __overlay__ {

                        spi0_cs_pins: spi0_cs_pins {

                                pins = "PC3";

                                function = "gpio_out";

                        };

 

                        opiz_display_pins: opiz_display_pins {

                pins = "PA1", "PG11", "PA6";

                function = "gpio_out";

                        };

                };

        };

 

        fragment@2 {

                target = <&spi0>;

                __overlay__ {

                        /* needed to avoid dtc warning */

                        #address-cells = <1>;

                        #size-cells = <0>;

                        pinctrl-0=<&spi0_pins &spi0_cs_pins>;

                        cs-gpios=<&pio 2 3 1>;

 

                        opizdisplay: opiz-display@0{

                                compatible = "ilitek,ili9341";

                                reg = <0>;  /* Chip Select 0 */

                                pinctrl-names = "default";

                                pinctrl-0 = <&opiz_display_pins>;

 

                                spi-max-frequency = <32000000>;

                                rotate = <90>;

                                bgr = <0>;

                                fps = <33>;

                                buswidth = <8>;

                                dc-gpios = <&pio 0 1 0>;     /* PIN_22  GPIOA1 */

                                reset-gpios = <&pio 6 11 1 >; /* PIN_7  GPIOG11 */

                                led-gpios=<&pio 0 6 0>;      /* PIN_12  GPIOA6 */

                                debug=<4>;

                                status="okay";

                        };

                };

        };

};

 

image.png

Link to post
Share on other sites

I don't understand "The screen still doesn’t light up after the device is turned off. "

 

My screen is on order and I hope to have it work with Duo2 and am looking at the spi drivers and the ili9341 code. Hopefully you get it to work so I can follow your example.

 

See /build/cache/sources/linux-mainline/orange-pi-5.9/drivers/gpu/drm/tiny/ili9341.c to see if any DT items you may have missed or not configured correctly. 

 

If you download the source take a look at ili9341_probe( struct spi_device *spi)

       ... devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);

       ...  devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW);

       ... devm_of_find_backlight(dev);

       ... device_property_read_u32(dev, "rotation", &rotation);

       ...  mipi_dbi_dev_init(spi, dbi, dc);

 

This is what the probe does. Your DT seems to have the right elements. Maybe try stripping your wiring down to the absolute minimum needed?

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...