redrathnure / armbian-mkspi

Armbian Linux Build Framework
https://www.armbian.com
GNU General Public License v2.0
83 stars 13 forks source link

Need help with IPS50 configuration on MKS SKIPR #13

Open EmJay276 opened 1 year ago

EmJay276 commented 1 year ago

Hi,

has anyone gotten the IPS50 working? I am running Armbian_23.05.0-trunk_Mkspi_bullseye_edge_6.1.28.img which works perfectly with the MKS SKIPR. The touch is working fine (it is reacting to the input), I also have background light, but no image showing up.

Thanks in advance!

hg42 commented 7 months ago

@redrathnure thanks for the info, especially that wifi doesn't work with armbian_first_run.txt

With the standard armbian, I think it was something like the network manager not starting or the interface not hotplugging.

I know, I have the serial console, but for unknown reason the handshake does not work and I get a lot of "character salad" (that's what we say here). Not sure how this is possible with usb serial, but I couldn't solve it and didn't have motivation to investigate it further (at least at that time). Ethernet works most of the time (well not sure why it didn't for an hour, currently it's no problem).

redrathnure commented 7 months ago

Kinda overview what I done to make MKS IPS50 work.

  1. Connect display to Ubuntu laptop and check that a) it works, e.g. prove issues with cable or display itself and b) it works correctly, means all resolutions are detected correctly
  2. Dump EDID information using sudo get-edid | parse-edid command (we are still in full feature Ubuntu)
  3. load MKS PI image, ensuring that display is not detected, trying lot of combinations with kernel args, XOrg params, fbset commands ... and fail with all of them. BTW I used dmesg | grep HDMI command to ensure that kernel cannot configure display after it re connection .
  4. Gave up and hardcode needed resolutions and modes into kernel. Using EDID information taken from working Ubuntu.

After this display works fine even on the early boot/Armbian init stages. Also seems like connected HDMI screen has hiegier priorithy then TS35 one. And final observation that display(s) must be connected before OS boot.

redrathnure commented 7 months ago

I know, I have the serial console, but...

I would advice to connect board to laptop, install driver and check port configuration in Windows Device Manager and Putty connection settings (see my screens above). It's super handy especial when you have unstable WLAN and non standard HDMI screens from a random chines vendors :) (IMO)

hg42 commented 7 months ago

screens works with RPi

that was the configuration before I got the SKIPR, it was Pi3b + SKR1.3.

As I investigated later, the screen was 640x480 with this combination. You can see, that the fonts are rendered wider than they should.

hg42 commented 7 months ago

edid

I tried to compile an 800x480.bin and set it in armbianEnv.txt like this:

extraargs=video=drm.edid_firmware=800x480.bin LVDS-1:d video=HDMI-A-1:800x480e

I admit I don't have a clue how to set the various parameters. I tried to conclude them from a 102x768 file...

My result looks like this:

% edid-decode 800x480.bin
edid-decode (hex):

00 ff ff ff ff ff ff 00 31 d8 00 00 00 00 00 00
05 16 01 03 6d 1b 10 78 ea 5e c0 a4 59 4a 98 25
20 50 54 00 00 00 45 c0 01 01 01 01 01 01 01 01
01 01 01 01 01 01 ad 0b 20 c0 30 e0 11 10 08 58
23 00 15 a6 10 00 00 18 00 00 00 ff 00 4c 69 6e
75 78 20 23 30 0a 20 20 20 20 00 00 00 fd 00 3b
3d 1d 1f 03 00 0a 20 20 20 20 20 20 00 00 00 fc
00 4c 43 44 20 37 20 69 6e 63 68 0a 20 20 00 00

----------------

