NewmedFabio
Posts: 5
Joined: Tue Dec 10, 2019 11:04 am

[SOLVED] Rasberry CM3+ DPI (parallel) 7" touch screen with vc4 Opengl driver

Wed Dec 11, 2019 1:57 pm

Following moderator's suggestion,
I've opened a dedicated thread for the issue I've initially illustrated here:
https://www.raspberrypi.org/forums/view ... 2#p1579222

Sum up is:
I'm trying to set up a 7" touch screen that communicate through DPI (parallel RGB) to a Raspberrry CM3+.
Everything is working fine with vc4 and Opengl disabled.
Then, If I enable Opengl (Full kms) in rasp-config, display hangs on boot.
It doesn't show four raspberries, it only shows the welcome screen and freezes there.
I can remotely log in with ssh and everything else is working fine, only the display seems to be freezed.
I've tried also different config.txt options looking for suggestions in other threads but nothing worked.

It turned out that I was missing something: vc4 ignores display settings in config.txt
Moderator "6by9" gave the following answer:
vc4-kms-v3d replaces ALL display configuration that is present in config.txt with kernel configuration.
You need to add device tree configuration and a kernel driver to configure your DPI output.
https://github.com/raspberrypi/linux/bl ... verlay.dts is a suitable overlay that configures the Adafruit Kippah with their 800x480 panels.

In that case the panel is defined as being a yx700wv03.
https://github.com/raspberrypi/linux/bl ... le.c#L1847 to line 1874, and lines 2531-2, then convert that name into a panel mode.
Now I'm tryng to follow his suggestion.
Will post here results with the purpoise to help someone else in my same situation.
Last edited by NewmedFabio on Tue Dec 17, 2019 5:03 pm, edited 1 time in total.

aBUGSworstnightmare
Posts: 1673
Joined: Tue Jun 30, 2015 1:35 pm

Re: Rasberry CM3+ DPI (parallel) 7" touch screen with vc4 Opengl driver

Wed Dec 11, 2019 2:57 pm

Just a question ... are you on a custom carrier board? What about your HDMI connections? Is a connector present or what is connected?

NewmedFabio
Posts: 5
Joined: Tue Dec 10, 2019 11:04 am

Re: Rasberry CM3+ DPI (parallel) 7" touch screen with vc4 Opengl driver

Thu Dec 12, 2019 9:19 am

I'm developing on official Raspberry Compute Module IO Board V3.0.
HDMI connector is present but I'm leaving it unused.

A custom board will be used later.

NewmedFabio
Posts: 5
Joined: Tue Dec 10, 2019 11:04 am

Re: [SOLVED] Rasberry CM3+ DPI (parallel) 7" touch screen with vc4 Opengl driver

Tue Dec 17, 2019 5:00 pm

Finally I've made it!

I downloaded raspberrypi kernel source from github.

First, I edited vc4-kms-kippah-7inch-overlay.dts because original display was rgb18, but mine is rgb24bit. I had to enable all the 24 bit because with18 I was missing red color, resulting in a blue tinted display.

Code: Select all

/*
 * vc4-kms-v3d-overlay.dts
 */

/dts-v1/;
/plugin/;

/*#include "bcm2835.h";*/

/ {
        compatible = "brcm,bcm2835";

        [email protected] {
                target-path = "/";
                __overlay__ {
                        panel: panel {
                                compatible = "ontat,yx700wv03", "simple-panel";

                                port {
                                        panel_in: endpoint {
                                                remote-endpoint = <&dpi_out>;
                                        };
                                };
                        };
                };
       };
            
       [email protected] {
                target = <&dpi>;
                __overlay__  {
                        status = "okay";

                        pinctrl-names = "default";
                        pinctrl-0 = <&dpi_24bit_gpio0>;

                        port {
                                dpi_out: [email protected] {
                                        remote-endpoint = <&panel_in>;
                                };
                        };
                };
        };
        
        [email protected] {
                target = <&gpio>;
                __overlay__ {
                        dpi_24bit_gpio0: dpi_24bit_gpio0 {
                                brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11
                                             12 13 14 15 16 17 18 19 20
                                             21 22 23 24 25 26 27>;
                                brcm,function = <6>; /* alt2 */
                                brcm,pull = <0>; /* no pull */
                        };
                };
        };

};
I compiled it with:

Code: Select all

dtc [email protected] -I dts -O dtb -o vc4-kms-kippah-7inch-overlay.dtbo vc4-kms-kippah-7inchoverlay.dts
I copied dtb file in /boot/overlays.
I also edited /boot/config.txt adding these two lines:
dtoverlay=vc4-kms-kippah-7inch-overlay
dtoverlay=vc4-kms-v3d


Then, following 6by9 suggestion, i edited drivers/gpu/drm/panel/panel-simple.c
I've found yx700wv03 display and edited values with the correct ones of my display.

Code: Select all

static const struct drm_display_mode ontat_yx700wv03_mode = {
        .clock = 51200,
        .hdisplay = 1024,
        .hsync_start = 1024 + 160,
        .hsync_end = 1024 + 160 + 20,
        .htotal = 1344,
        .vdisplay = 600,
        .vsync_start = 600 + 12,
        .vsync_end = 600 + 12 + 3,
        .vtotal = 635,
        .vrefresh = 60,
        .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
};

static const struct panel_desc ontat_yx700wv03 = {
        .modes = &ontat_yx700wv03_mode,
        .num_modes = 1,
        .bpc = 8,
        .size = {
                .width = 154,
                .height = 86,
        },
        .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
};
I could have created a new entry instead of editing an existing one, but I was in a hurry.
I will create a dedicated entry soon.

Then I ran this scrip to compile the modfied module, load it and reboot the system
(You need kernel headers to properly compile the new module)

Code: Select all

#!/bin/bash
cd linux-raspberrypi-kernel_1.20190925-1/drivers/gpu/drm/panel/
make -C /lib/modules/`uname -r`/build M=$PWD
sudo rmmod panel_simple
sudo cp panel-simple.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/panel/panel-simple.ko
sudo insmod panel-simple.ko
sudo reboot
And that's all!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8082
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: [SOLVED] Rasberry CM3+ DPI (parallel) 7" touch screen with vc4 Opengl driver

Tue Dec 17, 2019 6:30 pm

Almost identical to

Code: Select all

static const struct drm_display_mode avic_tm070ddh03_mode = {
	.clock = 51200,
	.hdisplay = 1024,
	.hsync_start = 1024 + 160,
	.hsync_end = 1024 + 160 + 4,
	.htotal = 1024 + 160 + 4 + 156,
	.vdisplay = 600,
	.vsync_start = 600 + 17,
	.vsync_end = 600 + 17 + 1,
	.vtotal = 600 + 17 + 1 + 17,
	.vrefresh = 60,
};
(https://elixir.bootlin.com/linux/v5.4.3 ... ple.c#L922)
Yours has a shorter sync pulse and longer back porch.
It'd possible have needed tweaking for the negative H&V syncs - I can't find the code that sets the defaults for that (it's a bit for each of +ve and -ve syncs, so one of them should be set always).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Troubleshooting”