Jump to content

Orangepi Zero 2W wrong color display on MPI3501


Go to solution Solved by robertoj,

Recommended Posts

Posted (edited)

Hi everyone,

I have wrong color in screen MPI3501 , when i test to output buffer to color red,green, blue, it seem like 
Red. —> blue
Green —> red
Blue. —> green
Here is how i test (i need to stop lightdm service before this)

Spoiler

python3 -c 'open("red.raw", "wb").write(b"\xF8\x00" * 153600)'
sudo dd if=red.raw of=/dev/fb0 bs=1

python3 -c 'open("green.raw", "wb").write(b"\x07\xE0" * 153600)'
sudo dd if=green.raw of=/dev/fb0 bs=1

python3 -c 'open("blue.raw", "wb").write(b"\x00\x1F" * 153600)'
sudo dd if=blue.raw of=/dev/fb0 bs=1

 

6ddc049f5c3de863b12c.thumb.jpg.718c705cf22c53200175e925b5d9efeb.jpg

(when boot the image should be orange not green)


I am using display MPI3501 http://www.lcdwiki.com/3.5inch_RPi_Display which i heard that is a clone of waveshare 3,5 inch https://www.waveshare.com/3.5inch-RPi-LCD-C.htm
I'm using Debian Bookworm. I know that it not the same as Armbian, but the config kinda the same.

Spoiler

orangepi@Gigi-Connect:/boot$ uname -a
Linux Gigi-Connect 6.1.31-sun50iw9 #1.0.2 SMP Thu Jul 11 17:24:28 CST 2024 aarch64 GNU/Linux
orangepi@Gigi-Connect:/boot$ lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Orange Pi 1.0.2 Bookworm
Release:    12
Codename:    bookworm

 

About driver for ili9486, here is the info

Spoiler

orangepi@Gigi-Connect:/boot$ cat /sys/class/graphics/fb0/virtual_size && cat /sys/class/graphics/fb0/bits_per_pixel && cat /sys/class/graphics/fb0/name
480,320
16
ili9486drmfb

 

To use this screen i create overlay-user. and and ili9486.dts. Here is the content of it

Spoiler

orangepi@Gigi-Connect:/boot$ cat overlay-user/test.dts 
/dts-v1/;

/ {
    compatible = "allwinner,sun50i-h616";

    fragment@0 {
        target = <0xffffffff>;

        __overlay__ {
            status = "okay";
            cs-gpios = <0xffffffff 0x07 0x05 0x00>;

            ili9486@1 {
                compatible = "fb,ili9486";
                reg = <0x00>;
                pinctrl-names = "default";
                spi-max-frequency = <0x2dc6c00>;
                rotation = <0xb4>;
                bgr = <0x01>;
                fps = <0x1e>;
                buswidth = <0x08>;
                reset-gpios = <0xffffffff 0x08 0x06 0x00>;
                dc-gpios = <0xffffffff 0x07 0x04 0x00>;
                debug = <0x00>;
                init = <0x10000b0 0x00 0x1000011 0x20000ff 0x100003a 0x53 0x1000036 0x38 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 0x38 0x1000011 0x1000029>;
                phandle = <0x01>;
            };

            ads7846@0 {
                compatible = "ti,ads7846";
                reg = <0x01>;
                pinctrl-names = "default";
                spi-max-frequency = <0x1e8480>;
                interrupts = <0x07 0x02 0x01>;
                interrupt-parent = <0xffffffff>;
                pendown-gpio = <0xffffffff 0x07 0x02 0x00>;
                ti,keep-vref-on = <0x01>;
                ti,pressure-min = [00 0a];
                ti,pressure-max = [03 e8];
                ti,debounce-rep = [00 01];
                ti,debounce-tol = [00 02];
                ti,debounce-max = [00 64];
                ti,settle-delay-usec = [00 14];
                ti,penirq-recheck-delay-usecs = [00 14];
                ti,x-plate-ohms = [01 90];
                ti,y-plate-ohms = [01 90];
                phandle = <0x02>;
            };
        };
    };

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

    __fixups__ {
        spi1 = "/fragment@0:target:0";
        pio = "/fragment@0/__overlay__:cs-gpios:0\0/fragment@0/__overlay__/ili9486@1:reset-gpios:0\0/fragment@0/__overlay__/ili9486@1:dc-gpios:0\0/fragment@0/__overlay__/ads7846@0:interrupt-parent:0\0/fragment@0/__overlay__/ads7846@0:pendown-gpio:0";
    };
};
 

and I add this overlay to /boot/orangepiEnv.txt

Spoiler

orangepi@Gigi-Connect:/boot$ cat orangepiEnv.txt 

verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun50i-h616
rootdev=UUID=143432a6-939f-4b67-86ee-efefb4389531
rootfstype=ext4
user_overlays=ili9486 sun50i-h616-i2s0

 

Note that i think the field "bgr" and "init" not working, i try to change it to make bgr from 0x00 to 0x01, or send init different at 0x10000036 but nothing change.
Also note that, i also try to cat raw data from /dev/fb0 and using ffmpeg --> It is true color 
image.thumb.png.e976a46e587e59374fd507e8b83b00d7.png

Also here is the dmesg log 

 

Spoiler

orangepi@Gigi-Connect:/boot$ sudo dmesg | grep -e ili -e fb
[sudo] password for orangepi: 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 258048
[    0.000000] Kernel command line: root=UUID=143432a6-939f-4b67-86ee-efefb4389531 rootwait rootfstype=ext4 splash=verbose console=ttyS0,115200 console=tty1 consoleblank=0 loglevel=1 ubootpart=8364a2aa-01 usb-storage.quirks= bgr=1  cgroup_enable=memory swapaccount=1
[    1.696201] Loaded X.509 cert 'Build time autogenerated kernel key: fb722209fb4a0676648f73c963b6906adcfad97c'
[    1.700147] evm: security.capability
[    1.759274] ili9486@1 enforce active low on chipselect handle
[    5.325954] systemd[1]: Listening on systemd-initctl.socket - initctl Compatibility Named Pipe.
[    6.429029] SPI driver ili9486 has no spi_device_id for waveshare,rpi-lcd-35
[    6.429052] SPI driver ili9486 has no spi_device_id for ozzmaker,piscreen
[    6.429835] [drm] Initialized ili9486 1.0.0 20200118 for spi1.0 on minor 1
[    7.301486] ili9486 spi1.0: [drm] fb0: ili9486drmfb frame buffer device
[    7.353500] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    7.358345] fb_ili9486: module is from the staging directory, the quality is unknown, you have been warned.
[    7.358644] SPI driver fb_ili9486 has no spi_device_id for ilitek,ili9486
 



Is anyone here familiar with this problem, or ever try to change bgr field of this ili9486 ? 
Best Regard !!

Edited by Minh Tiến Nguyễn
  • Solution
Posted (edited)

https://forum.armbian.com/topic/46824-orange-pi-zero-3-ili9486-tft-lcd/

user wdr_s had success with that same lcd. Try it with linux 6.1 (check the success case)

If you have a file named orangeEnv.txt... you arent using armbian yet! ;)

 

Make sure to use armbian-add-overlay

 

In the ili9341 or ili9488 there's someone trying with orange pi zero 2w, which is very close to zero 3

Edited by robertoj
Posted

Thank you so much for sharing me the thread, i finally make the screen true color follow  dts of user wdr_s
Here is my dts file
 

Spoiler

