Jump to content

Driving the ili9488 LCD (4.0 inch cheap chinese clone)


Go to solution Solved by robertoj,

Recommended Posts

Posted

Good to know. I'm interested in getting the red LCD's to work as they are cheaper and more available, I purchased the waveshare only to test my SPI, SBC, and DTS formatting were functional. Now that I confirmed how to translate DTS to work with my SBC, I can work on the red ili9486/8 without worrying about it being a formatting issue.

Posted (edited)

I think I have a partial success but I'm struggling to get anything but white on the red display! Will update when I have more results. panel-mipi is loading, and Card-1-SPI appears under /sys/class/drm/ which is very promising. Verified that /lib/firmware/panel-mipi-dbi-spi is still present, still patched with Kungfupancake's init, and is loaded according to lsmod (as well as dmesg)

 

Spoiler

 

sudo dmesg | grep drm
[    4.002790] rockchip-drm display-subsystem: bound ff900000.vop (ops vop_component_ops [rockchipdrm])
[    4.004049] rockchip-drm display-subsystem: bound ff8f0000.vop (ops vop_component_ops [rockchipdrm])
[    4.028685] rockchip-drm display-subsystem: bound ff940000.hdmi (ops dw_hdmi_rockchip_ops [rockchipdrm])
[    4.030113] [drm] Initialized rockchip 1.0.0 for display-subsystem on minor 0
[    4.030278] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    4.030440] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    6.796700] systemd[1]: Starting modprobe@drm.service - Load Kernel Module drm...
[    6.863822] systemd[1]: modprobe@drm.service: Deactivated successfully.
[    6.864868] systemd[1]: Finished modprobe@drm.service - Load Kernel Module drm.
[    8.238975] [drm] Initialized panel-mipi-dbi 1.0.0 for spi1.0 on minor 1
[    8.345046] [drm] Initialized panfrost 1.4.0 for ff9a0000.gpu on minor 2
[    9.048179] panel-mipi-dbi-spi spi1.0: [drm] fb0: panel-mipi-dbid frame buffer device

sudo dmesg | grep mipi
[    8.230250] panel-mipi-dbi-spi spi1.0: supply power not found, using dummy regulator
[    8.230448] panel-mipi-dbi-spi spi1.0: supply io not found, using dummy regulator
[    8.238975] [drm] Initialized panel-mipi-dbi 1.0.0 for spi1.0 on minor 1
[    9.048179] panel-mipi-dbi-spi spi1.0: [drm] fb0: panel-mipi-dbid frame buffer device

sudo dmesg | grep spi
[    8.074489] OF: /spi@ff1d0000/ads7846@1: Read of boolean property 'ti,swap-xy' with a value.
[    8.076419] ads7846 spi1.1: touchscreen, irq 77
[    8.078736] input: ADS7846 Touchscreen as /devices/platform/ff1d0000.spi/spi_master/spi1/spi1.1/input/input0
[    8.230250] panel-mipi-dbi-spi spi1.0: supply power not found, using dummy regulator
[    8.230448] panel-mipi-dbi-spi spi1.0: supply io not found, using dummy regulator
[    8.238975] [drm] Initialized panel-mipi-dbi 1.0.0 for spi1.0 on minor 1
[    9.048179] panel-mipi-dbi-spi spi1.0: [drm] fb0: panel-mipi-dbid frame buffer device

sudo ls -al /sys/class/drm/
total 0
drwxr-xr-x  2 root root    0 Dec 31  1969 .
drwxr-xr-x 73 root root    0 Dec 31  1969 ..
lrwxrwxrwx  1 root root    0 Dec  5 01:28 card0 -> ../../devices/platform/display-subsystem/drm/card0
lrwxrwxrwx  1 root root    0 Dec  5 01:28 card0-HDMI-A-1 -> ../../devices/platform/display-subsystem/drm/card0/card0-HDMI-A-1
lrwxrwxrwx  1 root root    0 Dec  5 01:29 card1 -> ../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0/drm/card1
lrwxrwxrwx  1 root root    0 Dec  5 01:28 card1-SPI-1 -> ../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0/drm/card1/card1-SPI-1
lrwxrwxrwx  1 root root    0 Dec  5 01:29 card2 -> ../../devices/platform/ff9a0000.gpu/drm/card2
lrwxrwxrwx  1 root root    0 Dec  5 01:29 renderD128 -> ../../devices/platform/ff9a0000.gpu/drm/renderD128

 

 