Block 0, Base EDID:
  EDID Structure Version & Revision: 1.3
  Vendor & Product Identification:
    Manufacturer: LNX
    Model: 0
    Made in: week 5 of 2012
  Basic Display Parameters & Features:
    Analog display
    Signal Level Standard: 0.700 : 0.000 : 0.700 V p-p
    Blank level equals black level
    Sync: Separate Composite Serration
    Maximum image size: 27 cm x 16 cm
    Gamma: 2.20
    DPMS levels: Standby Suspend Off
    RGB color display
    First detailed timing is the preferred timing
  Color Characteristics:
    Red  : 0.6416, 0.3486
    Green: 0.2919, 0.5957
    Blue : 0.1474, 0.1250
    White: 0.3125, 0.3281
  Established Timings I & II: none
  Standard Timings:
    GTF     :   800x450    59.999308 Hz  16:9     27.960 kHz     27.736000 MHz
  Detailed Timing Descriptors:
    DTD 1:   800x480    60.625852 Hz   5:3     30.131 kHz     29.890000 MHz (277 mm x 166 mm)
                 Hfront    8 Hsync  88 Hback   96 Hpol N
                 Vfront    2 Vsync   3 Vback   12 Vpol N
    Display Product Serial Number: 'Linux #0'
    Display Range Limits:
      Monitor ranges (GTF): 59-61 Hz V, 29-31 kHz H, max dotclock 30 MHz
    Display Product Name: 'LCD 7 inch'
Checksum: 0x00

this didn't change anything, but I'm not sure, if the file was used at all.

If you have such a file, can you post it here? Or the parameters (e.g. output from the decoder)?

hg42 commented 7 months ago

btw. I'm using Linux (though I have Windows somewhere on a laptop). I configured it like it's shown by MKS somewhere.

I never had handshake problems with usb serial... Though, usually it's a driver on the board that plays usb serial. I think SKIPR has a real UART connected to an usb serial adapter. But if the handshake doesn't work it must be between this adapter and the UART, so not on my side... that was the point where I abandoned the investigation.

redrathnure commented 7 months ago

EDIT from MKS IPS50 looks like:

➜  ~ cat /sys/class/drm/card0-HDMI-A-1/edid | parse-edid
Checksum Correct

Section "Monitor"
        Identifier "ANHUA"
        ModelName "ANHUA"
        VendorName "LTM"
        # Monitor Manufactured week 1 of 2015
        # EDID version 1.3
        # Digital Display
        # Display Physical Size not given. Normal for projectors.
        Gamma 2.20
        Option "DPMS" "false"
        Horizsync 26-81
        VertRefresh 24-75
        # Maximum pixel clock is 230MHz
        #Not giving standard mode: 1280x720, 60Hz
        #Not giving standard mode: 1280x800, 60Hz
        #Not giving standard mode: 1280x960, 60Hz
        #Not giving standard mode: 1280x1024, 60Hz
        #Not giving standard mode: 1440x900, 60Hz
        #Not giving standard mode: 1600x900, 60Hz
        #Not giving standard mode: 1600x1200, 60Hz
        #Not giving standard mode: 1920x1080, 60Hz

        #Extension block found. Parsing...
        Modeline        "Mode 2" 74.250 1280 1390 1420 1650 720 725 730 750 +hsync +vsync
        Modeline        "Mode 0" 30.24 800 850 950 960 480 510 513 525 +hsync +vsync
        Modeline        "Mode 1" 85.50 1360 1424 1536 1792 768 771 777 795 +hsync +vsync
        Modeline        "Mode 3" 74.250 1280 1720 1760 1980 720 725 730 750 +hsync +vsync
        Modeline        "Mode 4" 25.200 640 656 752 800 480 490 492 525 -hsync -vsync
        Modeline        "Mode 5" 27.027 720 736 798 858 480 489 495 525 -hsync -vsync
        Modeline        "Mode 6" 27.027 720 736 798 858 480 489 495 525 -hsync -vsync
        Modeline        "Mode 7" 27.000 720 732 796 864 576 581 586 625 -hsync -vsync
        Modeline        "Mode 8" 27.000 720 732 796 864 576 581 586 625 -hsync -vsync
        Modeline        "Mode 9" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
        Modeline        "Mode 10" 148.500 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
        Option "PreferredMode" "Mode 2"
