Jump to content

3.5" screen ili9486/xpt2046 with kernel 5.9.14-sunxi


Aliagord

Recommended Posts

Armbianmonitor:

Hello,

 

It's my first message, I'm very proud to be part of your community, Armbian is epic !

I'm trying to add a chinese screen copy to my orangepizero (H2+ cpu). This is my screen:

https://www.aliexpress.com/item/32587995145.html  (copie of https://www.waveshare.com/3.5inch-rpi-lcd-a.htm)

 

1)

Yesterday i setup my screen on Armbian_5.91_Orangepizero_Debian_buster_next_4.19.59 with success with:

nano /boot/armbianEnv.txt :

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

nano /etc/modules-load.d/fbtft.conf :

fbtft
fbtft_device

nano /etc/modprobe.d/fbtft.conf :

options fbtft_device rotate=90 name=piscreen speed=32000000 busnum=1 gpios=reset:2,dc:18 txbuflen=32768 fps=25

It created a framebuffer (fb0) which worked without problem.

 

 

2)

I also tried with Armbian_20.05.3_Orangepizero_buster_current_5.4.45 with success with:

 

nano /boot/armbianEnv.txt :

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

 

Create DTS file:

Spoiler




/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>;
			};

		};
	};

};

 

And added to armbian with:

armbian-add-overlay foo.dts

 

After reboot, the screen worked too !

 

3) But with the 5.9.14 kernel, it doesn't work ! (Armbian_20.11.3_Orangepizero_buster_current_5.9.14.img)

I tried with DTS file + spi overlay in armbianEnv.txt, but nothing...

This is my "dmesg | grep spi" :

[    3.223574] spidev@1 enforce active low on chipselect handle
[    3.224724] spi_master spi1: cannot find modalias for /soc/spi@1c69000/spidev@1
[    3.224759] spi_master spi1: Failed to create SPI device for /soc/spi@1c69000/spidev@1
[   10.585918] [drm] Initialized ili9486 1.0.0 20200118 for spi1.0 on minor 0
[   12.495270] ili9486 spi1.0: [drm] fb0: ili9486drmfb frame buffer device

This is my "ls /dev"

Spoiler




autofs
block
btrfs-control
bus
char
console
cpu_dma_laten                                                                                                                                                                                                                                                                                                                cy
cuse
disk
dri
ecryptfs
fb0
fd
full
fuse
gpiochip0
gpiochip1
initctl
kmem
kmsg
log
loop0
loop1
loop2
loop3
loop4
loop5
loop6
loop7
loop-control
mapper
media0
mem
mmcblk0
mmcblk0p1
mqueue
net
null
ppp
ptmx
pts
ram0
ram1
ram2
ram3
random
rfkill
rtc
rtc0
shm
snd
stderr
stdin
stdout
tty
tty0
tty1
tty10
tty11
tty12
tty13
tty14
tty15
tty16
tty17
tty18
tty19
tty2
tty20
tty21
tty22
tty23
tty24
tty25
tty26
tty27
tty28
tty29
tty3
tty30
tty31
tty32
tty33
tty34
tty35
tty36
tty37
tty38
tty39
tty4
tty40
tty41
tty42
tty43
tty44
tty45
tty46
tty47
tty48
tty49
tty5
tty50
tty51
tty52
tty53
tty54
tty55
tty56
tty57
tty58
tty59
tty6
tty60
tty61
tty62
tty63
tty7
tty8
tty9
ttyGS0
ttyS0
ttyS1
ttyS2
ttyS3
ttyS4
ttyS5
ttyS6
ttyS7
ubi_ctrl
uhid
uinput
uleds
urandom
v4l
vcs
vcs1
vcs2
vcs3
vcs4
vcs5
vcs6
vcsa
vcsa1
vcsa2
vcsa3
vcsa4
vcsa5
vcsa6
vcsu
vcsu1
vcsu2
vcsu3
vcsu4
vcsu5
vcsu6
video0
watchdog
watchdog0
zero
zram0
zram1
zram2

 

 

As we can see i have "fb0" but no "spi1.1"...

 

 

I already checked everything on the web and each topic in this forum, like that:

 

 

I hope you can help me ! Thanks you a lot !

 

And sorry for my poor english, maybe I made some spelling mistakes !

Edited by Aliagord
Link to comment
Share on other sites

15 hours ago, Aliagord said:

I already checked everything on the web and each topic in this forum

 

How about documentation?  I know there is some info in there about connecting various screens.  I never tried and I don't know if it's directly applicable, but maybe something in there will helpful?

Link to comment
Share on other sites

Hi,
Thanks for your answer !

I found documentation, i tried to apply it.

This page for exemple :
https://linux-sunxi.org/SPIdev
In my /boot/config i added this :

CONFIG_EXPERIMENTAL=y


And i changed this :

CONFIG_SPI_SPIDEV=m


to this :

CONFIG_SPI_SPIDEV=y

Or this page :
https://docs.armbian.com/User-Guide_Allwinner_overlays/

I found this command to add overlay :

sudo armbian-add-overlay <overlay_file.dts>


And this :

armbianEnv.txt entries reference
overlay_prefix - prefix for the DT and overlay file names, set at OS image creation time
overlays - list of overlays to activate from kernel directory
user_overlays - list of overlays to activate from /boot/overlay-user/ directory
param_* - overlay parameters

They said "Allwinner H3 contains 2 SPI" so, the 0 and the 1. But i think the 0 is always used, so i choose 

param_spidev_spi_bus=1

 

Link to comment
Share on other sites

Hi,

 

I modify my DTS to:

Spoiler



/dts-v1/;
/plugin/;

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

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

	fragment@1 {
		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>;
			};

		};
	};

};

 

And now i have this in the log:

root@orangepizero:~# dmesg | grep spi
[    3.216559] spidev@0 enforce active low on chipselect handle
[    4.780881] spidev spi1.1: probing from DT
[   10.577651] [drm] Initialized ili9486 1.0.0 20200118 for spi1.0 on minor 0
[   12.461700] ili9486 spi1.0: [drm] fb0: ili9486drmfb frame buffer device

 

I think the problem is the spi1.0 and spi1.1:

xh5f.png

 

1st number : bus

2nd number : cs

 

I tried to use  param_spidev_spi_cs=0, but spi1.0 doesn't appear in /dev...

it said:

[    3.221863] sun6i-spi 1c69000.spi: chipselect 0 already in use

 

So, my objective is to put the chip to 1 in the DTS, but i don't know how

Edited by Aliagord
Link to comment
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...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines