Jump to content

Recommended Posts

Posted

Hi, I finally have time to get back to my little project.

I've been trying to get a working display with tinydrm for an ILI9341 base lcd.

My setup works on OpenWrt with the older fbtft driver, but now I'd like to
go back and try Armbian (current release is Jammy) on it.

My first try with devicetree overlay seems functional but not correct.

The display just show garbled data (see attached). What could be the problem with it?

 

This is my env.

verbosity=1
bootlogo=false
console=both
overlay_prefix=sun50i-h5
overlays=usbhost1 usbhost2 spi-spidev
param_spidev_spi_bus=0
rootdev=UUID=e0ed80c4-a252-4d96-ad61-78b7834d6b8d
rootfstype=ext4
user_overlays=spilcd
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

and this is my overlay
 

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
    
    fragment@0 {
        target = <&spi0>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            
            display: display@0 {
                compatible = "adafruit,yx240qv29", "ilitek,ili9341";
                reg = <0>;
                rotation = <270>;
                reset-gpios = <&pio 0 6 0>; /* GPIOA 6 */
                dc-gpios = <&pio 0 3 0>; /* GPIOA 3 */            
            };
        };
    };
};

 

ili9341.jpg

Posted

Got it to work 🙂

I'm not exactly sure what fixed it but I'll probably figure it out once it breaks again.

this is my new overlay so others may find it useful.

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

  fragmen@0 {
    target = <&pio>;
    __overlay__ {
        display_pins: display_pins {
        pins = "PA3", "PA6";
        function = "gpio_out";
      };
    };
   };

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

        display: display@0 {
          compatible = "adafruit,yx240qv29", "ilitek,ili9341";
          reg = <0>;
          pinctrl-names = "default";
          pinctrl-0 = <&display_pins>;
          spi-max-frequency = <16000000>;
          rotation= <270>;
          bgr;
          fps = <10>;
          buswidth = <8>;
          height = <240>;
          width = <320>;
          reset-gpios = <&pio 0 6 0>; /* GPIOA 6 */
          dc-gpios = <&pio 0 3 0>; /* GPIOA 3 */
          debug = <3>;
        };
      };
    };

  __overrides__ {
    rotation = <&display>, "rotation:0";
    fps = <&display>, "fps:0";
    debug = <&display>, "debug:0";
  };
};

 

console.jpg

Posted (edited)

Hi Mhel,

Thank you for your post is very interesting...
But can you add some info for who ha no experience with overlay?
I was able to use a spi display with a legacy kernel and now i'm trying to use with a new kernel on orange pi PC2

i suppose that the pins to use are:

19    SPI_MOSI

21    SPI_MISO

23    SPI_CLK

15    LCD_D/C (GPIO A3 )

7   LCD_RESET (GPIOA6)

+3.3    LED_EN

Is it correct?

I suppose that for edit env i have to do: sudo nano /boot/armbianEnv.txt
 

but what i have to do to add the overlay that you did?

p.s. many of the examples that i found are only for H3 your is valid also for H5... do you think is possible to use also with a nanopi neo 3 that has this Soc: RockChip RK3328, Quad-core 64-bit high-performance Cortex A53?

i suppose that i have to add the correct prefix to this line: compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

Is it correct?

Edited by Lamerjack
Posted

I added to armbianENV.txt
//after overlay_prefix=sun50i-h5
overlays=spi-spidev
param_spidev_spi_bus=0

//at the second last line
user_overlays=spilcd

 

nano spilcd.dts
and i copy inside content of your dts file

then i have to compile it:
dtc -I dts -O dtb -o spilcd.dtbo spilcd.dts
mkdir/boot/overlay-user
cp spilcd.dtbo /boot/overlay-user/ 

 

pin used

19    SPI_MOSI
21    SPI_MISO (Not ncessary)
23    SPI_CLK
15    LCD_D/C (GPIO A3 )
7     LCD_RESET (GPIOA6)
GND   CS
+3.3  LED_EN

 

but:

root@orangepipc2:~# dmesg |grep spi
[    2.045242] sun6i-spi 1c68000.spi: chipselect 0 already in use
[    2.045255] spi_master spi0: spi_device register error /soc/spi@1c68000/spidev@0
[    2.045285] spi_master spi0: Failed to create SPI device for /soc/spi@1c68000/spidev@0
[    2.045319] sun6i-spi 1c68000.spi: chipselect 0 already in use
[    2.045329] spi_master spi0: spi_device register error /soc/spi@1c68000/spi-flash@0
[    2.045350] spi_master spi0: Failed to create SPI device for /soc/spi@1c68000/spi-flash@0
[    2.699582] panel-ilitek-ili9341 spi0.0: get optional vcc failed
[    2.701226] [drm] Initialized ili9341 1.0.0 20210716 for spi0.0 on minor 2
[    3.252030] panel-ilitek-ili9341 spi0.0: [drm] Initialized display serial interface
[    3.351215] panel-ilitek-ili9341 spi0.0: [drm] fb0: ili9341drmfb frame buffer device


root@orangepipc2:~# lsmod | grep ili9341
ili9341                16384  0
panel_ilitek_ili9341    20480  2
drm_mipi_dbi           28672  2 ili9341,panel_ilitek_ili9341

 

Posted
Am 7.6.2023 um 21:59 schrieb Lamerjack:

overlays=spi-spidev
param_spidev_spi_bus=0

Don't do that it can cause you troubles with your spi, I also just learned that recently from Ryzer in the following post. Then why is your Chip Select (CS) connected to ground? Connect it to the Spi_Cs0 PC3 Pin 24. and then change Fragment@1 in the overlay to following:

fragment@1 {
	target = <&spi0>;
	__overlay__ {
	/* needed to avoid dtc warning */
	#address-cells = <1>;
	#size-cells = <0>;
	status="okay";
	cs-gpios = <&pio 2 3 0>;
	num-chipselects = <1>;

This should work with the OrangePi for the nano pi you need to check and change the pins. For example the spi_cs pin on the neo3 ist the B0 and on the orange pi it is the C3 so for the neo3 the line in the overlay should be:

cs-gpios = <&pio 1 0 0>;

The Pios for dc and reset need to be changed in a similar way as well since the neo3 doesn't have an A3 pin so maybe take A4 and A6. Maybe also the targeted spi needs to be changed since some boards don't use spi0 on the 40 header pins.

 

Last but not least good luck with your display :) 

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