Skip to content
Home » System On Modules » How to completely port the RK3588 development board MIPI DSI?

How to completely port the RK3588 development board MIPI DSI?

Neardi LKD3588-Android 11 ​​porting MIPI DSI display (ATK-MIPI-720p)

Hardware information: Neardi LCB3588, ATK-5.5-inch MIPI screen (720*1280)

Adapt to ATK-MIPI-720p screen display

1. MIPI interface of LKD3588 development board

Neardi’s LKD3588 development board displays interfaces HDMI1.4, HDMI2.0, dual-channel LVDS, and DP, and does not bring out the MIPI interface. However, the RK3588 chip has a MIPI signal interface. Looking at the schematic diagram of Neardi LKD3588, there are two MIPI-D-Phy outputs, but Neardi converts them to LVDS and HDMI interfaces. Next, MIPI_DPHY1_TX is brought out and adapted to the 720PMIPI screen of Zhengdian Atom:

this is neardi operating develop code tutorial screenshots 1

MIPI_DPHY1_TX signal is converted to HDMI signal. For convenience, modify it directly in the Neardi-3588-SDK-Android-V2.0/kernel-5.10/arch/arm64/boot/dts/rockchip/rk3588-neardi-android-ld160-mipi2hdmi.dtsi device tree file. Before modifying, check the MIPI screen related information.

2. MIPI screen hardware schematic diagram

The MIPI screen used has two interfaces (4Lane and 2Lane), and the 4Lane interface is used here.

this is neardi operating develop code tutorial screenshots 2

3. MIPI screen driver debugging

There are three main parts to debugging the MIPI screen:
1) Screen backlight debugging, this is the first thing to do. If the backlight is not bright, nothing can be seen on the screen. This is relatively simple and belongs to PWM related knowledge. How to debug the backlight will also be explained later.
2) Send an initialization sequence to the screen.
3) Debug the DPI parameters of the screen. Finally, you need to debug the DPI parameters of the MIPI screen, that is, HBP, HFP, VBP, VFP and other parameters.

3.1.1. PWM

The screen backlight is controlled by PWM, and the screen brightness is adjusted by the PWM waveform. In the interface diagram, Pin7 (LCD_BL) is used to control the backlight. Since the MIPI interface is not brought out on the LKD3588, there is naturally no related pin configuration. Since the PWM7 pin of the LKD3588 is brought out, we directly use PWM7 (PWM7_M3_GPIO4_C6_d_IO3_1V8) to control the backlight, and connect GPIO4_C6 to the LCD_BL pin of the MIPI screen.

GPIO4_C6 pinctrl configuration, find the following in rk3588s-pinctrl.dtsi or rk3588-vccio3-pinctrl.dtsi:

1.pwm7 {
2./omit-if-no-ref/
3.pwm7m3_pins: pwm7m3-pins {
4.rockchip,pins =
5./* pwm7_ir_m3 */
6.<4 RK_PC6 11 &pcfg_pull_none>;
7.};
8.};

Then append the following to pwm7 in rk3588-neardi-android-ld160-mipi2hdmi.dtsi:

1.pwm7: pwm@febd0030 {
2.compatible = “rockchip,rk3588-pwm”, “rockchip,rk3328-pwm”;
3.reg = <0x0 0xfebd0030 0x0 0x10>;
4.#pwm-cells = <3>;
5.pinctrl-names = “active”;
6.pinctrl-0 = <&pwm7m3_pins>; // Use the configuration in rk3588-vccio3-pinctrl.dtsi
7.clocks = <&cru CLK_PWM1>, <&cru PCLK_PWM1>;
8.clock-names = “pwm”, “pclk”;
9.status = “okay”; // Enabled status
10.};

3.1.2. Backlight node settings

backlight: backlight {
status=”okay”;
compatible = “pwm-backlight”;
pwms = <&pwm7 0 25000 0>;// 使用pwm7
brightness-levels = <
  0  20  20  21  21  22  22  23
23  24  24  25  25  26  26  27
27  28  28  29  29  30  30  31
31  32  32  33  33  34  34  35
35  36  36  37  37  38  38  39
40  41  42  43  44  45  46  47
48  49  50  51  52  53  54  55
56  57  58  59  60  61  62  63
64  65  66  67  68  69  70  71
72  73  74  75  76  77  78  79
80  81  82  83  84  85  86  87
88  89  90  91  92  93  94  95
96  97  98  99 100 101 102 103
104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135
136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151
152 153 154 155 156 157 158 159
160 161 162 163 164 165 166 167
168 169 170 171 172 173 174 175
176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215
216 217 218 219 220 221 222 223
224 225 226 227 228 229 230 231
232 233 234 235 236 237 238 239
240 241 242 243 244 245 246 247
248 249 250 251 252 253 254 255
>;
default-brightness-level = <255>;// 默认亮度
};
};
After this modification, the backlight should be on.
 

