Jump to content

Orange PI PC Plus - HDMI resolution for chineese 5 inch LCD


Jarek

Recommended Posts

Armbianmonitor:

Hello,

 

I am new to Orange PI and Armbian. I try to configure orange pi to run chineese LCD 5 inch screen via HDMI.

I managed to do that using lubuntu downloaded from orangepi server.

I changed fex file to what I found on the internet:

 

[clock]
pll_video = 321

 

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 3
screen0_output_mode = 2
screen1_output_type = 3
screen1_output_mode = 2
fb0_width = 720
fb0_height = 480
fb0_scaler_mode_enable = 1
fb0_pixel_sequence = 2
fb0_format = 4
fb0_framebuffer_num = 2
fb1_width = 720
fb1_height = 480
fb1_scaler_mode_enable = 1
fb1_pixel_sequence = 2
fb1_format = 4
fb1_framebuffer_num = 2

 

[hdmi_para]
hdmi_used = 1
hdmi_x = 720
hdmi_y = 480
hdmi_power = "vcc-hdmi-18"
hdmi_cts_compatibility = 1

 

 

After positve tests I wstiched to Armbian 5.72 kernel 4.18.17-sunxi.

Generaly I could not find on the inter / googled/ searched thru armbian formu waht should I do to recofigure sam as in fex files.

What I understad new kernels does not support fex files any more.

Is there any way to change HDMI cofig simillar way as in fex files?

Currently I try to recompile kernel (never did that before) I also changed orangepipcplus.fex file which i found in armbian git repository.

 

I would appreciate any help or links.

 

Thanks!

 

 

Link to comment
Share on other sites

On 2/2/2019 at 4:28 PM, Jarek said:

Is there any way to change HDMI cofig simillar way as in fex files?

There is no need to do that on mainline based images (you posted 4.19, which qualifies for that). Display should be configured properly automatically. If not, then there is a bug either in the HDMI/display driver or in EDID data stored in your screen.

 

That said, there was one HDMI bug which was fixed in 4.20. In short, some resolutions didn't work.

Link to comment
Share on other sites

Yes I found EDID data are corrupted.

I tried to get proper EDID by your customized u-boot: https://github.com/jernejsk/u-boot

Using uart debug I got:

 

HDMI connected: EDID block 0: checksum error, retrying
EDID block 0: checksum error, retrying
EDID block 0: checksum error

 

But I found a solution and will try to preapre patch. I am completly new to such thinkgs so it will take some time. Also my C++ is kind of basic-moderate...

I also noticed that u-boot is switching to 1024x768 in sunxi_display.c:

 

video_get_ctfb_res_modes(RES_MODE_1024x768, 24, &mode,
                 &sunxi_display.depth, &options);

 

so I changed 1024x768 to 800x600 - this resolution I used as guided here: https://www.instructables.com/id/Orange-PI-HowTo-Set-It-Up-to-Use-With-a-5-HDMI-TFT/

and corrected in videomodes.c :

 

#ifndef CONFIG_VIDEO_STD_TIMINGS
    { 640,  480, 60, 39721,  25180,  40,  24, 32, 11,  96, 2, 0, FB_VMODE_NONINTERLACED},
    { 800,  600, 60, 27778,  36000,  64,  24, 22,  1,  72, 2, 0, FB_VMODE_NONINTERLACED},
    {1024,  768, 60, 15384,  65000, 168,   8, 29,  3, 144, 4, 0, FB_VMODE_NONINTERLACED},
    { 960,  720, 80, 13100,  76335, 160,  40, 32,  8,  80, 4, 0, FB_VMODE_NONINTERLACED},
    {1152,  864, 60, 12004,  83300, 200,  64, 32, 16,  80, 4, 0, FB_VMODE_NONINTERLACED},
    {1280, 1024, 60,  9090, 110000, 200,  48, 26,  1, 184, 3, 0, FB_VMODE_NONINTERLACED},

 

line:

    { 800,  600, 60, 27778,  36000,  64,  24, 22,  1,  72, 2, 0, FB_VMODE_NONINTERLACED},

to

    { 800,  600, 60, 32100,  36000,  64,  24, 22,  1,  72, 2, 0, FB_VMODE_NONINTERLACED},
 

27778 I figured out from the rest of u-boot code is my PLL so I changed to 32100 (321 is PLL from fex file)

 

LCD started to work.

 

I assume that good way is to prepare patch and recompile all and than install by dpkg. So if someone wants to patch just do or not.

 

Let me know if this is good way.

 

Thanks

Jarek

 

Link to comment
Share on other sites

