DSI屏幕参数配置¶
The basic knowledge of MIPI can be found in the following article, and the basic knowledge of MIPI DSI will not be described in detail here
配置参数前的准备¶
在配置DSI的参数前,用户需要对自己屏幕模组的参数指标有比较详细的认知,请参考以下列表,确认在配置前已经了解相关的信息。
The number of DSI interface Data Lanes, color format, and maximum frequency
DSI interface working mode, Command mode/Video mode, different modes require reference to different configuration processes
Screen resolution, refresh rate
For the Command mode, confirm the mechanism of the screen TE, whether it is through the DSI protocol or through a separate pin providing the TE signal
After preparing the above information, the screen parameters can be configured according to the working mode of the DSI interface
Command模式参数配置¶
The main configurable parameters for DSI in Command mode are:
freq
DSI clock frequencycolor_mode
Color format, which can be configured as RGB888 or RGB565AutomaticClockLaneControl
Automatic clock control, after enabling, the clock lane will enter a low-power state when idle, thus reducing interface power consumptionNumberOfLanes
Number of DSI Data Lanes, with a maximum support of 2 Data LanesTearingEffectSource
Configure the TE source of DSITEAcknowledgeRequest
Configure Enable to enable the TE functionvsyn_delay_us
The delay of TE function triggering data transmission. This function is effective only when TE is enabled. The configuration indicates the delay from the arrival of the TE signal to the formal transmission of screen data
如下的源码中,涵盖了DSI Command模式的所有配置,上述提到的配置是需要根据屏幕要求进行更改的,其他配置,也有对应描述,但是不建议进行更改。
static LCDC_InitTypeDef lcdc_int_cfg_dsi =
{
.lcd_itf = LCDC_INTF_DSI, /* Select the DSI interface */
.freq = DSI_FREQ_480Mbps, /* Select the DSI interface frequency, here choose 480M */
.color_mode = LCDC_PIXEL_FORMAT_RGB888, /* DBI output color format, should match with .cfg.dsi.CmdCfg.ColorCoding */
.cfg = {
.dsi = {
.Init = {
/* Automatic clock lane control, after enabling, the clock lane will automatically enter the LP mode to save power, default is off, if you need to control the interface power consumption, then turn it on*/
.AutomaticClockLaneControl = DSI_AUTO_CLK_LANE_CTRL_ENABLE,
.NumberOfLanes = DSI_ONE_DATA_LANE,/* DSI Data Lane数量 */
/*
The clock division ratio in LP mode, no changes needed
*/
.TXEscapeCkdiv = 0x4,
},
.CmdCfg = {
.VirtualChannelID = 0,/* Channel ID, no changes needed */
.CommandSize = 0xFFFF, /* This value currently has no effect, ignore */
/* Configure whether the TE source comes from external or internal */
.TearingEffectSource = DSI_TE_EXTERNAL, /* DSI link TE */
.TEAcknowledgeRequest = DSI_TE_ACKNOWLEDGE_ENABLE, /* Enable TE */
/* DSI input & output color format, this configuration will be removed later, duplicated with previous configuration */
.ColorCoding = DSI_RGB888,//DSI input & output color format
},
/* 这部分寄存器都是dsi物理层相关配置,不建议用户进行更改 */
.PhyTimings = {
.ClockLaneHS2LPTime = 35,/* The number of clock cycles required for the clock lane to switch from HS to LP mode */
.ClockLaneLP2HSTime = 35, /* The number of clock cycles required for the clock lane to switch from LP to HS mode */
.DataLaneHS2LPTime = 35,/* The number of clock cycles required for the data lane to switch from HS to LP mode */
.DataLaneLP2HSTime = 35, /* The number of clock cycles required for the data lane to switch from LP to HS mode */
.DataLaneMaxReadTime = 0,/* The maximum number of clock cycles required for a single read. Since reading does not occur during the data transmission phase under current usage conditions, this value is not used */
.StopWaitTime = 0, /* The minimum waiting time to send an HS mode switching request in stop mode */
},
/* HostTimeouts 这一部分配置主要设计timeout报错,一般用来检测异常情况,方便以后debug,用户不需要修改 */
.HostTimeouts = {
.TimeoutCkdiv = 1,/* The clock division ratio for timeout, timeout debug is currently not turned on and not effective */
.HighSpeedTransmissionTimeout = 0,
.LowPowerReceptionTimeout = 0,
.HighSpeedReadTimeout = 0,
.LowPowerReadTimeout = 0,
.HighSpeedWriteTimeout = 0,
//.HighSpeedWritePrespMode = DSI_HS_PM_DISABLE,
.LowPowerWriteTimeout = 0,
.BTATimeout = 0,
},
/* LPCmd The registers here define the sending mode corresponding to various types of commands in command mode. The LP mode has a slow sending speed but can be captured by logic analysis, while the high-speed mode has a fast sending speed but cannot be detected by common instruments这里建议对于generic接口的command,设置为低速即可,对于dcs的指令,除了longwrite,其他均可以设置为低速,这样便于通过逻分查看波形。这部分允许用户更改,但不太建议改动。*/
.LPCmd = {
.LPGenShortWriteNoP = DSI_LP_GSW0P_ENABLE,/* Generic interface short write command without parameter sending mode, enable for low speed, disable for high speed */
.LPGenShortWriteOneP = DSI_LP_GSW1P_ENABLE,/* Generic interface short write command with single parameter sending mode, enable for low speed, disable for high speed */
.LPGenShortWriteTwoP = DSI_LP_GSW2P_ENABLE,/* Generic interface short write command with dual parameter sending mode, enable for low speed, disable for high speed */
.LPGenShortReadNoP = DSI_LP_GSR0P_ENABLE,/* Generic interface short read command without parameter sending mode, enable for low speed, disable for high speed */
.LPGenShortReadOneP = DSI_LP_GSR1P_ENABLE,/* Single parameter transmission mode of generic interface shortread instruction, enable is low speed, disable is high speed */
.LPGenShortReadTwoP = DSI_LP_GSR2P_ENABLE,/* Double parameters transmission mode of generic interface shortread instruction, enable is low speed, disable is high speed */
.LPGenLongWrite = DSI_LP_GLW_ENABLE, /* Transmission mode of generic interface longwrite instruction, enable is low speed, disable is high speed */
.LPDcsShortWriteNoP = DSI_LP_DSW0P_ENABLE,/* No parameter transmission mode of dcs interface shortwrite instruction, enable is low speed, disable is high speed */
.LPDcsShortWriteOneP = DSI_LP_DSW1P_ENABLE, /* Single parameter transmission mode of dcs interface shortwrite instruction, enable is low speed, disable is high speed */
.LPDcsShortReadNoP = DSI_LP_DSR0P_ENABLE, /* No parameter transmission mode of ddcs interface shortread instruction, enable is low speed, disable is high speed */
.LPDcsLongWrite = DSI_LP_DLW_DISABLE, /* Single parameter transmission mode of dcs interface longwrite instruction, enable is low speed, disable is high speed */
.LPMaxReadPacket = DSI_LP_MRDP_ENABLE, /* Set the maximum read packet size instruction mode transmission mode, enable is low speed, disable is high speed*/
.AcknowledgeRequest = DSI_ACKNOWLEDGE_DISABLE, //Disable LCD error reports. After enabling, it allows the screen end to send response packets, mainly used for debug. In general scenarios, disable is enough。
},
.vsyn_delay_us = 0,/* This configuration is meaningful only after enabling TEAcknowledgeRequest, and is used to configure how many us the TE signal high level delays before sending data to the screen */
},
},
};
#endif /* BSP_LCDC_USING_DSI */