Last active
December 29, 2022 21:48
-
-
Save dolinenkov/95d81c6ac9bc27ba729783acdd48accf to your computer and use it in GitHub Desktop.
TFT35a (ILI9486/XPT2046) device tree overlay for Orange Pi Zero
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Device Tree overlay for Waveshare 3.5inch TFT LCD and Orange Pi Zero | |
* This dts is a compilation of two different dts files: | |
* 1. olehs' dts for ili9486/xpt2046 and Orange Pi PC: | |
* https://gist.github.com/olehs/1cd3e5ddf45066380df68a70d6f8462a | |
* 2. Viroid's dts set for ili9341/xpt2046 and Orange Pi Zero: | |
https://4pda.to/forum/index.php?s=&showtopic=782242&view=findpost&p=112401076 | |
* The dts was tested at Orange Pi Zero LTS | |
* uname -a: | |
* `Linux opi-fbg5 5.15.48-sunxi #22.05.3 SMP Wed Jun 22 07:35:10 UTC 2022 armv7l GNU/Linux` | |
* Note: `spi-add-cs1` and `spi-spidev` overlays must be loaded! | |
* Other important armbianEnv.txt parameters: | |
* ``` | |
* param_spidev_spi_bus=1 | |
* param_spidev_spi_cs=0 | |
* param_spidev_max_freq=10000000 | |
* extras="fbcon=map:0" | |
* ``` | |
*/ | |
/dts-v1/; | |
/plugin/; | |
/ { | |
compatible = "allwinner,sun8i-h3"; | |
fragment@0 { | |
target = <&spi1>; | |
__overlay__ { | |
status = "okay"; | |
pinctrl-names = "default", "default"; | |
pinctrl-1 = <&spi1_cs1>; | |
/* PA10 GPIO_ACTIVE_HIGH (last 0) */ | |
cs-gpios = <0>, <&pio 0 10 0>; | |
}; | |
}; | |
fragment@1 { | |
target = <&pio>; | |
__overlay__ { | |
spi1_cs1: spi1_cs1 { | |
pins = "PA10"; | |
function = "gpio_out"; | |
output-high; | |
}; | |
ili9486_pins: ili9486_pins { | |
pins = "PA18", "PA2"; | |
function = "gpio_out", "gpio_out"; | |
}; | |
ads7846_pins: ads7846_pins { | |
pins= "PA1"; | |
function = "irq"; | |
}; | |
}; | |
}; | |
fragment@2 { | |
target = <&spi1>; | |
__overlay__ { | |
#address-cells = <1>; | |
#size-cells = <0>; | |
status = "okay"; | |
cs-gpios = <&pio 0 13 1>, <&pio 0 10 0>; /* PA13, PA10 */ | |
ili9486: ili9486@0 { | |
compatible = "ilitek,ili9486"; | |
reg = <0>; | |
status = "okay"; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&ili9486_pins>; | |
spi-max-frequency = <16000000>; | |
txbuflen = <32768>; | |
rotate = <0>; | |
bgr = <0>; | |
fps = <30>; | |
buswidth = <8>; | |
regwidth = <16>; | |
reset-gpios = <&pio 0 2 0>; /* PA2 */ | |
dc-gpios = <&pio 0 18 0>; /* PA18 */ | |
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 | |
/* piscreen -> waveshare35a */ | |
0x1000036 0x28 | |
0x1000011 | |
0x1000029>; | |
}; | |
ads7846: ads7846@1 { | |
compatible = "ti,ads7846"; | |
reg = <1>; /* Chip Select 1 */ | |
status = "okay"; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&ads7846_pins>; | |
spi-max-frequency = <2000000>; | |
interrupts = <0 1 2>; /* PA1 IRQ_TYPE_EDGE_FALLING */ | |
interrupt-parent = <&pio>; | |
pendown-gpio = <&pio 0 1 0>; /* PA1 */ | |
ti,x-min = /bits/ 16 <337>; | |
ti,y-min = /bits/ 16 <529>; | |
ti,x-max = /bits/ 16 <3729>; | |
ti,y-max = /bits/ 16 <3711>; | |
ti,pressure-min = /bits/ 16 <10>; | |
ti,pressure-max = /bits/ 16 <1000>; | |
ti,x-plate-ohms = /bits/ 16 <400>; | |
ti,swap-xy = <1>; | |
ti,invert = <1>; | |
}; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
What would I have to change to make it work on Orangepi One?
I have tried it and it does not work...
Regards