I tried to apply my changes to latest armbian build (https://github.com/armbian/build)

No sucess...

 

Patch content:

 

diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
index 6dd9bec..7f84335 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -1091,7 +1091,7 @@ void *video_hw_init(void)
 
     memset(&sunxi_display, 0, sizeof(struct sunxi_display));
 
-    video_get_ctfb_res_modes(RES_MODE_1024x768, 24, &mode,
+    video_get_ctfb_res_modes(RES_MODE_800x480, 24, &mode,
                  &sunxi_display.depth, &options);
 #ifdef CONFIG_VIDEO_HDMI
     hpd = video_get_option_int(options, "hpd", 1);
@@ -1121,12 +1121,12 @@ void *video_hw_init(void)
         ret = sunxi_hdmi_hpd_detect(hpd_delay);
         if (ret) {
             printf("HDMI connected: ");
-            if (edid && sunxi_hdmi_edid_get_mode(&custom) == 0) {
-                if ((custom.xres <= 1920) && (custom.yres <= 1080))
-                    mode = &custom;
-                else
-                    mode = &res_mode_init[RES_MODE_1920x1080];
-            }
+            if (edid && sunxi_hdmi_edid_get_mode(&custom) == 0) {
+                if ((custom.xres <= 1920) && (custom.yres <= 1080))
+                    mode = &custom;
+                else
+                    mode = &res_mode_init[RES_MODE_800x480];
+            }
         } else if (hpd) {
             sunxi_hdmi_shutdown();
             sunxi_display.monitor = sunxi_get_default_mon(false);
diff --git a/drivers/video/videomodes.c b/drivers/video/videomodes.c
index 74bafff..6f494f7 100644
--- a/drivers/video/videomodes.c
+++ b/drivers/video/videomodes.c
@@ -83,6 +83,10 @@ const struct ctfb_vesa_modes vesa_modes[VESA_MODES_COUNT] = {
     {0x319, RES_MODE_1280x1024, 15},
     {0x31A, RES_MODE_1280x1024, 16},
     {0x31B, RES_MODE_1280x1024, 24},
+        {0x303, RES_MODE_800x480, 8},
+        {0x313, RES_MODE_800x480, 15},
+        {0x314, RES_MODE_800x480, 16},
+        {0x315, RES_MODE_800x480, 24},
 };
 const struct ctfb_res_modes res_mode_init[RES_MODES_COUNT] = {
     /*  x     y  hz  pixclk ps/kHz   le   ri  up  lo   hs vs  s  vmode */
@@ -105,6 +109,7 @@ const struct ctfb_res_modes res_mode_init[RES_MODES_COUNT] = {
     {1360,  768, 60, 11696,  85500, 256,  64, 17,  3, 112, 7, 0, FB_VMODE_NONINTERLACED},
     {1920, 1080, 60,  6734, 148500, 148,  88, 36,  4,  44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED},
     {1920, 1200, 60,  6494, 154000,  80,  48, 26,  3,  32, 6, FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED},
+        { 800,  480, 60, 32100,  36000,  64,  24, 22,  1,  72, 2, 0, FB_VMODE_NONINTERLACED},
 };
 
 /************************************************************************
diff --git a/drivers/video/videomodes.h b/drivers/video/videomodes.h
index 29a3db4..bc22b1a 100644
--- a/drivers/video/videomodes.h
+++ b/drivers/video/videomodes.h
@@ -68,9 +68,10 @@ struct ctfb_vesa_modes {
 #define RES_MODE_1360x768    7
 #define RES_MODE_1920x1080    8
 #define RES_MODE_1920x1200    9
-#define RES_MODES_COUNT        10
+#define RES_MODE_800x480    10
+#define RES_MODES_COUNT        11
 
-#define VESA_MODES_COUNT 19
+#define VESA_MODES_COUNT 23
 
 extern const struct ctfb_vesa_modes vesa_modes[];
 extern const struct ctfb_res_modes res_mode_init[];

 

 

I put it into userpatches/u-boot/u-boot-sunxi

 

It seems during compilation process it is applied but cannot see any changes after istalling deb packages.

Also I can not see any output information considering HDMI via UART during boot.

It seems to me that the code of sunxi_display.c (/divers/video/sunxi  of u-boot) is not enabled and I do not know how to fix it.

The code I mean is:

 

ifdef CONFIG_VIDEO_HDMI
    /* If HDMI/DVI is selected do HPD & EDID, and handle fallback */
    if (sunxi_display.monitor == sunxi_monitor_dvi ||
        sunxi_display.monitor == sunxi_monitor_hdmi) {
        /* Always call hdp_detect, as it also enables clocks, etc. */
        ret = sunxi_hdmi_hpd_detect(hpd_delay);
        if (ret) {
            printf("HDMI connected: ");
            if (edid && sunxi_hdmi_edid_get_mode(&custom) == 0) {
                if ((custom.xres <= 1920) && (custom.yres <= 1080))
                    mode = &custom;
                else
                    mode = &res_mode_init[RES_MODE_800x480];
            }
        } else if (hpd) {
            sunxi_hdmi_shutdown();
            sunxi_display.monitor = sunxi_get_default_mon(false);
        } /* else continue with hdmi/dvi without a cable connected */
    }
#endif

 

I do not know where shoud I put CONFIG_VIDEO_HDMI to enable code.

The mass of codes kills me...

 

Appreciate any help ...

 

Thanks

Jarek

 

 

Link to comment
Share on other sites

Then U-Boot doesn't have anything to do with your Linux display issues. Linux driver re-initializes all peripherals responsible for video output. There are 2 possible solutions:

1. disable display driver in U-Boot (there are some handover issues, which might prevent Linux driver from working correctly)

2. backport clock patches from 4.20 or use 4.20 (there was a bug which prevented correct initialization for some resolutions)

 

Possibly you have to do both...

Link to comment
Share on other sites

On 2/8/2019 at 7:19 AM, jernej said:

Then U-Boot doesn't have anything to do with your Linux display issues. Linux driver re-initializes all peripherals responsible for video output. There are 2 possible solutions:

1. disable display driver in U-Boot (there are some handover issues, which might prevent Linux driver from working correctly)

2. backport clock patches from 4.20 or use 4.20 (there was a bug which prevented correct initialization for some resolutions)

 

Possibly you have to do both...

I switched to 4.20. I tried many different options with no luck.

I also prepared new .bin file -> following /documentation/EDID with no luck.

I just can't believe that it is so hard to change that pixelclock from 27000 to 32100 (screen is 800x480 and it works with 66Hz). It is just one number that worked good using fex files...

I'm completly disappointed :)

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines