1 1
jonokoi

3.5 LCD ILI9486 with orange pi zero

Recommended Posts

I’m trying to use a 3.5 LCD (waveshare clone) with ILI9486 + XPT2046 with my orange pi zero. My display is like this.

I installed both Debian_buster_next_4.19.59 and Ubuntu_bionic_next_4.19.57 and I followed many guides in here  with no success.

 

I edited armbianEnv.txt and added these:

overlays=spi-spidev spi-add-cs1
param_spidev_spi_bus=1
param_spidev_spi_cs=1

 

After that I ran this

sudo modprobe fbtft_device custom name=fb_ili9486 gpios=dc:18,reset:2 speed=16000000 busnum=1 rotate=90

and didn’t get any error. I figured that the reset & DC pins on orange pi zero are pin22(GPIO2) and pin18(GPIO18) but I’m not 100% sure about these.

 

With dmesg I see these:

[  179.174013] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[  179.181645] fbtft_device: module is from the staging directory, the quality is unknown, you have been warned.
[  179.183696] spidev spi1.1: spidev spi1.1 1000kHz 8 bits mode=0x00
[  179.184295] fbtft_device: GPIOS used by 'fb_ili9486':
[  179.184307] fbtft_device: 'dc' = GPIO18
[  179.184314] fbtft_device: 'reset' = GPIO2
[  179.184331] spidev spi1.1: spidev spi1.1 1000kHz 8 bits mode=0x00
[  179.184347] spi spi1.0: fb_ili9486 spi1.0 16000kHz 8 bits mode=0x00
[  179.202576] fb_ili9486: module is from the staging directory, the quality is unknown, you have been warned.
[  179.749873] Console: switching to colour frame buffer device 60x40
[  179.751385] graphics fb0: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 4 KiB buffer memory, fps=20, spi1.0 at 16 MHz

 

I tried

con2fbmap 1 0

but the screen remains white

 

What else could I try? How could I debug the issue?

Share this post


Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?
3 minutes ago, jonokoi said:

What else could I try? How could I debug the issue?

I believe the correct tutorial is this one. It seems you've tried something from another unanswered thread.

 

Share this post


Link to post
Share on other sites

I followed this guide too with no luck. I only changed the dc gpio from 71 to 18. (71 doesn't exist on orange pi zero so the guide is for another board)

Share this post


Link to post
Share on other sites

I've been hacking at this for a few days on Armbian_19.11.3_Orangepizero_bionic_current_5.3.9. I tried without luck to get fbtft_device to work, but looks like it's been deprecated in the most recent versions of the kernel. Only solution I found was to make a .dts myself. Try these steps out:

 

> vim myili9486.dts # See file contents below
> armbian-add-overlay myili9486.dts # N.B. I had to modify this file to get it to work properly
								- comment out line 45... i.e.
if [[ $BRANCH != next && $BRANCH != dev ]]; then
        echo >&2 "Overlays are supported only on mainline kernel based images"
        # exit -1
fi

> reboot
/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun8i-h3";

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

			spidev@0{
				status = "disabled";
			};

			spidev@1{
				status = "disabled";
			};
		};
	};

	fragment@1 {
		target = <&pio>;
		__overlay__ {
			ili9486_pins: ili9486_pins {
				allwinner,pins = "PA2", "PA18";
				allwinner,function = "gpio_in";
			};
		};
	};

	fragment@2 {
		target = <&spi1>;
		__overlay__ {
			/* needed to avoid dtc warning */
			#address-cells = <1>;
			#size-cells = <0>;

			ili9486: ili9486@0{
				compatible = "ilitek,ili9486";
				reg = <0>;
				pinctrl-names = "default";
				pinctrl-0 = <&ili9486_pins>;

				spi-max-frequency = <16000000>;
				txbuflen = <32768>;
				rotate = <90>;
				bgr = <0>;
				fps = <30>;
				buswidth = <8>;
				regwidth = <16>;
				reset-gpios = <&pio 0 2 1>;
				dc-gpios = <&pio 0 18 0>;
				debug = <0>;

				init = <0x10000b0 0x00
				        0x1000011
					0x20000ff
					0x100003a 0x55
					0x1000036 0x28
					0x10000c2 0x44
					0x10000c5 0x00 0x00 0x00 0x00
					0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00
					0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00
					0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00
					0x1000036 0x28
					0x1000011
					0x1000029>;
			};

		};
	};

};

Once I rebooted the screen came up okay with a login prompt, I've based the DTS on the waveshare dts here: https://github.com/swkim01/waveshare-dtoverlays/blob/master/waveshare35a.dts

 

I haven't tried setting up the touch screen yet!

Share this post


Link to post
Share on other sites

John Wilson's device tree overlay was super helpful.  I've gotten the LCD working on an Orange Pi PC plus, on armbian focal (20.04 based, kernel 5.4.x) with the following overlay.  (I dropped defaults, optional settings, and things that reset back to defaults)

 

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun8i-h3";

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

        fragment@1 {
                target = <&spi0>;
                __overlay__ {
                        /* needed to avoid dtc warning */
                        #address-cells = <1>;
                        #size-cells = <0>;

                        ili9486: ili9486@0 {
                                compatible = "ilitek,ili9486";
                                reg = <0>;

                                spi-max-frequency = <16000000>;
                                rotate = <90>;
                                fps = <30>;
                                buswidth = <8>;
                                regwidth = <16>;
                                reset-gpios = <&pio 0 2 1>; /* PA2 */
                                dc-gpios = <&pio 2 7 0>; /* PC7 */
                                //debug = <0>;

                                init = <0x10000b0 0x00
                                        0x1000011
                                        0x20000ff
                                        0x100003a 0x55
                                        0x1000036 0x28
                                        0x10000c2 0x44
                                        0x10000c5 0x00 0x00 0x00 0x00
                                        0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00
                                        0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00
                                        0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00
                                        0x1000036 0x28
                                        0x1000011
                                        0x1000029>;
                        };
                };
        };
};

Basically, this switches to SPI0, and updates the gpio used for data/command switching.  (LCD_RS on some of the schematics)  I've not got touch working (yet?)  Note, this can only give you an LCD once linux has booted far enough, there's nothing here about uboot

Share this post


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...
1 1