Jump to content

Orange PI PC HDMI LCD MPI3508 Touchscreen SPI move CS from pin 24 to pin 22


Peter Gregory

Recommended Posts

I'm trying to get a HDMI LCD touchscreen working.  The pinout is compatible with Orange PI PC except the SPI CS pin is on pin 26 (WPI 11) instead of pin 24 (WPI 10).
Is there an easy way to move the SPI CS pin to another GPIO pin?  Also, I'm not sure how to properly configure the pen down interrupt pin for pin 22 (WPI 6)
So far, I've got the following working:


Image:
Orangepipc_2.0.8_debian_buster_desktop_linux5.4.65.7z


Touchscreen:
3.5 Inch HD HDMI USB LCD Touch Screen 3.5" Display Module 480×320 1920x1080 for Raspberry Pi 3rd 4th Generation 4B/3B+/3B/2B

 

orangepiEnv.txt:
overlays=spi-add-cs1 spi-spidev
param_spidev_spi_bus=0
param_spidev_spi_cs=0

 

Luckily, the kernel headers are loaded, so Makefile works.

 

mkdir ds7846 
cd ds7846 
wget https://sourceforge.net/p/openipmi/linux-ipmi/ci/master/tree/drivers/input/touchscreen/ads7846.c?format=raw
mv ads7846.c?format=raw ads7846.c 
nano Makefile:

 

obj-m := ads7846.o 
KDIR := /lib/modules/$(shell uname -r)/build 
PWD := $(shell pwd) 
all:
    $(MAKE) -C $(KDIR) M=$(PWD) modules 
clean:
    $(MAKE) -C $(KDIR) M=$(PWD) clean 
install:
    $(MAKE) -C $(KDIR) M=$(PWD) modules_install


make
make install
depmod

cd .. 


git clone https://github.com/notro/fbtft_tools/
cd fbtft_tools/ads7846_device 
make 
make install 
depmod 

cd ..

 

sudo nano /etc/modules-load.d/99-ads7846.conf

ads7846
ads7846_device

 

sudo nano /etc/modprobe.d/ads7846_device.conf

options ads7846_device model=7846 verbose=2 cs=0 gpio_pendown=1 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900

 

after reboot, the SPI device is there and the touch driver attaches to the port.

 

[    7.124454] ads7846_device: loading out-of-tree module taints kernel.
[    7.125336]
               
               ads7846_device: ads7846_device_init()
[    7.125343] ads7846_device: SPI devices registered:
[    7.125354] ads7846_device:    spidev spi0.0 1000kHz 8 bits mode=0x00
[    7.125357] ads7846_device:
[    7.125366] ads7846_device: Settings:
[    7.125369] ads7846_device:   model = 7846
[    7.125372] ads7846_device:   gpio_pendown = 1
[    7.125375] ads7846_device:   swap_xy = 1
[    7.125378] ads7846_device:   x_min = 200
[    7.125380] ads7846_device:   x_max = 3900
[    7.125383] ads7846_device:   y_min = 200
[    7.125386] ads7846_device:   y_max = 3900
[    7.125388] ads7846_device:   x_plate_ohms = 60
[    7.125391] ads7846_device:   pressure_min = 0
[    7.125393] ads7846_device:   pressure_max = 255
[    7.125396] ads7846_device:   keep_vref_on = 1
[    7.125398] ads7846_device:   vref_delay_usecs = 0
[    7.125401] ads7846_device:   vref_mv = 0
[    7.125403] ads7846_device:   settle_delay_usecs = 0
[    7.125406] ads7846_device:   penirq_recheck_delay_usecs = 0
[    7.125409] ads7846_device:   y_plate_ohms = 0
[    7.125411] ads7846_device:   debounce_max = 0
[    7.125414] ads7846_device:   debounce_tol = 0
[    7.125416] ads7846_device:   debounce_rep = 0
[    7.125425] ads7846_device: Deleting spi0.0
[    7.126442] ads7846 spi0.0: spi0.0 supply vcc not found, using dummy regulator
[    7.144047] ads7846 spi0.0: touchscreen, irq 65
[    7.144980] input: ADS7846 Touchscreen as /devices/platform/soc/1c68000.spi/spi_master/spi0/spi0.0/input/input1
[    7.145055] ads7846_device: SPI devices registered:
[    7.145063] ads7846_device:    ads7846 spi0.0 2000kHz 8 bits mode=0x00
[    7.145066] ads7846_device:

 

Of course, no touch events are detected.  Anyone else have any luck getting this to work?

I'm not familiar with changing the device tee to move GPIO pins, is there a configuration option for the spi_add_cs1?
 

Link to comment
Share on other sites

I've made a some progress on getting the touch part of the LCD working.  The default SPI0.0 CS is pin 24 but the second SPI0.1 CS is pin 26, the pin I need.  So, I just needed to enable 2 SPI devices.

 

Enable 2nd spi device Orange PI PC

First, create the overlay to enable 2 CS pins for one SPI device

nano spi-double-spidev-cs.dts
/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>;
            status = "okay";

            spidev@0 {
                reg = <0>; /* Chip Select 0 */
                compatible = "spidev";
                spi-max-frequency = <1000000>;
                status = "okay";
            };

            spidev@1 {
                reg = <1>; /* Chip Select 1 */
                compatible = "spidev";
                spi-max-frequency = <1000000>;
                status = "okay";
            };
        };
    };
};

 

Compile the overlay
dtc -I dts -O dtb -o spi-double-spidev-cs.dtbo spi-double-spidev-cs.dts

 

Copy the overlay to the user overlays location
sudo cp spi-double-spidev-cs.dtbo /boot/overlay-user/spi-double-spidev-cs.dtbo

 

Configure the user overlay and SPI devices

sudo nano /boot/orangepiEnv.txt

overlays=spi-spidev spi-add-cs1
user_overlays=spi-double-spidev-cs
param_spidev_spi_bus=0
param_spidev_spi_cs=0

 

reboot and you will have 2 SPI devices

 

Now, update the touch controller to use SPI0.1

sudo nano /etc/modprobe.d/ads7846_device.conf

options ads7846_device model=7846 verbose=2 cs=1 gpio_pendown=2 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=$

 

However, I'm seeing an error starting the driver:

 

[    6.866374] ads7846_device: loading out-of-tree module taints kernel.

[    6.867290]

               

               ads7846_device: ads7846_device_init()

[    6.867296] ads7846_device: SPI devices registered:

[    6.867314] ads7846_device:    spidev spi0.1 1000kHz 8 bits mode=0x00