Because we only modify one interface, all modifications are added to the last level of the device tree file (rk3588-neardi-android-ld160-mipi2hdmi.dtsi), and the DSI device node is modified as follows:

&dsi1 {   
status = “okay”;
dsi1_panel: panel@0 {
status = “okay”;
compatible = “simple-panel-dsi”;
reset-gpios = <&gpio2 RK_PB6 GPIO_ACTIVE_LOW>;  //复位 
pinctrl-names = “default”;   //y
pinctrl-0 = <&mipi_dsi1_rst>;//y
reg = <0>;
backlight = <&backlight>;
reset-delay-ms = <100>;  //y
enable-delay-ms = <60>;
prepare-delay-ms = <60>;
unprepare-delay-ms = <60>;
disable-delay-ms = <60>;
init-delay-ms = <80>;//y
dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
dsi,format = <MIPI_DSI_FMT_RGB888>;
dsi,lanes  = <4>;
 
panel-init-sequence = [ //720p mipi屏参数 y
39 00 04 B9 FF 83 94
39 00 07 BA 63 03 68 6B B2 C0
…..
            …..
39 00 08 BF 40 81 50 00 1A FC 01
15 00 02 C6 ED
05 64 01 11
05 78 01 29
];
 
disp_timings1: display-timings {
native-mode = <&dsi1_timing0>;
dsi1_timing0: timing0 {
clock-frequency = <65000000>;   //y
hactive = <720>;
vactive = <1280>;
hfront-porch = <48>;
hsync-len = <8>;
hback-porch = <52>;
vfront-porch = <16>;
vsync-len = <6>;
vback-porch = <15>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
 
ports {
#address-cells = <1>;
#size-cells = <0>;
 
port@0 {
reg = <0>;
panel_in_dsi1: endpoint {
remote-endpoint = <&dsi1_out_panel>;
};
};
};
};
 
ports {
#address-cells = <1>;
#size-cells = <0>;
 
port@1 {
reg = <1>;
dsi1_out_panel: endpoint {
remote-endpoint = <&panel_in_dsi1>;
};
};
};
 
};
 
After the addition, panel-init-sequence and disp_timings1 under the upper-level device tree &dsi1_panel will be rewritten.
 
3.2.1. panel-init-sequence – Initialize sequence parameters: 
panel-init-sequence = [ //720p mipi display parameter y
39 00 04 B9 FF 83 94
39 00 07 BA 63 03 68 6B B2 C0
//15 00 02 36 01(Reverse display)
//15 00 02 36 02(Positive display)
15 00 02 36 01
39 00 0B B1 48 12 72 09 32 54 71 71 57 47
39 00 07 B2 00 80 64 0C 0D 2F
39 00 16 B4 73 74 73 74 73 74 01 0C 86 75 00 3F 73 74 73 74 73 74 01 0C 86
39 00 03 B6 6E 6E
39 00 22 D3 00 00 07 07 40 07 0C 00 08 10 08 00 08 54 15 0A 05 0A 02 15 06 05 06 47 44 0A 0A 4B 10 07 07 0C 40
39 00 2D D5 1C 1C 1D 1D 00 01 02 03 04 05 06 07 08 09 0A 0B 24 25 18 18 26 27 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 20 21 18 18 18 18
39 00 2D D6 1C 1C 1D 1D 07 06 05 04 03 02 01 00 0B 0A 09 08 21 20 18 18 27 26 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 25 24 18 18 18 18
39 00 3B E0 00 0A 15 1B 1E 21 24 22 47 56 65 66 6E 82 88 8B 9A 9D 98 A8 B9 5D 5C 61 66 6A 6F 7F 7F 00 0A 15 1B 1E 21 24 22 47 56 65 65 6E 81 87 8B 98 9D 99 A8 BA 5D 5D 62 67 6B 72 7F 7F
39 00 03 C0 1F 31
15 00 02 CC 03
15 00 02 D4 02
15 00 02 BD 02
39 00 0D D8 FF FF FF FF FF FF FF FF FF FF FF FF
15 00 02 BD 00
15 00 02 BD 01
15 00 02 B1 00
15 00 02 BD 00
39 00 08 BF 40 81 50 00 1A FC 01
15 00 02 C6 ED
05 64 01 11
05 78 01 29
];
 
3.2.2. disp_timings1 – screen parameters
The DPI timing parameters of the MIPI screen, that is, the timing information such as HFP, HBP, etc., should be filled in according to the actual parameters of the screen you are using.
disp_timings1: display-timings {
native-mode = <&dsi1_timing0>;
dsi1_timing0: timing0 {
clock-frequency = <65000000>;   //y
hactive = <720>;
vactive = <1280>;
hfront-porch = <48>;
hsync-len = <8>;
hback-porch = <52>;
vfront-porch = <16>;
vsync-len = <6>;
vback-porch = <15>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
 

4. MIPI-RESET

To light up the MIPI screen, MIPI-RESET needs to be configured. In 3588, I defined GPIO2_PB6 as reset.

Add content to pinctrl in the rk3588-neardi-android-ld160-mipi2hdmi.dtsi device tree as follows:

&pinctrl{
lcd {
/omit-if-no-ref/
mipi_dsi1_rst: mipi-dsi1-rst {
rockchip,pins = <2 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
// rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
};

At the same time, the relevant content in dsi1_panel is modified as follows:

dsi1_panel: panel@0 {
status = “okay”;
compatible = “simple-panel-dsi”;
reset-gpios = <&gpio2 RK_PB6 GPIO_ACTIVE_LOW>; // Low level reset
pinctrl-names = “default”;
pinctrl-0 = <&mipi_dsi1_rst>; // Reference mipi_dsi1_rst definition
reg = <0>;
backlight = <&backlight>;
reset-delay-ms = <100>; // Time taken for the panel to completely reset
init-delay-ms = <80>; // Time between panel reset and sending initialization sequence
enable-delay-ms = <60>;
prepare-delay-ms = <60>;
unprepare-delay-ms = <60>;
disable-delay-ms = <60>;


Screen adaptation completed.

Adapt ATK-MIPI-720p screen touch (gt9147)

There are two touch modes for touch screens: polling and interrupt. Take the ATK-MIPI 5.5-inch screen as an example, using the interrupt trigger mode, the touch IC is gt9147, the touch IC provides an interrupt signal pin (INT), and the touch information is obtained through interrupts.

1. Schematic Analysis

I2C interface pins I2C1_SCL_TP and I2C1_SDA_TP, touch IC reset pin TP_RST_L and touch IC interrupt pin TP_INT_L

1.2. 3588-side hardware interface:

Use I2C6, interrupt pin uses GPIO3_PC0, reset pin uses GPIO1_PA4

 

Use I2C6, interrupt pin uses GPIO3_PC0, reset pin uses GPIO1_PA4

Add i2c device and match gt9147 related configuration in rk3588-neardi-android-ld160-mipi2hdmi.dtsi.

Interrupt, reset GPIO configuration

&pinctrl{
touch {
/omit-if-no-ref/
touch_gpio: touch-gpio {
rockchip,pins =
<3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>,// INT_L
<1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;// RST_L
};
};
};
 

2. Device tree modification

Add i2c device and match gt9147 related configuration in rk3588-neardi-android-ld160-mipi2hdmi.dtsi.

Interrupt, reset GPIO configuration

&pinctrl{
touch {
/omit-if-no-ref/
touch_gpio: touch-gpio {
rockchip,pins =
<3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>,// INT_L
<1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;// RST_L
};
};
};
 

3. Touch driver configuration

3. Touch driver configuration

Add driver:

Create and add gt9147 driver file gt9147.c in kernel-5.10/drivers/input/touchscreen/directory

Generate gt9147.ko file after compilation, the directory is the same as gt9147.c

Driver configuration

Compile the added driver in kernel-5.10/drivers/input/touchscreen/Makefile

obj-m += gt9147.o // Compile to .ko driver file for subsequent testing

4. Debugging

After the modified code is compiled and burned to the development board and wiring is completed, start debugging.