My current DTS:

Spoiler

/dts-v1/;

/ {

    fragment@0 {
        target = <0xffffffff>;

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

            ili9486@0 {
                compatible = "panel-mipi-dbi-spi";
                reg = <0>;
                spi-max-frequency = <40000000>;
                reset-gpios = <0xffffffff 0x1d 0x00>;
                dc-gpios = <0xffffffff 0x1c 0x00>;
                                write-only;
                                format = "b6x2g6x2r6x2";
                                width-mm= <84>;
                                height-mm=<56>;
                                panel-timing {
                                        hactive = <480>;
                                        vactive = <320>;
                                        hback-porch = <0>;
                                        vback-porch = <0>;
                                        clock-frequency = <0>;
                                        hfront-porch = <0>;
                                        hsync-len = <0>;
                                        vfront-porch = <0>;
                                        vsync-len = <0>;
                                };
            };

            ads7846@1 {
                compatible = "ti,ads7846";
                status = "okay";
                reg = <1>;
                id = <1>;
                spi-max-frequency = <2000000>;
                ti,x-plate-ohms = [00 3c];
                ti,pressure-max = [00 ff];
                ti,swap-xy = <0>;
                ti,invert-y = <1>;
                vcc-supply = <0xffffffff>;
                interrupts = <0x12 0x02>;
                interrupt-parent = <0xffffffff>;
                pendown-gpio = <0xffffffff 0x12 0x00>;
                phandle = <0x02>;
            };
        };
    };

    metadata {
        title = "Enable ili9486/8 Red LCD 3.5inch on SPI1";
        compatible = "rockchip,rk3399";
        category = "misc";
        exclusive = "GPIO1_B0\0GPIO1_A7\0GPIO1_B1\0GPIO1_B2\0GPIO4_D2\0GPIO4_D4\0GPIO4_D5";
        description = "Enable Waveshare 3.5inch RPi LCD (C) on SPI1.";
    };

    fragment@1 {
        target = <0xffffffff>;

        __overlay__ {
            num-cs = <0x02>;
            cs-gpios = <0xffffffff 0x0a 0x00 0xffffffff 0x1a 0x00>;
            pinctrl-names = "default\0high_speed";
            pinctrl-0 = <0xffffffff 0xffffffff 0xffffffff>;
        };
    };

    __symbols__ {
        ili9486 = "/fragment@0/__overlay__/ili9486@0";
        ads7846 = "/fragment@0/__overlay__/ads7846@1";
    };

    __fixups__ {
        spi1 = "/fragment@0:target:0\0/fragment@1:target:0";
        gpio4 = "/fragment@0/__overlay__/ili9486@0:reset-gpios:0\0/fragment@0/__overlay__/ili9486@0:dc-gpios:0\0/fragment@0/__overlay__/ads7846@1:interrupt-parent:0\0/fragment@0/__overlay__/ads7846@1:pendown-gpio:0\0/fragment@1/__overlay__:cs-gpios:12";
        vcc5v0_sys = "/fragment@0/__overlay__/ads7846@1:vcc-supply:0";
        gpio1 = "/fragment@1/__overlay__:cs-gpios:0";
        spi1_clk = "/fragment@1/__overlay__:pinctrl-0:0";
        spi1_rx = "/fragment@1/__overlay__:pinctrl-0:4";
        spi1_tx = "/fragment@1/__overlay__:pinctrl-0:8";
    };
};

 

 

Edit: I installed XFCE to test, and strangely this has caused dmesg to throw errors related to panel-mipi. I had these same errors when panel-mipi was missing from /lib/firmware but it is still present there.

Spoiler

sudo dmesg | grep mipi

[ 4.601157] panel-mipi-dbi-spi spi1.0: supply power not found, using dummy regulator

[ 4.601515] panel-mipi-dbi-spi spi1.0: supply io not found, using dummy regulator

[ 4.601904] panel-mipi-dbi-spi spi1.0: Direct firmware load for panel-mipi-dbi-spi.bin failed wit

h error -2

[ 4.601941] panel-mipi-dbi-spi spi1.0: No config file found for compatible 'panel-mipi-dbi-spi' (

error=-2)

[ 4.601960] panel-mipi-dbi-spi spi1.0: probe with driver panel-mipi-dbi-spi failed with error -2

 

Edited by forumtrekker

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