[    6.867324] ads7846_device:    spidev spi0.0 1000kHz 8 bits mode=0x00

[    6.867328] ads7846_device:

[    6.867340] ads7846_device: Settings:

[    6.867347] ads7846_device:   model = 7846

[    6.867354] ads7846_device:   gpio_pendown = 6

[    6.867359] ads7846_device:   swap_xy = 1

[    6.867362] ads7846_device:   x_min = 200

[    6.867365] ads7846_device:   x_max = 3900

[    6.867368] ads7846_device:   y_min = 200

[    6.867371] ads7846_device:   y_max = 3900

[    6.867374] ads7846_device:   x_plate_ohms = 60

[    6.867376] ads7846_device:   pressure_min = 0

[    6.867379] ads7846_device:   pressure_max = 255

[    6.867382] ads7846_device:   keep_vref_on = 1

[    6.867384] ads7846_device:   vref_delay_usecs = 0

[    6.867386] ads7846_device:   vref_mv = 0

[    6.867389] ads7846_device:   settle_delay_usecs = 0

[    6.867391] ads7846_device:   penirq_recheck_delay_usecs = 0

[    6.867394] ads7846_device:   y_plate_ohms = 0

[    6.867396] ads7846_device:   debounce_max = 0

[    6.867399] ads7846_device:   debounce_tol = 0

[    6.867401] ads7846_device:   debounce_rep = 0

[    6.867414] ads7846_device: Deleting spi0.1

[    6.867993] spi spi0.1: spi_setup / gpio_is_valid(21) ... doing gpio_request ...

[    6.868013] spi spi0.1: failed to request gpio

[    6.868291] ads7846 spi0.1: spi_setup / gpio_is_valid(21) ... doing gpio_request ...

[    6.868303] ads7846 spi0.1: failed to request gpio

[    6.868394] ads7846 spi0.1: spi0.1 supply vcc not found, using dummy regulator

[    6.871787] ads7846 spi0.1: touchscreen, irq 70

[    6.873235] input: ADS7846 Touchscreen as /devices/platform/soc/1c68000.spi/spi_master/spi0/spi0.1/input/input1

[    6.873332] ads7846_device: SPI devices registered:

[    6.873343] ads7846_device:    spidev spi0.0 1000kHz 8 bits mode=0x00

[    6.873349] ads7846_device:    ads7846 spi0.1 2000kHz 8 bits mode=0x00

[    6.873352] ads7846_device:

 

Anyone else see this before?  It still works the SPI port (I see activity on the SPI pins and the correct pin for SPI0.1 goes active low for CS, pin 26.

I think the issue now is the interrupt for pin down on pin 22 (BCM 2), I'm not sure how to configure that.

Anyone else gotten that to work?

Link to comment
Share on other sites

14 часов назад, Peter Gregory сказал:

fragment@0 {
        target = <&spi0>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";

            spidev@0 {
                reg = <0>; /* Chip Select 0 */
                compatible = "spidev";
                spi-max-frequency = <1000000>;
                status = "okay";
            };

            spidev@1 {
                reg = <1>; /* Chip Select 1 */
                compatible = "spidev";
                spi-max-frequency = <1000000>;
                status = "okay";
            };
        };

For node spidev@0 spidev@1, it is necessary to explicitly register cs pins

 

And it seems it will be superfluous

14 часов назад, Peter Gregory сказал:

param_spidev_spi_bus=0
param_spidev_spi_cs=0

 

Link to comment
Share on other sites

I'm trying to include pin definitions for SPI but I don't see a good example of how this is done.

I tried this approach based on another DTS, but it does not work.

Any advice on how to clean up this DTS and make it work would be appreciated.

If I omit the pin mappings, the overlay works and the SPI devices exist (SPI0.0 & SPI0.1) and appear to work on my scope.

 

/dts-v1/;
/plugin/;

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

        fragment@0 {
                target = < 0xffffffff >;

                __overlay__ {

                        spi0_cs1 {
                                pins = "PC3";
                                function = "gpio_out";
                                output-high;
                                phandle = < 0x01 >;
                        };

                        spi1_cs1 {
                                pins = "PA21";
                                function = "gpio_out";
                                output-high;
                                phandle = < 0x02 >;
                        };
                };
        };

        fragment@1 {
                target = < 0xffffffff >;

                __overlay__ {
                        pinctrl-names = "default\0default";
                        pinctrl-1 = < 0x01 >;
                        cs-gpios = < 0x00 0xffffffff 0x02 0x03 0x00 >;
                };
        };

        fragment@2 {
                target = < 0xffffffff >;

                __overlay__ {
                        pinctrl-names = "default\0default";
                        pinctrl-1 = < 0x02 >;
                        cs-gpios = < 0x00 0xffffffff 0x00 0x15 0x00 >;
                };
        };

        fragment@3 {
                target = <&spi0>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";

                        spidev@0 {
                                reg = < 0x00 >; /* Chip Select 0 */
                                compatible = "spidev";
                                spi-max-frequency = <1000000>;
                                status = "okay";
                        };

                        spidev@1 {
                                reg = < 0x01 >; /* Chip Select 1 */
                                compatible = "spidev";
                                spi-max-frequency = <1000000>;
                                status = "okay";
                        };
                };
        };
};
 

Edited by Peter Gregory
Fixed error
Link to comment
Share on other sites

01.09.2023 в 04:18, Peter Gregory сказал:

Image:
Orangepipc_2.0.8_debian_buster_desktop_linux5.4.65.7z

I have no idea what the syntax in dts is in this image

Please extract it from the file system

dtc --sort -I fs -O dts  /sys/firmware/devicetree/base > cur-dts-out.txt

or from the existing dtb used and publish only two nodes pio and spi

Link to comment
Share on other sites

The command dtc --sort -I fs -O dts /sys/firmware/devicetree/base > cur-dts-out.txt

throws warnings and an exception and does not output any data in the text file:

 

orangepi@orangepipc:~$ sudo dtc --sort -I fs -O dts  /sys/firmware/devicetree/base > cur-dts-out.txt

<stdout>: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name

....

<stdout>: Warning (graph_child_address): /soc/camera@1cb0000/port: graph node has single child node 'endpoint', #address-cells/#size-cells are not necessary

Segmentation fault

 

The DTB used in this image is /boot/dtb/sun8i-h3-orangepi-pc.dtb

The sections you referenced are 

 

pinctrl@1c20800 {

spi0-pins {

pins = "PC0\0PC1\0PC2\0PC3";

function = "spi0";

phandle = < 0x16 >;

};

 

spi1-pins {

pins = "PA15\0PA16\0PA14\0PA13";

function = "spi1";

phandle = < 0x17 >;

};

}

 

