JamesK
September 26, 2023, 3:00pm
#1
Which Khadas SBC do you use?
KVIM3
Which system do you use? Android, Ubuntu, OOWOW or others?
Ubuntu Focal / Gnome
Which version of system do you use? Khadas official images, self built images, or others?
Fenix Linux 4.9
Please describe your issue below:
Good Afternoon,
I have been developing support for the 480x480 touch display (Model E40RC-FS1000) on Linux 4.9 built with Fenix. I have already designed FPC and backlight PCB for this panel and confirmed they are working. My approach is to use the TS080 driver but modify it to my needs. I have modified the DTS and made the kernel always use lcd-0 and always enable backlight. Both are working, but the image comes across garbled. Could this be something in the DTS or something else like screen resolution?The DTS entry is below:
Post a console log of your issue below:
khadas-ts050-panel.dtsi
lcd_0{
model_name = "TS050";
interface = "mipi";
basic_setting = <480 480 /*h_active, v_active was 488 484*/
548 514
/*h_period [548], v_period [514]*/
8 /*lcd_bits*/
80 77>; /*screen_width, screen_height 80 77*/
lcd_timing = <8 50 0 /*hs_width,hs_bp,hs_pol*/
4 20 0>; /*vs_width,vs_bp,vs_pol*/
clk_attr = <0 /*fr_adj_type(0=clock,1=htotal,2=vtotal)*/
0 /*clk_ss_level*/
1 /*clk_auto_generate*/
17000000>; /*pixel_clk(unit in Hz) was 120000000 [16900320=Vp*Hp*60]*/
mipi_attr = <2 /*lane_num*/
1000 /*bit_rate_max(MHz) was 1000 [56.666=17/0.3]*/
0 /*factor(*100, default 0 for auto)*/
1 /*operation_mode_init(0=video, 1=command)*/
0 /*operation_mode_display(0=video, 1=command)*/
2 /*
*video_mode_type
*(0=sync_pulse,1=sync_event,2=burst)
*/
1 /*clk_always_hs(0=disable,1=enable)*/
0>; /*phy_switch(0=auto,1=standard,2=slow)*/
/* dsi_init: data_type, num, data... */
dsi_init_on = <
0x05 0x01 0x11
0xfd 0x01 120 /* delay 120ms */
0x05 0x01 0x23 /* White Flash */
0xfd 0x01 120 /* delay 120ms */
0x05 0x01 0x13 /*Nor On*/
0x39 0x06 0xFF 0x77 0x01 0x00 0x00 0x10
0x39 0x03 0xC0 0x3B 0x00
0x39 0x03 0xC1 0x0D 0x02 /* Porch Ctrl */
0x39 0x03 0xC2 0x37 0x05
0x39 0x11 0xB0 0x00 0x11 0x18 0x0E 0x11 0x06 0x07 0x08 0x07 0x22 0x04 0x12 0x0F 0xAA 0x31 0x18
0x39 0x11 0xB1 0x00 0x11 0x19 0x0E 0x12 0x07 0x08 0x08 0x08 0x22 0x04 0x11 0x11 0xA9 0x32 0x18
0x39 0x06 0xFF 0x77 0x01 0x00 0x00 0x11
0x15 0x02 0xB0 0x60
0x15 0x02 0xB1 0x26
0x15 0x02 0xB2 0x07
/*0x15 0x02 0xB3 0x80*/
0x15 0x02 0xB5 0x49
0x15 0x02 0xB7 0x85
0x15 0x02 0xB8 0x21
0x15 0x02 0xC1 0x78
0x15 0x02 0xC2 0x78
0x39 0x04 0xE0 0x00 0x1B 0x02
0x39 0x0C 0xE1 0x08 0xA0 0x00 0x00 0x07 0xA0 0x00 0x00 0x00 0x44 0x44
0x39 0x0D 0xE2 0x11 0x11 0x44 0x44 0xED 0xA0 0x00 0x00 0xEC 0xA0 0x00 0x00
0x39 0x05 0xE3 0x00 0x00 0x11 0x11
0x39 0x03 0xE4 0x44 0x44
0x39 0x11 0xE5 0x0A 0xE9 0xD8 0xA0 0x0C 0xEB 0xD8 0xA0 0x0E 0xED 0xD8 0xA0 0x10 0xEF 0xD8 0xA0
0x39 0x05 0xE6 0x00 0x00 0x11 0x11
0x39 0x03 0xE7 0x44 0x44
0x39 0x11 0xE8 0x09 0xE8 0xD8 0xA0 0x0B 0xEA 0xD8 0xA0 0x0D 0xEC 0xD8 0xA0 0x0F 0xEE 0xD8 0xA0
0x39 0x08 0xEB 0x02 0x00 0xE4 0xE4 0x88 0x00 0x40
0x39 0x03 0xEC 0x3C 0x00
0x39 0x11 0xED 0xAB 0x89 0x76 0x54 0x02 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x20 0x45 0x67 0x98 0xBA
0x39 0x06 0xFF 0x77 0x01 0x00 0x00 0x13
0x15 0x02 0xE5 0xE4
0x39 0x06 0xFF 0x77 0x01 0x00 0x00 0x00
0x15 0x02 0x36 0x00
0x15 0x02 0x3A 0x70
0x05 0x01 0x29
0xfd 0x01 25 /* delay 25ms */
0xFF 0>; /*ending*/
The result is a shifted / chopped ubuntu login screen:
Any ideas on what could be causing this?
Thanks in advance.
JamesK
October 11, 2023, 3:37pm
#2
I have since changed the bit rate to 202 MHz as recommended here and the image displayed is still the same. What else could be causing this? All settings are set according to the manufacturer.
JamesK
October 12, 2023, 2:20pm
#3
Update: the xrandr output is the following. This leads me to believe the screen resolution in Wayland is set incorrect for some reason. How can I change it to 480x480?
$ xrandr
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 310mm x 170mm
1920x1080 143.80*+
1440x1080 143.80
1400x1050 143.89
1280x1024 143.79
1280x960 143.86
1152x864 143.75
1024x768 143.66
800x600 143.83
640x480 143.85
320x240 142.05
1680x1050 143.88
1440x900 143.86
1280x800 143.67
720x480 143.85
640x400 143.37
320x200 141.40
1600x900 143.93
1368x768 143.77
1280x720 143.67
1024x576 143.91
864x486 143.63
720x400 143.29
640x350 143.57
I think Wayland does not support 480x480 resolution.
numbqq
October 16, 2023, 1:30pm
#4
Hello @JamesK
Maybe you also need to change the MIPI screen resolution here /etc/initramfs-tools/scripts/local-top/khadas_init.sh
and /usr/local/bin/panel_setup.sh
.
Then regenerate the initramfs.
sudo update-initramfs -u
sync
sudo reboot
JamesK
October 16, 2023, 3:33pm
#5
@numbqq Thank you for this info. I edited these files and showed some improvement, but the image is still skewed on the display. At least the 480x480 display is now detected. Here is a screenshot of the VNC session and a picture of what is actually on the screen.
And here is what the display is supposed to be showing:
Adding my config:
if [ $panel_exist -eq 1 ] && [ $display_device = panel ]; then
#echo null > /sys/class/display/mode
echo panel > /sys/class/display/mode
if [ $panel_type = lcd_2 ]; then
fbset -fb /dev/fb0 -g 1920 1200 1920 2400 32
echo "0 0 1919 1119" > /sys/class/graphics/fb0/free_scale_axis
echo "0 0 1919 1119" > /sys/class/graphics/fb0/window_axis
else
fbset -fb /dev/fb0 -g 480 480 548 514 32
echo "0 0 548 514" > /sys/class/graphics/fb0/free_scale_axis
echo "0 0 548 514" > /sys/class/graphics/fb0/window_axis
fi
echo 0 > /sys/class/graphics/fb0/free_scale
echo 1 > /sys/class/graphics/fb0/freescale_mode
fi
I assumed the syntax, but where is the V/H period and what is 32?
numbqq
October 17, 2023, 2:55am
#6
Can you try this ?
if [ $panel_exist -eq 1 ] && [ $display_device = panel ]; then
#echo null > /sys/class/display/mode
echo panel > /sys/class/display/mode
if [ $panel_type = lcd_2 ]; then
fbset -fb /dev/fb0 -g 1920 1200 1920 2400 32
echo "0 0 1919 1119" > /sys/class/graphics/fb0/free_scale_axis
echo "0 0 1919 1119" > /sys/class/graphics/fb0/window_axis
else
fbset -fb /dev/fb0 -g 480 480 480 960 32
echo "0 0 479 479" > /sys/class/graphics/fb0/free_scale_axis
echo "0 0 479 479" > /sys/class/graphics/fb0/window_axis
fi
echo 0 > /sys/class/graphics/fb0/free_scale
echo 1 > /sys/class/graphics/fb0/freescale_mode
fi
2 Likes
JamesK
October 17, 2023, 12:15pm
#7
@numbqq you’re amazing! This fixed the issue and the screen works perfect now.
Just curious, what are the significance of those numbers? 479 479 960? Thanks again!
1 Like
JamesK
October 17, 2023, 10:16pm
#8
I am now working on touch and I believe there is the same resolution issue for touch. Do you know where the config for the GT911 driver is? See below output:
alakai_admin@ARG-OS:/lib/modules/4.9.241$ sudo dmesg | grep GT9
[ 1.078852] <<-GT9XX-INFO->> GTP Driver Version: V2.4.0.1<2016/10/26>
[ 1.078854] <<-GT9XX-INFO->> GTP I2C Address: 0x5d
[ 1.080553] <<-GT9XX-INFO->> IC Version: 911_1060
[ 1.082716] <<-GT9XX-INFO->> Sensor_ID: 0
[ 1.082720] <<-GT9XX-INFO->> Config group0 used,length: 186
[ 1.083802] <<-GT9XX-INFO->> Driver send config.
[ 1.106067] <<-GT9XX-INFO->> X_MAX: 1920, Y_MAX: 1200, TRIGGER: 0x01
[ 1.124977] <<-GT9XX-INFO->> create proc entry gt9xx_config success
[ 1.124979] <<-GT9XX-INFO->> Esd started
[ 1.125174] <<-GT9XX-INFO->> Request input device for pen/stylus.
[ 1.125305] <<-GT9XX-ERROR->> Request IRQ failed!ERRNO:-22.
[ 1.125308] <<-GT9XX-INFO->> GTP works in polling mode.
[ 1.125311] <<-GT9XX-INFO->> Applied memory size:2562.
[ 1.125313] <<-GT9XX-INFO->> I2C function: without pre and end cmd!
[ 1.125320] <<-GT9XX-INFO->> Create proc entry success!
[ 2.611309] <<-GT9XX-INFO->> System resume.
[ 2.611311] <<-GT9XX-INFO->> Powerkey wakeup.
[ 2.611314] <<-GT9XX-INFO->> Guitar reset
[ 2.717961] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 2.717963] <<-GT9XX-INFO->> Driver send config.
[ 8.137866] <<-GT9XX-INFO->> System resume.
[ 8.137869] <<-GT9XX-INFO->> Powerkey wakeup.
[ 8.137872] <<-GT9XX-INFO->> Guitar reset
[ 8.247372] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 8.247373] <<-GT9XX-INFO->> Driver send config.
[ 9.331709] <<-GT9XX-INFO->> System resume.
[ 9.331711] <<-GT9XX-INFO->> Powerkey wakeup.
[ 9.331715] <<-GT9XX-INFO->> Guitar reset
[ 9.438170] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 9.438173] <<-GT9XX-INFO->> Driver send config.
[ 17.121843] <<-GT9XX-INFO->> System resume.
[ 17.121844] <<-GT9XX-INFO->> Powerkey wakeup.
[ 17.121846] <<-GT9XX-INFO->> Guitar reset
[ 17.234497] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 17.234500] <<-GT9XX-INFO->> Driver send config.
alakai_admin@ARG-OS:/lib/modules/4.9.241$ i2cdetect -y 3
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
alakai_admin@ARG-OS:/lib/modules/4.9.241$
numbqq
October 18, 2023, 1:13am
#9
It is the fb size.
You can check the driver here:
JamesK
October 18, 2023, 3:27pm
#10
It looks like the driver is generic and gets it’s X_MAX and Y_MAX values from a config file somewhere. It’s set to 1920x1200 but I need to change it to 480x480. At least the driver isn’t crashing anymore:
$ sudo dmesg | grep GT9
[ 1.074778] <<-GT9XX-INFO->> GTP Driver Version: V2.4.0.1<2016/10/26>
[ 1.074780] <<-GT9XX-INFO->> GTP I2C Address: 0x5d
[ 1.076473] <<-GT9XX-INFO->> IC Version: 911_1060
[ 1.078594] <<-GT9XX-INFO->> Sensor_ID: 0
[ 1.078597] <<-GT9XX-INFO->> Config group0 used,length: 186
[ 1.079658] <<-GT9XX-INFO->> Driver send config.
[ 1.101936] <<-GT9XX-INFO->> X_MAX: 1920, Y_MAX: 1200, TRIGGER: 0x01
[ 1.121467] <<-GT9XX-INFO->> create proc entry gt9xx_config success
[ 1.121469] <<-GT9XX-INFO->> Esd started
[ 1.121671] <<-GT9XX-INFO->> Request input device for pen/stylus.
[ 1.121802] <<-GT9XX-ERROR->> Request IRQ failed!ERRNO:-22.
[ 1.121804] <<-GT9XX-INFO->> GTP works in polling mode.
[ 1.121807] <<-GT9XX-INFO->> Applied memory size:2562.
[ 1.121810] <<-GT9XX-INFO->> I2C function: without pre and end cmd!
[ 1.121816] <<-GT9XX-INFO->> Create proc entry success!
[ 2.566264] <<-GT9XX-INFO->> System resume.
[ 2.566266] <<-GT9XX-INFO->> Powerkey wakeup.
[ 2.566269] <<-GT9XX-INFO->> Guitar reset
[ 2.674433] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 2.674435] <<-GT9XX-INFO->> Driver send config.
[ 14.076348] <<-GT9XX-INFO->> System resume.
[ 14.076351] <<-GT9XX-INFO->> Powerkey wakeup.
[ 14.076355] <<-GT9XX-INFO->> Guitar reset
[ 14.184688] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 14.184690] <<-GT9XX-INFO->> Driver send config.
[ 22.512780] <<-GT9XX-INFO->> System resume.
[ 22.512781] <<-GT9XX-INFO->> Powerkey wakeup.
[ 22.512783] <<-GT9XX-INFO->> Guitar reset
[ 22.622427] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 22.622430] <<-GT9XX-INFO->> Driver send config.
[ 169.038872] <<-GT9XX-INFO->> System resume.
[ 169.038874] <<-GT9XX-INFO->> Powerkey wakeup.
[ 169.038876] <<-GT9XX-INFO->> Guitar reset
[ 169.147403] <<-GT9XX-INFO->> GTP wakeup sleep.
[ 169.147406] <<-GT9XX-INFO->> Driver send config.
The touch screen is recognized, but the mapping is all wrong. Touching a certain area makes the cursor go in another random place.
numbqq
October 19, 2023, 6:33am
#11
Hello @JamesK
About the resolution, you can try to enable GTP_CUSTOM_CFG
and setup your resolution.
JamesK
October 23, 2023, 12:58pm
#12
@numbqq I set GTP_CUSTOM_CFG = 1 and changed the resolution in gt9xx.h as seen below:
// STEP_3(optional): Specify your special config info if needed
#if GTP_CUSTOM_CFG
#define GTP_MAX_HEIGHT 480
#define GTP_MAX_WIDTH 480
#define GTP_INT_TRIGGER 0 // 0: Rising 1: Falling
#else
#define GTP_MAX_HEIGHT 480
#define GTP_MAX_WIDTH 480
#define GTP_INT_TRIGGER 1
#endif
#define GTP_MAX_TOUCH 10
I also disabled sending firmware and config which stopped some errors, but the dmesg output still says 1920x1200:
$ sudo dmesg | grep GT9
[ 1.078823] <<-GT9XX-INFO->> GTP Driver Version: V2.4.0.1<2016/10/26>
[ 1.078825] <<-GT9XX-INFO->> GTP I2C Address: 0x5d
[ 1.080522] <<-GT9XX-INFO->> IC Version: 911_1060
[ 1.102903] <<-GT9XX-INFO->> X_MAX: 1920, Y_MAX: 1200, TRIGGER: 0x01
[ 1.125635] <<-GT9XX-INFO->> create proc entry gt9xx_config success
[ 1.125637] <<-GT9XX-INFO->> Esd started
[ 1.125828] <<-GT9XX-INFO->> Request input device for pen/stylus.
[ 1.125960] <<-GT9XX-ERROR->> Request IRQ failed!ERRNO:-22.
[ 1.125963] <<-GT9XX-INFO->> GTP works in polling mode.
[ 1.125966] <<-GT9XX-INFO->> Applied memory size:2562.
[ 1.125969] <<-GT9XX-INFO->> I2C function: without pre and end cmd!
[ 1.125975] <<-GT9XX-INFO->> Create proc entry success!
[ 2.584482] <<-GT9XX-INFO->> System resume.
[ 2.598264] <<-GT9XX-INFO->> GTP wakeup sleep.
numbqq
October 24, 2023, 2:00am
#13
Hello @JamesK
Maybe you need to dig into the TP driver and add some debug information to find what’s going wrong.
1 Like
JamesK
October 30, 2023, 9:39pm
#14
I reset the GT9XX driver to khadas code and updated CFG with vendor provided bytes. Enabled extra debugging and now the resolution is correct. The touch is inaccurate on the bottom half of the screen (MAX_Y I can read is 256 and should be 480) but the X axis is correct. Touch works “perfectly” on the top half of the screen though. Any idea how to calibrate this in the driver?
$ sudo dmesg | grep GT911
[ 1.079315] <<-GT911-INFO->> GTP Driver Version: V2.4.0.1<2016/10/26>
[ 1.079317] <<-GT911-INFO->> GTP I2C Address: 0x5d
[ 1.081043] <<-GT911-INFO->> IC Version: 911_1060
[ 1.083217] <<-GT911-INFO->> Sensor_ID: 0
[ 1.083222] <<-GT911-INFO->> Config group0 used,length: 186
[ 1.084308] <<-GT911-INFO->> Driver send config.
[ 1.106573] <<-GT911-INFO->> X_MAX: 480, Y_MAX: 480, TRIGGER: 0x00
[ 1.125254] <<-GT911-INFO->> create proc entry gt9xx_config success
[ 1.125256] <<-GT911-INFO->> Esd started
[ 1.125453] <<-GT911-ERROR->> Request IRQ failed!ERRNO:-22.
[ 1.125455] <<-GT911-INFO->> GTP works in polling mode.
[ 1.125458] <<-GT911-INFO->> Applied memory size:2562.
[ 1.125461] <<-GT911-INFO->> I2C function: without pre and end cmd!
[ 1.125466] <<-GT911-INFO->> Create proc entry success!
[ 2.578081] <<-GT911-INFO->> System resume.
[ 2.578082] <<-GT911-INFO->> Powerkey wakeup.
[ 2.578085] <<-GT911-INFO->> Guitar reset
[ 2.588415] <<-GT911-ERROR->> I2C Read: 0x814E, 10 bytes failed, errcode: -6! Process reset.
[ 2.588416] <<-GT911-INFO->> Guitar reset
[ 2.686217] <<-GT911-INFO->> GTP wakeup sleep.
[ 2.686219] <<-GT911-INFO->> Driver send config.
[ 2.709116] <<-GT911-ERROR->> I2C transfer error. errno:-6
[ 8.239006] <<-GT911-INFO->> System resume.
[ 8.239008] <<-GT911-INFO->> Powerkey wakeup.
[ 8.239011] <<-GT911-INFO->> Guitar reset
[ 8.248725] <<-GT911-ERROR->> I2C Read: 0x814E, 10 bytes failed, errcode: -6! Process reset.
[ 8.248727] <<-GT911-INFO->> Guitar reset
[ 8.346272] <<-GT911-INFO->> GTP wakeup sleep.
[ 8.346274] <<-GT911-INFO->> Driver send config.
[ 8.369177] <<-GT911-ERROR->> I2C transfer error. errno:-6
[ 15.879960] <<-GT911-INFO->> System resume.
[ 15.879961] <<-GT911-INFO->> Powerkey wakeup.
[ 15.879962] <<-GT911-INFO->> Guitar reset
[ 15.882212] <<-GT911-ERROR->> I2C Read: 0x814E, 10 bytes failed, errcode: -6! Process reset.
[ 15.882214] <<-GT911-INFO->> Guitar reset
[ 15.990506] <<-GT911-ERROR->> I2C transfer error. errno:-6
[ 15.991300] <<-GT911-INFO->> GTP wakeup sleep.
[ 15.991302] <<-GT911-INFO->> Driver send config.
[ 30.482397] <<-GT911-INFO->> System resume.
[ 30.482399] <<-GT911-INFO->> Powerkey wakeup.
[ 30.482402] <<-GT911-INFO->> Guitar reset
[ 30.493261] <<-GT911-ERROR->> I2C Read: 0x814E, 10 bytes failed, errcode: -6! Process reset.
[ 30.493263] <<-GT911-INFO->> Guitar reset
[ 30.600421] <<-GT911-INFO->> GTP wakeup sleep.
[ 30.600422] <<-GT911-INFO->> Driver send config.
[ 30.623915] <<-GT911-ERROR->> I2C transfer error. errno:-6
Even with all these errors, the driver can now read xy coordinates and register touch, so some progress has been made. xinput_calibrator doesn’t seem to help getting the touch to be accurate and the vendor provided .c and .h files won’t compile.