DPI屏幕参数配置¶
屏幕参数配置讲解¶
DPI/RGB接口¶
RGB LCD 液晶屏一般有两种数据同步方式,一种是行场同步模式(HV Mode),另一种是数据使能 同步模式(DE Mode)。当选择行场同步模式时,行同步信号(HSYNC)和场同步信号(VSYNC)作为数据的同步 信号,此时数据使能信号(DE)必须为低电平。 当选择 DE 同步模式时,LCD 的 DE 信号作为数据的有效信号,本例图中DE 信号所示。The DE signal is only valid (high level) when both the frame active display area and the line active display area are scanned simultaneously.。当选择 DE 同步模式时,此时行场同步信号 VS 和 HS 必须为高电平。 由于 RGB LCD 液晶屏一般都支持 DE 模式,不是所有的 RGB LCD 液晶屏都支持 HV 模式,因此本章 采用 DE 同步的方式介绍驱动 LCD 液晶屏。
static LCDC_InitTypeDef lcdc_int_cfg =
{
.lcd_itf = AUTO_SELECTED_DPI_INTFACE,
/*
DPI的clk频率选择,频率为hcpu主频分频后的频率,比如hcpu主频240Mhz,能够得到的频率只能为40/48/60/80,如果设置62Mhz,实际会设置为60Mhz
*/
.freq = 48 * 1000 * 1000,
/*
DPI接口输出的颜色格式
1. LCDC_PIXEL_FORMAT_RGB565为常见的RGB565色
2. LCDC_PIXEL_FORMAT_RGB888为常见的RGB888色
*/
.color_mode = LCDC_PIXEL_FORMAT_RGB888,
.cfg = {
.dpi = {
.PCLK_polarity = 0, /* 选择DPI波形中Pclk(像素时钟信号线)的极性 */
.DE_polarity = 0, /* 选择DPI波形中DE(数据使能信号)的极性 */
.VS_polarity = 1, /* 选择DPI波形中VS(V sync 场同步信号)的极性 */
.HS_polarity = 1, /* 选择DPI波形中HS(H sync 行同步信号)的极性 */
.VS_width = 2, /* 选择VS(场同步信号)持续的宽度,单位为(几个HS波形) */
.HS_width = 2, /* 选择HS(行同步信号)持续的宽度,单位为(几个Pclk波形) */
.VBP = 23, /* VBP(V back porch 帧显示后沿或后肩)的宽度,单位为(几个HS波形) */
.VAH = 600, /* 选择屏的垂直高度,单位为(行) */
.VFP = 12, /* VFP(V front proch 帧显示前沿或前肩)的宽度,单位为(几个HS波形)*/
.HBP = 160, /* HBP(H back porch 行显示后沿或后肩)的宽度,单位为(几个Pclk波形)*/
.HAW = 1024, /* 选择屏的水平宽度,单位为(列) */
.HFP = 160, /* HFP(H front porch 行显示前沿或前肩)的宽度,单位为(几个Pclk波形)*/
.interrupt_line_num = 1,
},
},
};
按照上面的PCLK,DE,VS,HS的极性配置,可以输出对应下图所示的波形:
参考文章:https://blog.csdn.net/weixin_50965981/article/details/134496428
带宽要求¶
DPI屏幕的刷屏对framebuffer所在的RAM的读取稳定性有要求,所以尽量保证这块RAM只有刷屏操作,没有其他操作(比如一些频繁访问的全局变量、线程栈、或者其他DMA会访问的buffer等),否则可能会导致显示出现异常:包括出现一些黑线、屏幕右侧出现抖动等。
Generally speaking, the bandwidth of SRAM is sufficient and does not need to be specified separately, but the bandwidth of PSRAM may not be sufficient. So if the screen refresh buffer is on PSRAM, it is best to meet the aforementioned conditions.。
如图所示,就是buffer放在PSRAM上面,带宽不够时闪现的画面(带宽不够是因为有CPU在填充PSRAM内下一帧的framebuffer)
DPI_AUX模式的使用限制¶
If your screen width ≤ 512 pixels, this mode will not be used, so you don’t need to worry about this part.。
If your screen width ≤ 1024 pixels and you are using the 58x chip, you also do not need to worry about this part.。
什么是DPI_AUX¶
对DPI屏幕接口的宏AUTO_SELECTED_DPI_INTFACE
实际会根据芯片和屏幕宽度自动选择以下2种模式:
DPI模式
The native mode of the LCD controller supports a maximum screen width of 1024 for the 58x series, and 512 for others.。DPI_AUX模式
An auxiliary mode designed for screens exceeding the native mode width of the LCD controller.。
使用限制¶
当使用DPI_AUX模式时,有以下使用限制:
一、不能打开自动降系统主频(BSP_PM_FREQ_SCALING)¶
Automatic frequency reduction will affect the operation of the hardware refresh mechanism, and the frequency can be reduced only after the screen is turned off.。
二、The Framebuffer must be full-screen and the number of rows must be even.¶
三、The following arrays need to be placed in SRAM, but not in the retention-SRAM section.¶
drv_lcd.c中的ramless_code,sram_data0,sram_data1
55x 避免放在0x00020000 ~ 0x00030000
56x 避免放在0x20000000 ~ 0x20020000
Note
After SDK 2.2.4, this part of the array was changed to automatically allocate a non-Retention-SRAM memory from the system heap.。
四、刷屏期间需要一直占用如下硬件模块:¶
56x:
普通DMA的一个channel(可配置,默认DMA1-CH5)
EXTDMA
PTC模块
BUSMONITOR
BTIM2
55x:
普通DMA的一个channel(可配置,默认DMA1-CH8)
EXTDMA
PTC模块
BUSMONITOR
BTIM1, BTIM2
Caution
For NAND systems, PSRAM_CACHE_WB needs to be enabled to avoid EXTDMA usage conflicts.
Avoid using lvgl lv_scheme0 (LV_FRAME_BUF_SCHEME_0) to prevent EXTDMA usage conflicts.
Avoid using sifli_memcpy, sifli_memset to avoid EXTDMA usage conflicts.
In dma_config.h, it is necessary to avoid DMA channel conflicts based on the current usage of DMA channels for modules such as SPI, UART, I2C, and I2S.