spi@1c68000 {

compatible = "allwinner,sun8i-h3-spi";

reg = < 0x1c68000 0x1000 >;

interrupts = < 0x00 0x41 0x04 >;

clocks = < 0x03 0x1e 0x03 0x52 >;

clock-names = "ahb\0mod";

dmas = < 0x15 0x17 0x15 0x17 >;

dma-names = "rx\0tx";

pinctrl-names = "default";

pinctrl-0 = < 0x16 >;

resets = < 0x03 0x0f >;

status = "disabled";

#address-cells = < 0x01 >;

#size-cells = < 0x00 >;

phandle = < 0x5c >;

};

 

spi@1c69000 {

compatible = "allwinner,sun8i-h3-spi";

reg = < 0x1c69000 0x1000 >;

interrupts = < 0x00 0x42 0x04 >;

clocks = < 0x03 0x1f 0x03 0x53 >;

clock-names = "ahb\0mod";

dmas = < 0x15 0x18 0x15 0x18 >;

dma-names = "rx\0tx";

pinctrl-names = "default";

pinctrl-0 = < 0x17 >;

resets = < 0x03 0x10 >;

status = "disabled";

#address-cells = < 0x01 >;

#size-cells = < 0x00 >;

phandle = < 0x5d >;

};

 

__symbols__ {

pio = "/soc/pinctrl@1c20800";

spi0_pins = "/soc/pinctrl@1c20800/spi0-pins";

spi1_pins = "/soc/pinctrl@1c20800/spi1-pins";

spi0 = "/soc/spi@1c68000";

spi1 = "/soc/spi@1c69000";

}

Link to comment
Share on other sites

I only get SPI0.0 when I enable SPI using spi-add-cs1 spi-spidev.  It uses the wrong pin 24 by default for the CS.  The LCD needs pin 26.

I think it configured SPI0.1 properly for the LCD when I enable second CS for SPI0.1 using spi-double-spidev-cs.  

Using a scope I see pin 26 going low before clock/data go out the SPI pins.

However, I'm not sure how to enable TP_IRQ pin interrupt for the touch interface on pin 22.

I think I need to add DTS for the touch interface as well as use the ads7846_device module.

Edited by Peter Gregory
Typo
Link to comment
Share on other sites

I was just talking about not having to create a second spidev in dt by using param_spidev_spi_cs=1. Based on schematics of your board available on orangepi's website, pin 26 is SPI-CS1, So enabling spi0 or spi-dev in armbian config and setting  param_spidev_spi_bus=0 and param_spidev_spi_cs=1 in /boot/armbianEnv.txt file should allow it to use the correct spi device after reboot.

 

Again from schematics, pin 22 is PA2. IIRC PA series starts from 0, so my guess is use 2 as the value for TP_IRQ 

Link to comment
Share on other sites

13 часов назад, Gunjan Gupta сказал:

Wait are you not using Armbian? I will suggest you to ask for help in orangepi forum then as they will be knowing best about their software

I have already hinted at this. But here there is some general problem of writing an overlay file for an already running system.

We can help the user by luring him to Armbian OS if we get the user's @Peter Gregory consent.

 

We find "compatible" in the source code of the driver : compatible = "ti,ads7846"

Check the presence of the driver module in the Armbian kernel for sunxi:

armbian/build> grep -nr TOUCHSCREEN_ADS7846 config/kernel/linux-sunxi*
config/kernel/linux-sunxi64-current.config:2965:CONFIG_TOUCHSCREEN_ADS7846=m
config/kernel/linux-sunxi64-edge.config:2978:CONFIG_TOUCHSCREEN_ADS7846=m
config/kernel/linux-sunxi64-legacy.config:2902:CONFIG_TOUCHSCREEN_ADS7846=m
config/kernel/linux-sunxi-current.config:2865:CONFIG_TOUCHSCREEN_ADS7846=m
config/kernel/linux-sunxi-edge.config:2966:CONFIG_TOUCHSCREEN_ADS7846=m
config/kernel/linux-sunxi-legacy.config:2890:CONFIG_TOUCHSCREEN_ADS7846=m

 

I wanted to write something as a template, but I found it on this forum.

Look at the example:

examples/spi-ads7846.dts

sun8i-h3-spi-ads7846.dts

 

Please write questions and errors here.
Let's try to figure this out for a modern kernel (>=6.1)

Link to comment
Share on other sites

04.09.2023 в 00:05, Peter Gregory сказал:

I've made a some progress on getting the touch part of the LCD working.

It will be very good if you publish the solution here or print a link to the source.

 

To be honest, I think you don't need the spidev driver and the interfaces it creates.

Instead, rely entirely on two dedicated  the adc7846, fbtft drivers.
 

Modules that are included in the Armbian core:

config/kernel/linux-sunxi-current.config:6333:CONFIG_FB_TFT=m
config/kernel/linux-sunxi-current.config:6334:CONFIG_FB_TFT_AGM1264K_FL=m
config/kernel/linux-sunxi-current.config:6335:CONFIG_FB_TFT_BD663474=m
config/kernel/linux-sunxi-current.config:6336:CONFIG_FB_TFT_HX8340BN=m
config/kernel/linux-sunxi-current.config:6337:CONFIG_FB_TFT_HX8347D=m
config/kernel/linux-sunxi-current.config:6338:CONFIG_FB_TFT_HX8353D=m
config/kernel/linux-sunxi-current.config:6339:CONFIG_FB_TFT_HX8357D=m
config/kernel/linux-sunxi-current.config:6340:CONFIG_FB_TFT_ILI9163=m
config/kernel/linux-sunxi-current.config:6341:CONFIG_FB_TFT_ILI9320=m
config/kernel/linux-sunxi-current.config:6342:CONFIG_FB_TFT_ILI9325=m
config/kernel/linux-sunxi-current.config:6343:CONFIG_FB_TFT_ILI9340=m
config/kernel/linux-sunxi-current.config:6344:CONFIG_FB_TFT_ILI9341=m
config/kernel/linux-sunxi-current.config:6345:CONFIG_FB_TFT_ILI9481=m
config/kernel/linux-sunxi-current.config:6346:CONFIG_FB_TFT_ILI9486=m
config/kernel/linux-sunxi-current.config:6347:CONFIG_FB_TFT_PCD8544=m
config/kernel/linux-sunxi-current.config:6348:CONFIG_FB_TFT_RA8875=m
config/kernel/linux-sunxi-current.config:6349:CONFIG_FB_TFT_S6D02A1=m
config/kernel/linux-sunxi-current.config:6350:CONFIG_FB_TFT_S6D1121=m
config/kernel/linux-sunxi-current.config:6352:CONFIG_FB_TFT_SH1106=m
config/kernel/linux-sunxi-current.config:6353:CONFIG_FB_TFT_SSD1289=m
config/kernel/linux-sunxi-current.config:6354:CONFIG_FB_TFT_SSD1305=m
config/kernel/linux-sunxi-current.config:6355:CONFIG_FB_TFT_SSD1306=m
config/kernel/linux-sunxi-current.config:6356:CONFIG_FB_TFT_SSD1331=m
config/kernel/linux-sunxi-current.config:6357:CONFIG_FB_TFT_SSD1351=m
config/kernel/linux-sunxi-current.config:6358:CONFIG_FB_TFT_ST7735R=m
config/kernel/linux-sunxi-current.config:6359:CONFIG_FB_TFT_ST7789V=m
config/kernel/linux-sunxi-current.config:6361:CONFIG_FB_TFT_TINYLCD=m
config/kernel/linux-sunxi-current.config:6362:CONFIG_FB_TFT_TLS8204=m
config/kernel/linux-sunxi-current.config:6363:CONFIG_FB_TFT_UC1611=m
config/kernel/linux-sunxi-current.config:6364:CONFIG_FB_TFT_UC1701=m
config/kernel/linux-sunxi-current.config:6365:CONFIG_FB_TFT_UPD161704=m

 

 

Link to comment
Share on other sites

Great advice.  I made the switch to the latest Armbian image

 

Armbian_23.8.1_Orangepipc_bookworm_current_6.1.47

 

I was in the process of applying what I've done so far. Enabling dual SPI with the spi-double-spidev-cs user overlay does not work in this image (it didn't work on the other image properly either)

I'll check out the binaries listed above and see if I can make them work for me.

Thanks for all the advice!  If I get it working, I'll paste a tutorial.

Edited by Peter Gregory
typo
Link to comment
Share on other sites

So, 

Find /. -name "*.dtbo"

Find /. -name "*.dtb"

Find /. -name "*.dts"

doesn't turn up any of them in the factory install image.

 

 The modules that would be useful to the hardware I have available are:

ILI7340 - 2.8 inch LCD + Touch ads7846 Controller - small LCD SPI display with touch (Dual SPI needed)

sun8i-h3-spi-ads7846.dts - MPI3508 2.8 inch HDMI LCD with ads7846 touch controller (Single SPI needed)

 

Unless there is a way to install overlays for the functionality using "apt install ..." I assume I will need to build a custom kernel.

 

I've not built a custom kernel before.  Where is the best place to build it?  On the Orange PI itself or on my Mac?  Is there a handy guide for the process?

Thanks for all the assistance.

 

I've downloaded spi-ads7846.dts and configured it for orange pc spi0.1 which should use second CS PIN 26 (PA21) (to the best of my knowledge)

The pin for IRQ touch event is PA2
 

/dts-v1/;

/plugin/;

 

/ {

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

 

fragment@0 {

target = <&pio>;

__overlay__ {

ads7846_pins: ads7846_pins {

pins= "PA2";

function = "irq";

};

};

};

 

fragment@1 {

target = <&spi0>;

__overlay__ {

#address-cells = <1>;

#size-cells = <0>;

status = "okay";

ads7846@0 {

compatible = "ti,ads7846";

reg = <1>; /* Chip Select 1 */

status = "okay";

pinctrl-names = "default";

pinctrl-0 = <&ads7846_pins>;

spi-max-frequency = <2000000>;

interrupt-parent = <&pio>;

interrupts = <0 2 2>; /* PA2 IRQ_TYPE_EDGE_FALLING */

pendown-gpio = <&pio 0 2 0>; /* PA2 */

 

/* driver defaults, optional */

ti,x-min = /bits/ 16 <0>;

ti,y-min = /bits/ 16 <0>;

ti,x-max = /bits/ 16 <0x0FFF>;

ti,y-max = /bits/ 16 <0x0FFF>;

ti,pressure-min = /bits/ 16 <0>;

ti,pressure-max = /bits/ 16 <0xFFFF>;

ti,x-plate-ohms = /bits/ 16 <400>;

};

};

};

};

 

I've compiled & copied to user overlays and updated armbianEnv.txt to use spi0.1:
 

overlays=spi-add-cs1 spi-spidev

user-overlays=spi-ads7846

param_spidev_spi_bus=0

param_spidev_spi_cs=1

 

This does about what you'd expect, creates spidev0.1 and no error messages in dmesg.

However I still need to compile the touch driver and load it as a module.

I can't do that because the apt repository doesn't have the headers:

 

sudo apt install linux-headers-$(uname -r)

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

E: Unable to locate package linux-headers-6.1.47-current-sunxi

E: Couldn't find any package by glob 'linux-headers-6.1.47-current-sunxi'

 

Is there a way to get the linux-headers-6.1.47-current-sunxi.deb file?

 

Edited by Peter Gregory
Link to comment
Share on other sites

12 часов назад, Peter Gregory сказал:

Is there a way to get the linux-headers-6.1.47-current-sunxi.deb file?

linux-headers-current-sunxi_23.8.1_armhf__6.1.47

 

12 часов назад, Peter Gregory сказал:

sudo apt install linux-headers-$(uname -r)

What will the team show? apt search linux-headers-current-sunxi

 

Link to comment
Share on other sites

The display that requires dual SPI interfaces is:

 

Hosyond 2.8 Inches TFT LCD Touch Screen Shield Display Module 320x240 SPI Serial ILI9341 with Touch Pen Compatible with Arduino R3/Mega2560 Development Board

 

I bought it from Amazon.  I can get it working for display only using FBTFT, but I haven't gotten the touch part to work yet.

I was trying to get it working with an Orange PI Zero 2, but I switched to Orange PI PC because there were older images out there that I hoped would support touch drivers.

I think it uses the same touch controller as my HDMI LCD touchscreen.  Here is the link to the amazon page:

https://www.amazon.com/gp/product/B09XHJ9KRX/ref=ppx_yo_dt_b_asin_image_o09_s00?ie=UTF8&th=1

Link to comment
Share on other sites

1 час назад, Peter Gregory сказал:

Hosyond 2.8 Inches TFT LCD Touch Screen Shield Display Module 320x240 SPI Serial ILI9341 with Touch Pen Compatible with Arduino R3/Mega2560 Development Board

Very good. Now I understand what you need.
Just take my core for sunxi.
Both required modules are included.

