(WORK IN PROGRESS)
The connection
OPi pin | Purpose | LCD pin |
1 | 3.3 V | 1 |
2 or 4 | 5 V | 4 |
6 or [see chart] | GND | 6 |
19 | SPI | 19 |
21 | 21 | |
Software
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
spidev@0{
status = "disabled";
};
spidev@1{
status = "disabled";
};
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
// Set up pins
ili9486_pins: ili9486_pins {
allwinner,pins = "PA2", "PC7"; // Add DC/RS nad RST pins here
allwinner,function = "gpio_in";
};
};
};
fragment@2 {
target = <&spi0>;
__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>;
// Select pins: 1st number = pos. of letter in the alphabet - 1
// 2nd number = pin number
// 3rd number = DON'T CHANGE! (1 = ACTIVE_LOW, 0 = ACTIVE_HIGH)
// Example: PA2 = <&pio 0 2 1>
// PC7 = <&pio 2 7 0>
reset-gpios = <&pio 0 2 1>; // RST pin
dc-gpios = <&pio 2 7 0>; // DC/RS pin
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>;
};
};
};
};
References
Display module pinout – “Official” product wiki – http://www.lcdwiki.com/MHS-3.5inch_RPi_Display#Hardware_Description
DTS template – Armbian forums – https://forum.armbian.com/topic/11701-35-lcd-ili9486-with-orange-pi-zero/
Misc. information about a similar module – Armbian forums – https://forum.armbian.com/topic/4656-orangepi-zero-mainline-kernel-spi-lcd-touchscreen/