EndSection

And I failed to create and use custom .bin file in Armbian too :(

hg42 commented 7 months ago

one of my problems is that I don't know how all these values are related to each others.

E.g. these defines in the assembly file and the fb.modes line that probably corresponds to it:

/*******************************************************************************
#   1024x768, 60 Hz, Non-Interlaced (65.00 MHz dotclock)
#
#               Horizontal  Vertical
#   Resolution      1024        768
#   Scan Frequency      48.363 kHz  60.00 Hz
#   Sync Width      2.092 us    0.124 ms
#               17 chars    6 lines
#   Front Porch     0.369 us    0.062 ms
#               3 chars     3 lines
#   Back Porch      2.462 us    0.601 ms
#               20 chars    29 lines
#   Active Time     15.754 us   15.880 ms
#               128 chars   768 lines
#   Blank Time      4.923 us    0.786 ms
#               40 chars    38 lines
#   Polarity        negative    negative
#

mode "1024x768-60"
    # D: 65.00 MHz, H: 48.363 kHz, V: 60.00 Hz
    geometry 1024 768 1024 768 8
    timings 15385 160 24 29 3 136 6
endmode
*/

#define CLOCK 65000 /* kHz */
#define XPIX 1024
#define YPIX 768
#define XY_RATIO XY_RATIO_4_3
#define XBLANK 320                      /* blank chars*8 */
#define YBLANK 38                       /* blank lines   */
#define XOFFSET 8
#define XPULSE 144                      /* ? sync chars * 8 + XOFFSET */
#define YOFFSET (63+3)                  /* ? 63 + front lines */
#define YPULSE (63+6)                   /* ? 63 + sync lines */
#define DPI 72
#define VFREQ 60 /* Hz */
#define TIMING_NAME "Linux XGA"
#define ESTABLISHED_TIMINGS_BITS 0x08 /* Bit 3 -> 1024x768 @60 Hz */
#define HSYNC_POL 0
#define VSYNC_POL 0
#define CRC 0x55

and the timings line in fb.modes also look ostly unrelated. even the values output by edid-decode from my generated edid bin does not relate directly to the defines I used.

If I look at your

Modeline "Mode 0" 30.24 800 850 950 960 480 510 513 525 +hsync +vsync

it at least relates directly to the DRM_MODE definition in your commit:

30240, 800, 850, 950, 960, 0, 480, 510, 513, 525, 0

The h and v values are increasing.

if these are positions of the video signal it would be like this:

800 is obvious    /* length of the content */
850 = 800 + 50    /* back porch? */
950 = 850 + 100   /* sync */
960 = 950 + 10    /* front porch? */

480 is vertical resolution
510 = 480 + 30
513 = 510 + 3
525 = 513 + 12

some conclusions and problems:

hg42 commented 7 months ago

btw. you defined 5:3 in the commit...

in edid.S I see:

/* EDID 1.3 standard definitions */
#define XY_RATIO_16_10  0b00
#define XY_RATIO_4_3    0b01
#define XY_RATIO_5_4    0b10
#define XY_RATIO_16_9   0b11

it looks like there are only two bits for this.

it seems that this is not defined in edid 1.3, maybe this doesn't work in some situations? Though internally, it might work. As long as it's not handled like edid.

Did you check that the IPS50 really gets 800x480 and not another resolution? I think fbset should show the mode. I'm asking because my Pi3 looked totally fine (and I read all the time, that it works out of the box), but in reality it had 640x480 and my display scaled it. Though your image doesn't look stretched. However, if it's 848x480 it also looks correct. But the native resolution looks a bit sharper.

hg42 commented 7 months ago

ok wxedid software helps