DTB package is not required. Everything is included in the kernel image file.

 

In fact, you need one overlay file in which two nodes for the two drivers used "fb_ili9341" and "ads7846" will be registered for the purpose of spi0.

Link to comment
Share on other sites

Thanks for the debs!  I'll try them out and get that display working.  I'm also trying to get this one working too:

3.5 inch LCD HDMI USB Touch Screen Real HD 1920x1080 LCD Display Py for Raspberri 3 Model B / Orange Pi (Play Game Video)MPI3508
https://www.aliexpress.us/item/3256805680215131.html?spm=a2g0o.order_detail.order_detail_item.3.38aff19cCzHh5K&gatewayAdapt=glo2usa

 

The HDMI works great, and the hat for the touch interface is almost perfect for Orange PI PC (CS pin is second SPI CS select instead of the primary SPI CS, hence the original request in this post).

I think the debs you linked should be able to drive this one too (sans the FBTFT).

Link to comment
Share on other sites

I installed the debs, but I don't see the modules or overlays for the touchscreen for orangepi pc.

 

sudo dpkg -i linux-headers-edge-sunxi_6.4.14-Armbian.23.10_armhf.deb

sudo dpkg -i linux-image-edge-sunxi_6.4.14-Armbian.23.10_armhf.deb

sudo dpkg -i linux-libc-dev_6.4.14-Armbian.23.10_armhf.deb

 

which overlays need to be used in armbianEnv.txt?

which modules need to be loaded?  Are there any arguments needed for the modules?

 

 

Link to comment
Share on other sites

08.09.2023 в 01:57, Peter Gregory сказал:

which overlays need to be used in armbianEnv.txt?

For this display,

06.09.2023 в 02:19, Peter Gregory сказал:

MPI3508 2.8 inch HDMI LCD with ads7846 touch controller (Single SPI needed)

you need to compile and register it yourself. Please publish a successful, correct overlay file here and paste it as a code (button <>).

 

For this display,

07.09.2023 в 20:16, Peter Gregory сказал:

Hosyond 2.8 Inches TFT LCD Touch Screen Shield Display Module 320x240 SPI Serial ILI9341 with Touch Pen Compatible with Arduino R3/Mega2560 Development Board

I looked at Aliexpress. There are many varieties of them. What is the pinout on yours?
You can look through a magnifying glass at the names of the chips to be sure of the correct driver selection for the touch panel.

Link to comment
Share on other sites

So, I built the latest version of armbian edge and generated Armbian_23.08.0-trunk_Orangepipc_bullseye_edge_6.5.1_minimal.img.

I modified the kernel to include the drivers for Hosyond 2.8 Inches TFT LCD Touch Screen Shield Display Module 320x240 SPI Serial ILI9341 with Touch Pen - modules fbtft and fb_ili9341

Pinout for the SPI display <==> OrangePi PC :
1 - VCC     (1)  3.3v
2 - GND     (6)  GND
3 - CS         (24) SPI0 CS
4 - RESET     (29) GPIO 21
5 - DC         (31) GPIO 22
6 - SDI (MOSI)    (19) SPI0 MOSI
7 - SCLK    (23) SPI0 CLK
8 - LED        (33) GPIO 23
9 - SDO (MISO)    (21) SPI0 MISO
10 - T_CLK      (23) SPI0 CLK
11 - T_CS       (21) GPIO 11
12 - T_DIN    (19) SPI0 MOSI
13 - T_DO    (21) SPI0 MISO
14 - T_IRQ    (35) GPIO 24

 

I found an example dts for a similar device:
 

touchscreen.dts

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

        fragment@0 {
                target-path = "/aliases";
                __overlay__ {
                        spi0 = "/soc/spi@5010000";
                        spi1 = "/soc/spi@5011000";
                };
        };

        fragment@2 {
               target = <&r_pio>;
                __overlay__ {
                        spi0_cs1_pin: spi0_cs1_pin {
                                pins = "PA21";
                                function = "gpio_out";
                                output-high;
                        };
                };
        };
        fragment@3 {
                 target = <&spi0>;
                 __overlay__ {
                            pinctrl-names = "default", "default";
                            pinctrl-1 = <&spi0_cs1_pin>;
                            cs-gpios = <0>, <&r_pio 0 21 0>; /* PA21 */
                            status = "okay";
                            debug = <0>;
                            #address-cells = <1>;
                            #size-cells = <0>;
                            spidev@0 {
                                     reg = <0>; /* Chip Select 0 */
                                     compatible = "spidev";
                                     spi-max-frequency = <100000000>;
                                     status = "disabled";
                            };
                            spidev@1 {
                                      reg = <1>; /* Chip Select 1 */
                                      compatible = "spidev";
                                      spi-max-frequency = <12000000>;
                                      status = "disabled";
                            };
                 };
        };
        fragment@4 {
                 target = <&pio>;
                 __overlay__ {
                            ili9341_pins: ili9341_pins {
                                      pins = "PA7", "PA8"; /*RESET, DC_RS*/
                                      function = "gpio_out", "gpio_out" ;
                            };
                 };
        };
        fragment@5 {
                target = <&spi0>;
                __overlay__ {
                        /* needed to avoid dtc warning */
                        #address-cells = <1>;
                        #size-cells = <0>;
                        cs-gpios = <0>, <&r_pio 2 3 0>; /* PC3 */
                        status = "okay";
                        ili9341: ili9341@0 {
                                compatible = "ilitek,ili9341";
                                spi-max-frequency = <32000000>;
                                reg = <0>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&ili9341_pins>;
                                status = "okay";
                                debug = <0>;
                                txbuflen = <32768>;
                                rotate = <90>;
                                bgr;
                                fps = <60>;
                                buswidth = <8>;
                                regwidth = <16>;
                                reset-gpios = <&pio 0 7 0>; /*RST= PA7 */
                                dc-gpios = <&pio 0 8 0>; /*LCD_RS PA8 */
                                init = <0x1000001
                                        0x2000005
                                        0x1000028
                                        0x10000cf 0x00 0x83 0x30
                                        0x10000ed 0x64 0x03 0x12 0x81
                                        0x10000e8 0x85 0x01 0x79
                                        0x10000cb 0x39 0x2c 0x00 0x34 0x02
                                        0x10000f7 0x20
                                        0x10000ea 0x00 0x00
                                        0x10000c0 0x26
                                        0x10000c1 0x11
                                        0x10000c5 0x35 0x3e
                                        0x10000c7 0xbe
                                        0x100003a 0x55
                                        0x1000036 0x28
                                        0x10000b1 0x00 0x1b
                                        0x1000026 0x01
                                        0x10000f2 0x08
                                        0x1000026 0x01
                                        0x10000e0 0x1f 0x1a 0x18 0x0a 0x0f 0x06 0x45 0x87 0x32 0x0a 0x07 0x02 0x07 0x05 0x00
                                        0x10000e1 0x00 0x25 0x27 0x05 0x10 0x09 0x3a 0x78 0x4d 0x05 0x18 0x0d 0x38 0x3a 0x1f
                                        0x10000b7 0x07
                                        0x10000b6 0x0a 0x82 0x27 0x00
                                        0x1000011
                                        0x2000064
                                        0x1000029
                                        0x2000064>;
                        };
                        xpt2046: xpt2046@1 {
                                compatible = "ti,ads7846";
                                reg = <1>;
                                status ="okay";
                                spi-max-frequency = <1000000>;
                                interrupts = <0 10 2>; /* PA10 high-to-low edge triggered */
                                interrupt-parent = <&r_pio>;   /* PA10<-----> TP_IRQ */
                                pendown-gpio = <&r_pio 0 10 0>;
                                ti,keep-vref-on = <1>;
                                ti,x-min = /bits/ 16 <00>;
                                ti,x-max = /bits/ 16 <0xFFF>;
                                ti,y-min = /bits/ 16 <00>;
                                ti,y-max = /bits/ 16 <0xFFF>;
                                ti,x-plate-ohms = /bits/ 16 <60>;
                                ti,pressure-max = /bits/ 16 <255>;
                                ti,swap-xy = <0>;
                        };
                };
        };
};

 

