Jump to content

Problem connection rk3399 to 3.5TFT ili9341


grecha

Recommended Posts

Hello!

 

I would like to connect orangepi-4-lts to ili9341. I have new blank Armbian.

$ uname -a
Linux orangepi4-lts 5.15.52-rockchip64 #22.05.4 SMP PREEMPT

 

I did overlay based on allwinner:

/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3399";
	fragment@0 {
		target = <&gpio1>;
		__overlay__ {
			ili9341_pins: ili9341_pins {
				pins = "PC7", "PD0";
				function = "gpio_out", "gpio_out";
			};
		};
	};

	fragment@1 {
		target = <&spi1>;
		__overlay__ {
			status = "okay";
			cs-gpios = <&gpio1 10 1>;

			ili9341: ili9341@0 {
				compatible = "ilitek, ili9341";
				reg = <1>;
				pinctrl-names = "default";
				pinctrl-0 = <&ili9341_pins>;
				spi-max-frequency = <16000000>;
				rotate = <90>;
				bgr;
				fps = <25>;
				buswidth = <8>;
				reset-gpios = <&gpio1 23 1>;
				dc-gpios = <&gpio1 24 0>;
				debug = <0>;
			};
		};
	};
};

 

Setting /boot/armbianEnv.txt

verbosity=1
bootlogo=true
extraargs=systemd.unified_cgroup_hierarchy=0
overlay_prefix=rockchip
fdtfile=rockchip/rk3399-orangepi-4-lts.dtb
rootdev=UUID=ce86a0ca-f0e5-4dba-af37-15cc3fb2f4e0
rootfstype=ext4
param_spidev_spi_bus=1
param_spidev_spi_cs=0
user_overlays=ili9341
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

Restart, TFT not turn on.

 

I watch debugiing uart, no errors:

## Executing script at 00500000                                                 
Boot script loaded from mmc 1                                                   
320 bytes read in 4 ms (78.1 KiB/s)                                             
16356833 bytes read in 696 ms (22.4 MiB/s)                                      
30540288 bytes read in 1295 ms (22.5 MiB/s)                                     
81458 bytes read in 14 ms (5.5 MiB/s)                                           
1233 bytes read in 7 ms (171.9 KiB/s)                                           
Applying user provided DT overlay ili9341.dtbo                                  
2698 bytes read in 9 ms (292 KiB/s)                                             
Applying kernel provided DT fixup script (rockchip-fixup.scr)                   
## Executing script at 09000000                                                 
Moving Image from 0x2080000 to 0x2200000, end=3fc0000                           
## Loading init Ramdisk from Legacy Image at 06000000 ...                       
   Image Name:   uInitrd                                                        
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)                  
   Data Size:    16356769 Bytes = 15.6 MiB                                      
   Load Address: 00000000                                                       
   Entry Point:  00000000                                                       
   Verifying Checksum ... OK                                                    
## Flattened Device Tree blob at 01f00000                                       
   Booting using the fdt blob at 0x1f00000                                      
   Loading Ramdisk to f4f65000, end f5efe5a1 ... OK                             
   Loading Device Tree to 00000000f4ee8000, end 00000000f4f64fff ... OK         
                                                                                
Starting kernel ...                                 

 

Watching system boot log:

grecha@orangepi4-lts:~$ sudo dmesg | grep spi
[    2.053302] rockchip-spi ff1d0000.spi: cs1 >= max 1
[    2.053318] spi_master spi1: spi_device register error /spi@ff1d0000/ili9341@0
[    2.053345] spi_master spi1: Failed to create SPI device for /spi@ff1d0000/ili9341@0
grecha@orangepi4-lts:~$ sudo dmesg | grep ili9341
[    2.053318] spi_master spi1: spi_device register error /spi@ff1d0000/ili9341@0
[    2.053345] spi_master spi1: Failed to create SPI device for /spi@ff1d0000/ili9341@0

 

Please, help me. Why is this overlay not working? 

Link to comment
Share on other sites

If i set overlay, line 23

reg = <0>;

 

then i get 

[    2.030154] rockchip-spi ff1d0000.spi: chipselect 0 already in use

 

i understand fdtfile=rockchip/rk3399-orangepi-4-lts.dtb  has device spidev reg = <0>;

 

File /boot/dtb/rockchip/overlay/README.rockchip-overlays says "Using chip select 1 requires using "spi-add-cs1" overlay", but i nave not overlay spi-add-cs1.

 

There is an idea to edit rk3399-orangepi-4-lts.dtb - remove device spidev and set reg = <0>; for ili9341, but that is a bad idea, and I'm not sure what will work

I would like to make everything just an overlay.

Link to comment
Share on other sites

Hi!

 

I made a new one dtb, it seems to work. I not building new device and used  spidev from main dtb. It looking great:

 

grecha@orangepi4-lts:~$ sudo dmesg | grep 9341
[    6.883847] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
[    6.967905] SPI driver fb_ili9341 has no spi_device_id for ilitek,ili9341
[    6.969815] fb_ili9341 spi1.0: fbtft_property_value: buswidth = 8
[    6.969841] fb_ili9341 spi1.0: fbtft_property_value: debug = 0
[    6.969849] fb_ili9341 spi1.0: fbtft_property_value: rotate = 90
[    6.969860] fb_ili9341 spi1.0: fbtft_property_value: fps = 25
[    7.301423] graphics fb1: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 16 KiB buffer memory, fps=25, spi1.0 at 18 MHz

 

a new device appears:

 

2022-08-27_00-43.thumb.png.8d77e9be49b51fabd3aa5737ea4a66f6.png

 

but I get a white screen, I`m at a loss.

 

 

dts:

/dts-v1/;
/plugin/;

/ {
        compatible = "rockchip,rk3399";

	fragment@0 {
		target = <&pinctrl>;

		__overlay__ {
			spidev {
				ili9341_pins: ili9341_pins {
					rockchip,pins = 
					<1 23 1 &pcfg_pull_none>,
					<1 24 1 &pcfg_pull_none>;
				};
			};
		};
	};

        fragment@1 {
                target = <&spi1>;

                __overlay__ {
			status = "okay";
			cs-gpios = <&gpio1 10 1>;
                        #address-cells = <1>;
                        #size-cells = <0>;
	
			spidev {
				compatible = "ilitek,ili9341";
				status = "okay";
				pinctrl-names = "default";
				pinctrl-0 = <&ili9341_pins>;
				spi-max-frequency = <160000000>;
				rotate = <90>;
				bgr;
				fps = <25>;
				buswidth = <8>;
				reset-gpios = <&gpio1 23 0>;
				dc-gpios = <&gpio1 24 0>;
				debug = <0>;
			};
                };
        };
};

 

Help me please

 

Link to comment
Share on other sites

I did it. thank you all for your help)

/dts-v1/;
/plugin/;

/ {
        compatible = "rockchip,rk3399";

        fragment@0 {
                target = <&spi1>;

                __overlay__ {
                        status = "okay";
                        #address-cells = <1>;
                        #size-cells = <0>;

                        spidev {
                                compatible = "ilitek,ili9341";
                                status = "okay";
                                spi-max-frequency = <4000000000>;
                                rotate = <90>;
                                bgr;
                                fps = <25>;
                                buswidth = <8>;
                                reset-gpios = <&gpio1 23 1>;
                                dc-gpios = <&gpio1 24 0>;
                                led-gpios = <&gpio1 3 0>;
                                debug = <0>;
                        };
                };
        };
};

 

Link to comment
Share on other sites

 

Dear author, could you describe in more detail the process of connecting and setting up this display to orangepi-4-lts? There is very little information on the Internet on this topic, in particular for this board Thank you in advance

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