RK3288的LCD调试,根据屏幕规格书对dts作相应的修改基本都可点亮,配置也较为简单
Platform : Rockchip
Soc : RK3288
System : linux(buidroot)
IC:NT35523
内核:4.4
先做一些准备工作,多看看LCD的手册
提炼出来关键信息是:
Hactive = 800 ,水平分辨率
Vactive = 2560 ,垂直分辨率
Lanes = 4 ,Mipi data 信号线通道数
硬件上,复位信号的时序要对:
主要参数的提取:
关键信息提炼出来:
4 data lines(厂家推荐值):
Hactive = 800
HFP = 40
HBP = 20
Hsync = 20
Vactive = 1280
VFP = 20
VBP = 20
VSync = 10
clock-frequency = (h_active + hfp + hbp + h_sync) * (v_active + vfp + vbp + v_sync) * fps
厂商给参考值60Hz,
fps= clk/ (800 + 40 + 20 +20) * (1280 + 20 + 20 + 10) = 60Hz
Pixel Clock Frequency(Pclk)= 70.22MHZ
这里我们详细说一下各个参数的含义,这个对我们后续调屏会非常有帮助。
另外根据以上的信息,我们还能计算出 Mipi Dsi Clock 。
DCLK = 100 + H_total×V_total × fps × 3 × 8 / lanes_nums
total 这里指的是 sync + front + back + active
比如 H_total = Hsync + HFP(hfront-proch) + HBP(hback-porch) + Hactive
fps 指的是帧率,一般我们按照 60 帧来计算
3 × 8 代表一个 RGB 为 3 个字节,每个字节 8 bit
lanes 代表 mipi data 通道数
所以对于我这个屏
DCLK
= 100Mbps + H_Total × V_Total x fps x 3 x 8 / lanes_nums
= 100 + ( 800 + 40 + 20 + 20 ) x ( 1280 + 20 + 20+ 10 ) x 60 帧 x 3 字节 x 8 bit / 4 lanes
= 100Mbps + 421Mbps = 521 Mbps
MIPI CLK Lane * 2 = MIPI DATA Lane
原理图,GPIO的配置:
现在附上设备树中dts文件LCD部分的代码:
+/*************add by lml start*********************/
+
+
+&dsi0 {
+ status = "okay";
+
+ panel@0 {
+ compatible = "simple-panel-dsi";
+ reg = <0>;
+ backlight = <&backlight>;
+ // enable-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+ reset-gpios = <&gpio6 5 GPIO_ACTIVE_LOW>;
+
+ prepare-delay-ms = <120>;
+ reset-delay-ms = <120>;
+ init-delay-ms = <120>;
+ enable-delay-ms = <120>;
+ unprepare-delay-ms = <120>;
+ disable-delay-ms = <120>;
+
+ width-mm = <113>;
+ height-mm = <181>;
+
+ dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
+ dsi,format = ;
+ dsi,lanes = <4>;
+
+ panel-init-sequence = [
+ 39 00 06 f0 55 aa 52 08 00
+ 39 00 0a c0 00 00 00 00 00 00 00 00 02
+ 15 00 02 c8 80
+ 39 00 03 b1 e8 21
+ 39 00 03 b5 05 00
+ 39 00 03 bb 93 93
+ 39 00 03 bc 0f 00
+ 39 00 05 bd 11 30 10 10
+ 39 00 06 f0 55 aa 52 08 01
+ 15 00 02 ce 00
+ 39 00 03 b7 00 48
+ 15 00 02 ce 00
+ 15 00 02 ca 03
+ 39 00 03 b3 23 23
+ 39 00 03 b4 23 23
+ 39 00 03 c3 5a 5a
+ 39 00 03 c4 5a 5a
+ 39 00 03 c2 5a 5a
+ 39 00 03 b9 44 44
+ 39 00 03 ba 24 24
+ 39 00 03 bc 50 00
+ 39 00 03 bd 50 00
+ 39 00 03 be 00 71
+ 39 00 03 bf 00 a0
+ 39 00 06 f0 55 aa 52 08 02
+ 15 00 02 b0 40
+ 39 00 11 d1 00 00 00 1b 00 40 00 5b 00 71 00 97 00 b5 00 e6
+ 39 00 11 d2 01 0d 01 4b 01 7c 01 c8 02 03 02 05 02 3a 02 72
+ 39 00 11 d3 02 95 02 c5 02 e7 03 15 03 32 03 57 03 71 03 95
+ 39 00 05 d4 03 b0 03 b3
+ 39 00 06 f0 55 aa 52 08 03
+ 39 00 05 b0 00 00 00 00
+ 39 00 05 b1 00 00 00 00
+ 39 00 08 b2 00 00 0a 06 00 f0 5b
+ 39 00 08 b3 00 00 09 06 00 f0 5b
+ 39 00 0b b6 f0 05 06 03 00 00 00 00 10 10
+ 39 00 0b b7 f0 05 07 03 00 00 00 00 10 10
+ 39 00 08 bc c5 03 00 08 00 f0 5b
+ 39 00 03 c4 00 00
+ 39 00 06 f0 55 aa 52 08 05
+ 39 00 05 b0 33 04 00 01
+ 39 00 03 b1 40 00
+ 39 00 04 b2 03 02 22
+ 39 00 05 b3 83 23 42 9a
+ 39 00 05 b4 c5 35 77 53
+ 39 00 08 b5 4c e5 31 33 33 a3 0a
+ 39 00 07 b6 00 00 d5 31 77 53
+ 39 00 06 b9 00 00 00 05 00
+ 39 00 06 c0 35 33 33 50 05
+ 39 00 05 c6 00 00 00 00
+ 39 00 03 ce f0 1f
+ 39 00 06 d2 00 25 02 00 00
+ 39 00 03 e7 e8 ff
+ 39 00 03 e8 ff ff
+ 15 00 02 e9 00
+ 15 00 02 ea aa
+ 15 00 02 eb aa
+ 15 00 02 ec aa
+ 15 00 02 ee aa
+ 39 00 06 f0 55 aa 52 08 06
+ 39 00 06 b0 7d 4a 7d 7d 7d
+ 39 00 06 b1 7d 7d 42 5d 7d
+ 39 00 06 b2 7d 63 61 7d 7d
+ 39 00 06 b3 5f 72 7d 7d 7d
+ 39 00 03 b4 7d 7d
+ 39 00 06 b5 7d 48 7d 7d 7d
+ 39 00 06 b6 7d 7d 40 5c 7d
+ 39 00 06 b7 7d 62 60 7d 7d
+ 39 00 06 b8 5e 72 7d 7d 7d
+ 39 00 03 b9 7d 7d
+ 15 00 02 35 00
+ 05 96 01 11
+ 05 96 01 29
+ ];
+
+ panel-exit-sequence = [
+ 05 00 01 28
+ 05 78 01 10
+ ];
+
+ display-timings {
+ native-mode = <&timing0>;
+
+ timing0: timing0 {
+ clock-frequency = <66000000>;
+ hactive = <1280>;
+ vactive = <800>;
+ hback-porch = <20>;
+ hsync-len = <10>;
+ hfront-porch = <40>;
+ vback-porch = <20>;
+ vfront-porch = <20>;
+ vsync-len = <10>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ de-active = <0>;
+ pixelclk-active = <0>;
+ };
+ };
+ };
+};
+
+
+&dsi0_in_vopl {
+ status = "disabled";
+};
+
+&dsi0_in_vopb {
+ status = "okay";
+};
+
+&route_dsi0 {
+ connect = <&vopb_out_dsi0>;
+ status = "okay";
+};
+
+/*************add by lml end*********************/
初始化代码解析(MIPI必须有初始化代码才能点亮,这个有原厂提供):
panel-init-sequence = [
39 00 06 f0 55 aa 52 08 00
..................................................
05 96 01 29
];
说明:前 3 个字节(16 进制),分别代表 Data Type,Delay,Payload Length。
从第四个字节开始的数据代表长度为 Length 的实际有效 Payload。
第一条命令的解析如下:
39 00 06 f0 55 aa 52 08 00
Data Type:0x39 (DCS Long Write)
Delay:0x00 (0 ms)
Payload Length:0x06 (4 Bytes)
Payload:f0 55 aa 52 08 00
最后一条命令的解析如下:
05 96 01 29
Data Type:0x05 (DCS Short Write, no parameters)
Delay:0x96 (150 ms)
Payload Length:0x01 (1 Bytes)
Payload:0x29