sudo armbian-add-overlay touchscreen.dts
 

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

fbtft

fb_ili9341

 

There are problems with the overlay, not sure how to define the pin PA21 so it can be recognized:

 

[    1.627208] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0

[    1.647806] Console: switching to colour frame buffer device 90x30

[    1.668235] sun4i-drm display-engine: [drm] fb0: sun4i-drmdrmfb frame buffer device

[    1.669024] sun8i-h3-r-pinctrl 1f02c00.pinctrl: unknown pin PA21

[    1.669041] sun6i-spi 1c68000.spi: there is not valid maps for state default

[    1.669130] sun8i-h3-pinctrl 1c20800.pinctrl: supply vcc-pc not found, using dummy regulator

[    1.669640] sun6i-spi 1c68000.spi: cannot register SPI master

[    1.674905] sun8i-h3-r-pinctrl 1f02c00.pinctrl: supply vcc-pl not found, using dummy regulator

[    1.677031] sun8i-h3-pinctrl 1c20800.pinctrl: supply vcc-pf not found, using dummy regulator

[    1.678053] sun8i-h3-r-pinctrl 1f02c00.pinctrl: unknown pin PA21

[    1.678081] sun6i-spi 1c68000.spi: there is not valid maps for state default

[    1.678158] sun8i-h3-pinctrl 1c20800.pinctrl: supply vcc-pc not found, using dummy regulator

[    1.678604] sun6i-spi 1c68000.spi: cannot register SPI master

[    1.678903] sunxi-mmc 1c0f000.mmc: Got CD GPIO

[    1.683732] sun8i-h3-pinctrl 1c20800.pinctrl: supply vcc-pg not found, using dummy regulator

[    1.685245] sun8i-h3-r-pinctrl 1f02c00.pinctrl: unknown pin PA21

[    1.685267] sun6i-spi 1c68000.spi: there is not valid maps for state default

[    1.685343] sun8i-h3-pinctrl 1c20800.pinctrl: supply vcc-pc not found, using dummy regulator

[    1.685647] sun6i-spi 1c68000.spi: cannot register SPI master

[    1.687568] phy phy-1c19400.phy.0: Changing dr_mode to 1

[    5.889192] fbtft: module is from the staging directory, the quality is unknown, you have been warned.

[    5.896204] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.

[    5.896447] fb_ili9341: unknown parameter 'debug' ignored

 

Any advice would be helpful.

 

Link to comment
Share on other sites

9 часов назад, Peter Gregory сказал:

There are problems with the overlay, not sure how to define the pin PA21 so it can be recognized:

drivers/pinctrl/sunxi/pinctrl-sun8i-h3-r.c   as r-pio - PL pin's.

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  as pio - PA, PC, PD, PE, PF, PG pin's.

 

Invalid:

10 часов назад, Peter Gregory сказал:
cs-gpios = <0>, <&r_pio 0 21 0>; /* PA21 */
10 часов назад, Peter Gregory сказал:
cs-gpios = <0>, <&r_pio 2 3 0>; /* PC3 */
10 часов назад, Peter Gregory сказал:
interrupt-parent = <&r_pio>;   /* PA10<-----> TP_IRQ */
                                pendown-gpio = <&r_pio 0 10 0>;

&r_pio -> &pio

 

Invalid:

10 часов назад, Peter Gregory сказал:
__overlay__ {
                        spi0 = "/soc/spi@5010000";
                        spi1 = "/soc/spi@5011000";

For your device, you have printed this information:

05.09.2023 в 00:36, Peter Gregory сказал:

The DTB used in this image is /boot/dtb/sun8i-h3-orangepi-pc.dtb

The sections you referenced are

pinctrl@1c20800 {
	spi0-pins {
		pins = "PC0\0PC1\0PC2\0PC3";
		function = "spi0";
		phandle = < 0x16 >;
	};

	spi1-pins {
		pins = "PA15\0PA16\0PA14\0PA13";
		function = "spi1";
		phandle = < 0x17 >;
	};
};

spi@1c68000 {
	compatible = "allwinner,sun8i-h3-spi";
	reg = < 0x1c68000 0x1000 >;
	interrupts = < 0x00 0x41 0x04 >;
	clocks = < 0x03 0x1e 0x03 0x52 >;
	clock-names = "ahb\0mod";
	dmas = < 0x15 0x17 0x15 0x17 >;
	dma-names = "rx\0tx";
	pinctrl-names = "default";
	pinctrl-0 = < 0x16 >;
	resets = < 0x03 0x0f >;
	status = "disabled";
	#address-cells = < 0x01 >;
	#size-cells = < 0x00 >;
	phandle = < 0x5c >;
};

spi@1c69000 {
	compatible = "allwinner,sun8i-h3-spi";
	reg = < 0x1c69000 0x1000 >;
	interrupts = < 0x00 0x42 0x04 >;
	clocks = < 0x03 0x1f 0x03 0x53 >;
	clock-names = "ahb\0mod";
	dmas = < 0x15 0x18 0x15 0x18 >;
	dma-names = "rx\0tx";
	pinctrl-names = "default";
	pinctrl-0 = < 0x17 >;
	resets = < 0x03 0x10 >;
	status = "disabled";
	#address-cells = < 0x01 >;
	#size-cells = < 0x00 >;
	phandle = < 0x5d >;
};

__symbols__ {
	pio = "/soc/pinctrl@1c20800";
	spi0_pins = "/soc/pinctrl@1c20800/spi0-pins";
	spi1_pins = "/soc/pinctrl@1c20800/spi1-pins";
	spi0 = "/soc/spi@1c68000";
	spi1 = "/soc/spi@1c69000";
}; 

 

Link to comment
Share on other sites

16 часов назад, Peter Gregory сказал:

Does the 2 CS logic look OK in the DTS?

For OrangePI pins:

 

OrangePI_gpios.png

and

Pinout for the SPI display <==> OrangePi PC :
1 - VCC           (1)      3.3v
2 - GND         (6)        GND
3 - CS          (24 PC3)   SPI0 CS0      
4 - RESET       (29 PA7)   ILI9341-RST
5 - DC          (31 PA8)   ILI9341-DC
6 - SDI (MOSI)  (19 PC0)   SPI0 MOSI
7 - SCLK        (23 PC2)   SPI0 CLK
8 - LED         (33 PA9)   Backlight (optional) or 3.3v(17)
9 - SDO (MISO)  (21 PC1)   SPI0 MISO


10 - T_CLK   (23 PC2)      SPI0 CLK
11 - T_CS    (26 PA21)     SPI0 CS1
12 - T_DIN   (19 PC0)      SPI0 MOSI
13 - T_DO    (21 PC1)      SPI0 MISO
14 - T_IRQ   (35 PA10)     TS IRQ

The overlay file template may look like this:

/dts-v1/;
/plugin/;

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

	fragment@0 {
		target-path = "/aliases";
		__overlay__ {
			spi0 = "/soc/spi@1c68000";
		};
	};

	fragment@1 {
		target = <&pio>;
		__overlay__ {
		spi0_pins: spi0-pins {
				pins = "PC0", "PC1", "PC2";
				function = "spi0";
			};

		spi0_cs0_pin: spi0-cs0-pin {
				pins = "PC3";
				function = "spi0";
			};
		};

		spi0_cs1_pin: spi0-cs1-pin {
				pins = "PA21";
				function = "spi0";
			};
		};

		ili9341_rst: ili9341-rst {
				pins = "PA7";
				function = "gpio_out";
			};
		};

		ili9341_dc: ili9341-dc {
				pins = "PA8";
				function = "gpio_out";
			};
		};
/*		optional
		ili9341_led: ili9341-led {
				pins = "PA9";
				function = "gpio_out";
			};
		};
*/
		ads7846_pin: ads7846-pin {
				pins = "PA10";
				function = "irq";
			};
		};
	};


	fragment@2 {
		target = <&spi0>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi0_pins>;
			status = "okay";
			ili9341: ili9341@0 {
				compatible = "ilitek,ili9341";
				reg = <0>;
				pinctrl-names = "default";
				pinctrl-0 = <&spi0_cs0_pin>;
				status = "okay";
				spi-max-frequency = <16000000>;
				rotate = <90>;
				bgr;
				fps = <25>;
				buswidth = <8>;
				regwidth = <16>;
				reset-gpios = <&pio &ili9341_rst 0>;
				dc-gpios = <&pio &ili9341_dc 0>;
				/*led-gpios = <&pio &ili9341_led 0>; */
			};

			xpt2046: xpt2046@1 {
				compatible = "ti,ads7846";
				reg = <1>;
				pinctrl-names = "default";
				pinctrl-0 = <&spi0_cs1_pin>;
				interrupts = <&ads7846_pin>;
				interrupt-parent = <&pio>;
				status = "okay";
				spi-max-frequency = <1000000>;
			};
		};
	};

};

 

Link to comment
Share on other sites

After playing around with the dts and removing entries already defined in the kernel dts, I got it to compile and install and run without errors.

 

/dts-v1/;
/plugin/;
/ {
        compatible = "allwinner,sun8i-h3";

        fragment@1 {
                target = <&pio>;
                __overlay__ {
                        spi0_cs1_pin: spi0-cs1-pin {
                                pins = "PA21";
                                function = "spi0";
                        };

                        ili9341_rst: ili9341-rst {
                                pins = "PA7";
                                function = "gpio_out";
                        };

                        ili9341_dc: ili9341-dc {
                                pins = "PA8";
                                function = "gpio_out";
                        };
                
                        ili9341_led: ili9341-led {
                                pins = "PA9";
                                function = "gpio_out";
                        };
                
                        ads7846_pin: ads7846-pin {
                                pins = "PA10";
                                function = "irq";
                        };
                };
        };


        fragment@2 {
                target = <&spi0>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&spi0_pins>;
                        status = "okay";
                        ili9341: ili9341@0 {
                                compatible = "ilitek,ili9341";
                                reg = <0>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&spi0_cs0_pin>;
                                status = "okay";
                                spi-max-frequency = <16000000>;
                                rotate = <90>;
                                bgr;
                                fps = <25>;
                                buswidth = <8>;
                                regwidth = <16>;
                                reset-gpios = <&pio &ili9341_rst 0>;
                                dc-gpios = <&pio &ili9341_dc 0>;
                                led-gpios = <&pio &ili9341_led 0>;
                        };

                        xpt2046: xpt2046@1 {
                                compatible = "ti,ads7846";
                                reg = <1>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&spi0_cs1_pin>;
                                interrupts = <&ads7846_pin>;
                                interrupt-parent = <&pio>;
                                status = "okay";
                                spi-max-frequency = <1000000>;
                        };
                };
        };

};

 

[    5.778467] fbtft: module is from the staging directory, the quality is unknown, you have been warned.

[    5.792958] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.

 

that's all I hear from it in the system logs.  The display doesn't light up, and I don't see a new frame buffer /dev/fb1 for the LCD display.

I'm not sure if it is working or not.  I assume there are more things I need to do to activate the display and make it the console screen?

Thanks for all the help so far.  I feel I'm getting close to getting this display to work.

 

Link to comment
Share on other sites

