rv1126平台spi屏调试
我们使用的rv1126平台,屏ic ST7789,硬件使用6bit,由于不是8bit的,所以显示的颜色没有那么丰富
1.硬件原理图
2.dts配置
&rgb {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&lcdc_ctl>;
ports {
rgb_out: port@1 {
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;
rgb_out_panel: endpoint@1 {
reg = <1>;
remote-endpoint = <&panel_in_rgb>;
};
};
};
};
&vop {
status = "okay";
};
&vop_mmu {
status = "okay";
};
panel {
compatible = "simple-panel";
status = "okay";
bus-format = <MEDIA_BUS_FMT_SRGB888_3X8>;
backlight = <&backlight>;
enable-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
enable-delay-ms = <20>;
reset-gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
reset-value = <0>;
reset-delay-ms = <10>;
prepare-delay-ms = <20>;
unprepare-delay-ms = <20>;
disable-delay-ms = <20>;
spi-sdi-gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
spi-scl-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
spi-cs-gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
width-mm = <217>;
height-mm = <136>;
//rockchip,data-mapping = "vesa";
rockchip,data-mapping = <0>;
rockchip,data-width = <24>;
//rockchip,output = "rgb";
rockchip,output = <0>;
rgb-mode = "p666";
rockchip,cmd-type = "spi";
bpc = <6>;
// type:0 is cmd, 1 is data
panel-init-sequence = [
// type delay num val1 val2 val3
00 00 01 11
00 78 01 3a
01 00 01 66
00 00 01 11
00 78 01 b4
01 00 01 00
00 00 01 36
01 00 01 dc
00 00 01 B0
01 00 01 11
01 00 01 f4
00 00 01 B2
01 00 01 0C
01 00 01 0C
01 00 01 00
01 00 01 33
01 00 01 33
00 00 01 BB //VCOM
01 00 01 1A
00 00 01 C0
01 00 01 2C
00 00 01 C3 //GVDD
01 00 01 0F //4.3V
00 00 01 C4
01 00 01 20
00 00 01 C6
01 00 01 0F //Dot INV, 60Hz
00 00 01 D0
01 00 01 A4
01 00 01 A1
00 00 01 E0
01 00 01 D0
01 00 01 13
01 00 01 1A
01 00 01 0A
01 00 01 0A
01 00 01 26
01 00 01 3F
01 00 01 54
01 00 01 54
01 00 01 18
01 00 01 14
01 00 01 14
01 00 01 30
01 00 01 33
00 00 01 E1
01 00 01 D0
01 00 01 13
01 00 01 1A
01 00 01 0A
01 00 01 0A
01 00 01 26
01 00 01 3F
01 00 01 54
01 00 01 54
01 00 01 1A
01 00 01 16
01 00 01 16
01 00 01 32
01 00 01 35
00 78 01 29
00 00 01 20
3.调试过程中遇到的问题
1.颜色显示异常
修改arch/arm/boot/dts/sd412-pinctrl.dtsi
lcdc {
/omit-if-no-ref/
lcdc_ctl: lcdc-ctl {
rockchip,pins =
/* lcdc_d0 */
<2 RK_PA4 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_d1 */
<2 RK_PA5 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_d2 */
<2 RK_PA6 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_d3 */
<2 RK_PA7 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_d4 */
<2 RK_PB0 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_d5 */
<2 RK_PB1 1 &pcfg_pull_none_drv_level_2>,
//虽然低两位硬件没有接,但是软件也需要配置
/* lcdc_d6 */
<2 RK_PB2 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_d7 */
<2 RK_PB3 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_den */
<2 RK_PD4 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_hsync */
<2 RK_PD5 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_vsync */
<2 RK_PD6 1 &pcfg_pull_none_drv_level_2>,
/* lcdc_clk */
<2 RK_PD7 1 &pcfg_pull_none_drv_level_8>;
};
};
2.出现切屏现象
最后发现是刷屏方向出错所致,修改36寄存器解决了这个问题,36寄存器值由厂家给的c8改成了dc
3.屏抖动问题
修改VCOM电压解决了问题,修改BB寄存器,由0.6v改成了1v左右解决,寄存器设置为27解决
VCOM是液晶分子偏转的参考电压 ,要求要稳定,对液晶显示有直接影响。