屏幕调试助手使用指南#

CanMV-K230 工程中的子仓库 mpp 里增加了一个屏幕调试助手,用户可将该功能使能后,通过修改存储在 SDCard 中的配置文件快速的调试屏幕时序以及初始化等。

1. 使能 DSI Debugger#

在工程根目录执行 make menuconfig,使能选项 Enable DSI Debuger

Enable DSI Debuger

保存配置后,编译生成新的固件,烧录后,即可通过配置文件来快速调试屏幕,不再需要频繁的修改代码编译固件。

2. 修改配置文件#

配置文件可参考工程中现有的,路径为 src/rtsmart/mpp/userapps/src/connector/display_debugger_config.txt

配置文件格式为

[config]
# pclk in hz
pclk_hz=33000000

# target fps
fps=60

# mipi dsi lane number, choice in 1, 2, 4
lane_num=2 

hactive=480
hsync=8
hbp=32
hfp=32

vactive=800
vsync=10
vfp=140
vbp=150

# !!! every line length should < 256

# cmd_type:
# 0x05  Command type: Single byte data (DCS Short Write, no parameters) 
# 0x15  Command type: Two byte data (DCS Short Write, 1 parameter)
# 0x39  Command type: Multi byte data (DCS Long Write, n parameters n > 2)

# format: cmd_type, delay_ms, cmd_data_length, cmd_data0 ... cmd_dataN

[init-sequence]
0x05,0,1,0x01
0x05,10,1,0x11
0x39,0,6,0xFF,0x77,0x01,0x00,0x00,0x11
0x15,0,2,0xD1,0x11
0x15,0,2,0x55,0xB0
0x39,0,6,0xFF,0x77,0x01,0x00,0x00,0x10
0x39,0,3,0xC0,0x63,0x00
0x39,0,3,0xC1,0x04,0x02
0x39,0,3,0xC2,0x37,0x08
0x15,0,2,0xC7,0x00
0x15,0,2,0xCC,0x38
0x39,0,17,0xB0,0x00,0x11,0x19,0x0C,0x10,0x06,0x07,0x0A,0x09,0x22,0x04,0x10,0x0E,0x28,0x30,0x1C
0x39,0,17,0xB1,0x00,0x12,0x19,0x0D,0x10,0x04,0x06,0x07,0x08,0x23,0x04,0x12,0x11,0x28,0x30,0x1C
0x39,0,6,0xFF,0x77,0x01,0x00,0x00,0x11
0x15,0,2,0xB0,0x4D
0x15,0,2,0xB1,0x60
0x15,0,2,0xB2,0x07
0x15,0,2,0xB3,0x80
0x15,0,2,0xB5,0x47
0x15,0,2,0xB7,0x8A
0x15,0,2,0xB8,0x21
0x15,0,2,0xC1,0x78
0x15,0,2,0xC2,0x78
0x15,0,2,0xD0,0x88
0x39,0,4,0xE0,0x00,0x00,0x02
0x39,0,12,0xE1,0x01,0xA0,0x03,0xA0,0x02,0xA0,0x04,0xA0,0x00,0x44,0x44
0x39,0,12,0xE2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x39,0,5,0xE3,0x00,0x00,0x33,0x33
0x39,0,3,0xE4,0x44,0x44
0x39,0,17,0xE5,0x01,0x26,0xA0,0xA0,0x03,0x28,0xA0,0xA0,0x05,0x2A,0xA0,0xA0,0x07,0x2C,0xA0,0xA0
0x39,0,5,0xE6,0x00,0x00,0x33,0x33
0x39,0,3,0xE7,0x44,0x44
0x39,0,17,0xE8,0x02,0x26,0xA0,0xA0,0x04,0x28,0xA0,0xA0,0x06,0x2A,0xA0,0xA0,0x08,0x2C,0xA0,0xA0
0x39,0,8,0xEB,0x00,0x01,0xE4,0xE4,0x44,0x00,0x40
0x39,0,17,0xED,0xFF,0xF7,0x65,0x4F,0x0B,0xA1,0xCF,0xFF,0xFF,0xFC,0x1A,0xB0,0xF4,0x56,0x7F,0xFF
0x15,0,2,0xEE,0x42
0x39,0,6,0xFF,0x77,0x01,0x00,0x00,0x00
0x15,0,2,0x36,0x00
0x15,0,2,0x3A,0x55
0x05,10,1,0x11
0x05,0,1,0x29

3. 使用 Connector Type#

用户需要在代码中使用指定的 Connector Type 才可触发从文件系统中读取配置的功能。

DSI_DEBUGGER_DEVICE = 201,
Display.init(Display.DEBUGGER, to_ide = True)

在使用过程中,可以观看串口日志,可以观察配置解析结果,以及生成的配置是否符合预期。

同时在测试的时候,需要注意屏幕的宽高与显示图片宽高是否一致。