22 часа назад, going сказал:
target = <&pio>;
		__overlay__ {
		spi0_pins: spi0-pins {
				pins = "PC0", "PC1", "PC2";
				function = "spi0";
			};

		spi0_cs0_pin: spi0-cs0-pin {
				pins = "PC3";
				function = "spi0";
			};

Here I have intentionally divided the description of the pins.
In your connection configuration, multiple devices connect to a single SPI interface.
This means that the MOSI, MISO, CLK contacts are shared and connected in parallel for all devices and are described in the SPI node.
And CS pins should be different and should be registered for each device separately in the corresponding node for this device.

In the existing DTS, the pin description looks like:

14.09.2023 в 15:16, going сказал:
pinctrl@1c20800 {
	spi0-pins {
		pins = "PC0\0PC1\0PC2\0PC3";
		function = "spi0";
		phandle = < 0x16 >;
	};

 

Link to comment
Share on other sites

7 часов назад, Peter Gregory сказал:
pinctrl-0 = <&spi0_cs0_pin>;

In your version of the dts overlay, this pin is not described.
In this case, you must explicitly register it here.

 

7 часов назад, Peter Gregory сказал:

The display doesn't light up, and I don't see a new frame buffer /dev/fb1 for the LCD display.

Must be /dev/fb0

Check whether the SPI interface has been created in the /sys file system and the status of the pin that is connected to the LED display.

Or simply connect the pin of the LED display with 3.3v for the duration of the experiments.

 

P.S. Other variables that drivers can accept are not known to me for certain. This remains for your experiments.
A similar device is just coming to my address.
I will post my working version upon arrival.

Edited by going
Add P.S.
Link to comment
Share on other sites

Getting some more progress...

Updated my DTS to the following:
 

/dts-v1/;
/plugin/;
/ {
	compatible = "allwinner,sun8i-h3";

	fragment@1 {
		target = <&pio>;
		__overlay__ {
 			spi0_cs1_pin: spi0-cs1-pin {
				pins = "PA21";
				function = "gpio_out";
			};

			ili9341_rst: ili9341-rst {
				pins = "PA7";
				function = "gpio_out";
			};

			ili9341_dc: ili9341-dc {
				pins = "PA8";
				function = "gpio_out";
			};
		
			ili9341_led: ili9341-led {
				pins = "PA9";
				function = "gpio_out";
				output-high;
			};
		
			ads7846_pin: ads7846-pin {
				pins = "PA10";
				function = "irq";
			};
		};
	};

	fragment@3 {
		target = <&pio>;
 		__overlay__ {
 			ili9341_pins: ili9341_pins {
				pins = "PA7", "PA8", "PA9"; /*RESET, DC_RS, LED*/
				function = "gpio_out", "gpio_out", "gpio_out" ;
 			};
		};
	};
	fragment@4 {
		target = <&spi0>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			cs_gpios = <0>, <&pio 0 21 0>;
			pinctrl-0 = <&spi0_pins>;
			status = "okay";
			ili9341: ili9341@0 {
				compatible = "ilitek,ili9341";
				reg = <0>;
				pinctrl-names = "default";
				pinctrl-0 = <&ili9341_pins>;
				status = "okay";
				debug=<1>;
				rotate = <90>;
				bgr;
				fps = <25>;
				buswidth = <8>;
				regwidth = <16>;
				reset-gpios = <&pio 0 7 0>;
				dc-gpios = <&pio 0 8 0>;
				led-gpios = <&pio 0 9 0>;
			};

			xpt2046: xpt2046@1 {
				compatible = "ti,ads7846";
				reg = <1>;
				pinctrl-names = "default";
				pinctrl-0 = <&spi0_cs1_pin>;
				interrupts = <0 10 2>;
				interrupt-parent = <&pio>;
				pendown_gpio = <&pio 0 10 0>;
				status = "okay";
				spi-max-frequency = <1000000>;
			        ti,keep-vref-on = <1>;
                                ti,x-min = /bits/ 16 <00>;
                                ti,x-max = /bits/ 16 <0xFFF>;
                                ti,y-min = /bits/ 16 <00>;
                                ti,y-max = /bits/ 16 <0xFFF>;
                                ti,x-plate-ohms = /bits/ 16 <60>;
                                ti,pressure-max = /bits/ 16 <255>;
                                ti,swap-xy = <0>;			
			};
		};
	};

};

Now, the I reboot, my display lights up and I get more info in the logs:
 

[    5.855178] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    5.856536] systemd[1]: Finished Load Kernel Module drm.
[    5.860629] systemd[1]: modprobe@fuse.service: Succeeded.
[    5.862192] systemd[1]: Finished Load Kernel Module fuse.
[    5.870725] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
[    5.871537] fb_ili9341 spi0.0: fbtft_property_value: regwidth = 16
[    5.871583] fb_ili9341 spi0.0: fbtft_property_value: buswidth = 8
[    5.871601] fb_ili9341 spi0.0: fbtft_property_value: debug = 1
[    5.871647] fb_ili9341 spi0.0: fbtft_property_value: fps = 25
[    5.871990] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'reset' GPIO
[    5.872048] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'dc' GPIO
[    5.872079] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'rd' GPIO
[    5.872105] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'wr' GPIO
[    5.872132] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'cs' GPIO
[    5.872159] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'latch' GPIO
[    5.872185] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872225] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872253] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872280] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872309] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872335] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872361] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872388] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872414] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872440] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872468] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872493] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872520] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872547] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872573] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872600] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872627] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872654] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872681] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872709] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872735] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872761] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872787] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872814] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872840] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872867] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872893] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.872919] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.872947] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.872974] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.873001] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.873029] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.873084] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.873136] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.873185] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.873220] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.873249] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.873276] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.873302] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.873329] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.873380] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.873432] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.873463] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.873514] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.873555] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    5.873583] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
[    5.873611] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'led' GPIO
[    5.873638] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'aux' GPIO
[    6.139465] graphics fb1: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 16 KiB buffer memory, fps=25, spi0.0 at 100 MHz
[    6.879396] systemd[1]: Starting Load/Save Screen Backlight Brightness of backlight:fb_ili9341...
[    6.989237] systemd[1]: Finished Load/Save Screen Backlight Brightness of backlight:fb_ili9341.
[    7.220279] SPI driver ads7846 has no spi_device_id for ti,tsc2046
[    7.220305] SPI driver ads7846 has no spi_device_id for ti,ads7843
[    7.220313] SPI driver ads7846 has no spi_device_id for ti,ads7845
[    7.220319] SPI driver ads7846 has no spi_device_id for ti,ads7873
[    7.220557] ads7846 spi0.1: failed to request pendown GPIO
[    7.220570] ads7846: probe of spi0.1 failed with error -2

 

However, the display does not blank, so I'm probably missing the init codes.

Also, my pin down declarations are not correct.

However, I'm getting closer to getting this display to work.

 

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