/dts-v1/;
/plugin/;
/ {
    compatible = "allwinner,sun50i-h616";
    fragment@0 {
        target = <&spi1>;
        __overlay__ {
            status = "okay";
        cs-gpios = <&pio 7 5 0>; /*PH5=CS0 PH9=CS1*/
            ili9486: ili9486@1 {
                compatible = "ilitek,ili9486";
                reg = <0>;
                pinctrl-names = "default";
                spi-max-frequency = <16000000>;
                rotate = <360>;
                bgr = <0>;
                fps = <30>;
                buswidth = <8>;
                reset-gpios = <&pio 8 6 0>; /* PI6 */
                dc-gpios = <&pio 7 4 0>; /* PH4 */
                debug = <0>;
                init = <0x10000b0 0x00 0x1000011 0x20000ff 0x100003a 0x55 0x1000036 0x48 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 0x48 0x1000011 0x1000029>;
            };

            ads7846: ads7846@0 {
                compatible = "ti,ads7846";
                reg = <1>;
                pinctrl-names = "default";
                spi-max-frequency = <2000000>;
                interrupts = <7 2 1>; /* PH2 - IRQ */
                interrupt-parent = <&pio>;
                pendown-gpio = <&pio 7 2 0>; /* PH2 */
                
                /* OPTIONS */
                ti,keep-vref-on = <1>;
                ti,pressure-min = /bits/ 16 <10>;
                ti,pressure-max = /bits/ 16 <1000>;
                ti,debounce-rep = /bits/ 16 <1>;
                ti,debounce-tol = /bits/ 16 <2>;
                ti,debounce-max = /bits/ 16 <100>;
                ti,settle-delay-usec = /bits/ 16 <20>;
                ti,penirq-recheck-delay-usecs = /bits/ 16 <20>;
                ti,x-plate-ohms = /bits/ 16 <400>;
                ti,y-plate-ohms = /bits/ 16 <400>;
        };
        };
    };
};
 

The thing i change compare with dts in https://github.com/dev-null2019/orangepizero2w35tft :
1. spi-max-frequency from 48000000 to 16000000 (I think it due to speed of spi on the board)
2. And in init, i change both value of 0x1000036 0x48

I test on Debian Bookworm, Armbian it work ok 

Note that, with this device tree, i got reversed touch screen (up to down work ok, but left to right is reversed) so i need to change the calib matrix
Here is the content of /usr/share/X11/xorg.conf.d/80-calibration.conf
 

Spoiler

orangepi@Gigi-Connect:~$ cat /usr/share/X11/xorg.conf.d/80-calibration.conf
Section "InputClass"
    Identifier      "calibration"
    MatchProduct    "ADS7846 Touchscreen"
    Option "TransformationMatrix" "0 1 0 1 0 0 0 0 1"
Option          "CalibrationMatrix"  "1.1018606001099192 0.0 -0.04002647119970498 0.0 1.0915157162662792 -0.05172708470647051 0.0 0.0 1.0"
EndSection


Once again, Thank you very much. 
I stuck in this problem 3 days, and try so many device tree, and try full supported os from orange pi but it not work, until follow your thread. 

download.jpeg

Posted (edited)

I am glad you could do it with the orange pi zero 2w, because I also want to use a very small arm board :)

 

I am having trouble with the red ili9488 red LCD's touch function, and if I keep having no results, I will replace with the waveshare LCD model (I wanted to have 4-inch LCD :( )

 

What armbian and linux version did you use? If you go to the latest linux, you may need to modify the DTS a little bit (modifications are in my ili9488 thread). Warning: I use a different driver (parameter "compatible") for DRM graphics, and different drivers might need different DTS lines.

 

Always use a different microSD for experiments, so you don't mess with your working setup :) 

 

Does the orange pi zero 2w just need male pin headers on the 40-pin connector, and then plug the LCD on top?

Edited by robertoj
Posted

Hi @robertoj
Yes thank you for helping me
For this board, i am using armbian follow this link https://www.armbian.com/orange-pi-zero-2w/ which is Armbian 25.5.1 Kernel: 6.12.23
Yes i use my 5 different sd card to back up and try so many os (at first i want the OS using fb_ili9486 to make it work just like raspberry pi 4)

Yes after modify the device tree and add calib configuration, i just plug and play, for the orange pi zero 2w it look like this 
 

52fbb36a5132e66cbf23.jpg

Posted

Nice :)

 

Are you going to use apps that will need high fps? If so, comment about the performance.

 

Does the touch function feel steady and reliable? (dragging windows without jumpiness, with the stylus)

 

The app for keyboard emulation with touch screen is "matchbox", if you need it.

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