LCD 控制器(LCDC)

支持的芯片[ RTL8730E ][ RTL8721F ]

概述

芯片集成了液晶显示控制器(LCDC),用于驱动 LCD 面板,为嵌入式系统提供灵活且高效的显示解决方案。

功能特性

  • 支持标准 RGB 并行和 I80 (MCU) 接口

  • 支持丰富的接口位宽与像素格式

  • 高度可配置的时序控制参数

  • 内置像素格式转换器(PFC)

  • 支持多种中断类型

架构与接口

系统架构

../../_images/lcdc_g2_arch.svg

LCDC 架构

接口信号

RGB 接口:

RGB 接口信号

../../_images/lcdc_g2_rgb_if_signal.svg

RGB 接口信号

可编程时序控制

  • 时序参数:VSW, VBP, VFP, HSW, HBP 和 HFP 宽度

  • 极性参数:HSYNC, VSYNC, DE, DCLK。

辅助控制信号

显示面板接口通常包含 LCDC 接口信号之外的其他必要信号:

  • 显示器使能(LCD_DISP)、背光控制、复位信号:可通过 GPIO 实现。有关 GPIO 用法请参考 GPIO

  • 面板初始化或触控:根据屏幕支持方式,使用 I2C 或 SPI 等通信接口。I2C/SPI 相关用法请参考 I2C SPI

接口位宽及色深

LCDC 支持的接口和颜色格式

接口类型

6bit-RGB565

8bit-RGB565

8bit-RGB888

16bit-RGB565

24bit-RGB888

RGB 接口

I80 接口

数据同步与处理

帧同步模式

RGB 接口:

提供两种帧同步模式,可依据 LCD 时序要求进行灵活选择:

  • HV 模式:通过 HSYNC 和 VSYNC 信号同步。

  • DE 模式:通过 DE 信号同步。

像素格式转换器

支持在内存中的像素格式与接口数据格式之间的实时转换。转换过程遵循以下规则:

  • Alpha 通道处理 :若源格式包含 Alpha 值,直接舍弃。

  • 高位深向低位深转换 :舍弃高位深格式的低位数据

示例:RGB888 转 RGB565

../../_images/lcdc_g2_pfc_h2l.svg
  • 低位深向高位深转换 :使用高位数据填充高位深格式的低位

示例:RGB565 转 RGB888

../../_images/lcdc_g2_pfc_l2h.svg

中断机制

提供细致的中断管理功能,以适应高效的事件响应需求:

  • 帧开始中断

  • 帧结束中断

  • 行命中中断

  • TE (Tearing Effect)信号中断

  • FIFO 下溢中断 (underflow)

双缓冲 Ping-Pong 机制

背景

某些LCD没有内置图形存储器(GRAM),需要主控持续推送像素数据到屏幕。

单缓冲区的问题

使用单一帧缓冲器时,存在以下风险:

CPU 正在更新的不完整帧数据可能被直接显示在屏幕上,导致画面闪烁或显示错误的中间状态。

通常使用多重缓冲技术(例如双缓冲)来避免该行为。

双缓冲区解决方案

使用两个独立的缓冲区进行 Ping-Pong:

  • 显示缓冲区 :当前 LCDC 推送到屏幕的完整帧

  • 绘制缓冲区 :CPU准备下一帧的工作区域

完成一帧显示后,两个缓冲区角色互换,确保屏幕始终接收完整帧数据,如图所示。

../../_images/lcdc_g2_double_buffer_machanism.svg

开发流程

前期准备

准备一块 LCD,并查阅其文档,确认以下信息:

  • 接口类型 :为后续软硬件操作奠定基础

  • 接口信号 :确保正确的硬件连接和驱动配置

  • 时序参数 :如采样时钟边沿等

备注

当屏幕文档无法满足上述需求时,请查阅屏幕驱动芯片文档。

警告

对于 MCU 接口 LCD:请务必获取正确的初始化序列,初始化错误可能导致显示异常。

硬件设计

芯片封装选型

确保足够的引脚数量以满足接口信号需求。

备注

部分封装引脚数量有限,可能无法支持复杂接口。

LCD 子板集成配置指南

Realtek 提供专业 LCD 转板,配备 FPC 接口和母口排针,用于连接屏幕 PCB 底板与 Ameba EVB。

../../_images/lcdc_daughter_board.png
  • 信号映射确认 :查阅 EVB 和 LCD 子板原理图,确认信号与引脚对应关系。

  • 电阻上件检查 :按需进行电阻 rework, 确保信号连通。

  • 电源规划 :确认供电和接地连接完整性。

LCD 面板连接

使用 LCD 转板将 EVB 与 LCD 面板进行连接。

../../_images/lcdc_pannel_connect.png

软件开发

RGB 接口:

编程要点

  • 引脚复用配置

  • 使能 LCDC 外设的时钟

  • 初始化结构体以配置时序参数

  • 初始化 LCDC 硬件寄存器

  • 配置帧缓冲区地址到寄存器

  • 使能 LCDC 外设

代码分析

  1. 引脚复用配置

    • 通用信号

      • 对于 背光硬件复位 等通用信号,可使用 GPIO 控制。

    • RGB 接口时序信号

      • 请参考 引脚复用,调用 Pinmux_Config(PinName, FuncId) 进行配置。

      备注

      • 接口位宽最大支持 24-bit;

      • 当接口位宽小于 24-bit 时,Function-ID 需从 LCD_D0 开始使用。

        • 例如,对于 16-bit RGB565,Function-ID 仅支持 LCD_D0~LCD_D15,不支持 LCD_D8~LCD_D23。

  2. 分配 GRAM 并填充像素数据

    • 需记录分配的内存首地址(如 0x60001000),以便在步骤 5 中配置给 LCDC。

  3. 使能 LCDC 功能及时钟

    LCDC_RccEnable()
    
  4. 根据 LCD 手册初始化 LCDC

    • 获取并配置以下信息:接口宽度、图像分辨率、像素格式、HV 参数(vsw, vbp, vfp, hsw, hbp, hfp)、信号极性等。

      备注

      1. 接口宽度与输出像素格式需在 接口位宽及色深 范围内配置,否则可能无法显示。

      2. 帧率不能低于 LCD 要求,否则可能无法显示。

    示例配置(24-bit RGB888,480x800):

    void LCDC_RGBStructInit(LCDC_RGBInitTypeDef *LCDC_RGBInitStruct)
    {
       /* 配置 LCD 参数 */
       LCDC_RGBInitStruct->Panel_Init.IfWidth = LCDC_RGB_IF_24_BIT;
       LCDC_RGBInitStruct->Panel_Init.ImgHeight = 480;
       LCDC_RGBInitStruct->Panel_Init.ImgWidth = 800;
       LCDC_RGBInitStruct->Panel_Init.InputFormat = LCDC_INPUT_FORMAT_RGB888;
       LCDC_RGBInitStruct->Panel_Init.OutputFormat = LCDC_OUTPUT_FORMAT_RGB888;
       LCDC_RGBInitStruct->Panel_Init.RGBRefreshFreq = 35;
    
       /* 配置信号 H/V 参数 */
       LCDC_RGBInitStruct->Panel_RgbTiming.RgbVsw = 1;
       LCDC_RGBInitStruct->Panel_RgbTiming.RgbVbp = 4;
       LCDC_RGBInitStruct->Panel_RgbTiming.RgbVfp = 6;
    
       LCDC_RGBInitStruct->Panel_RgbTiming.RgbHsw = 4;
       LCDC_RGBInitStruct->Panel_RgbTiming.RgbHbp = 40;
       LCDC_RGBInitStruct->Panel_RgbTiming.RgbHfp = 40;
    
       /* 配置信号极性 */
       LCDC_RGBInitStruct->Panel_RgbTiming.Flags.RgbEnPolar = LCDC_RGB_EN_PUL_HIGH_LEV_ACTIVE;
       LCDC_RGBInitStruct->Panel_RgbTiming.Flags.RgbHsPolar = LCDC_RGB_HS_PUL_LOW_LEV_SYNC;
       LCDC_RGBInitStruct->Panel_RgbTiming.Flags.RgbVsPolar = LCDC_RGB_VS_PUL_LOW_LEV_SYNC;
       LCDC_RGBInitStruct->Panel_RgbTiming.Flags.RgbDclkActvEdge = LCDC_RGB_DCLK_FALLING_EDGE_FETCH;
    }
    
    /* 初始化 LCDC */
    LCDC_RGBInit(LCDC, &LCDC_RGBInitStruct);
    
  5. 根据步骤 2 分配的地址,配置给 LCDC

    LCDC_DMAImgCfg(LCDC, 0x60001000);
    
  6. 使能 LCDC

    LCDC_Cmd(LCDC, ENABLE);
    

备注

如果 LCD 需要初始化操作,请根据其指定通信接口补充以下配置:

  • 硬件配置

    • 保证 Ameba 的通信引脚正确连接至 LCD 的通信信号。

  • 软件配置

    • 初始化通信接口。

    • 发送 LCD 初始命令序列。

应用示例

SDK 提供了如下功能示例,帮助开发者了解和使用 LCDC 功能:

备注

要了解示例支持的芯片,请查看示例路径下的 README.md 文件。

Raw API

LCDC Exported Types

RTL8730E:
struct LCDC_InitTypeDef

LCDC Init Structure Definition.

Public Members

u16 LCDC_ImageWidth

Specifies the width of the display image in pixels.

u16 LCDC_ImageHeight

Specifies the height of the display image in pixels.

u8 LCDC_BgColorRed

Specifies the red component of the background color. Value range: 0x00 to 0xFF.

u8 LCDC_BgColorGreen

Specifies the green component of the background color. Value range: 0x00 to 0xFF.

u8 LCDC_BgColorBlue

Specifies the blue component of the background color. Value range: 0x00 to 0xFF.

LCDC_LayerConfigTypeDef layerx[LCDC_LAYER_MAX_NUM]

Specifies the configuration for each display layer.

struct LCDC_LayerConfigTypeDef

LCDC Layer Init Structure Definition.

Public Members

u8 LCDC_LayerEn

Specifies layer enable or not. This parameter can be a value of ENABLE or DISABLE

u8 LCDC_LayerImgFormat

Specifies the layer image data format. This parameter can be a value of LCDC Layer IMG Format

u8 LCDC_LayerColorKeyingEn

Specifies the layer's color keying enable or not. This parameter can be a value of ENABLE or DISABLE

u32 LCDC_LayerImgBaseAddr

Specifies the image base address. This parameter can be a number between 0x0 and 0xffffffff.

u16 LCDC_LayerHorizontalStart

Specifies the first pixel of a line of the layer window. This parameter can be a number between 0x0 and 0xfff.

u16 LCDC_LayerHorizontalStop

Specifies the last pixel of a line of the layer window. This parameter can be a number between 0x0 and 0xfff.

u16 LCDC_LayerVerticalStart

Specifies the first line of the layer window. This parameter can be a number between 0x0 and 0xfff.

u16 LCDC_LayerVerticalStop

Specifies the last line of the layer window. This parameter can be a number between 0x0 and 0xfff.

u32 LCDC_LayerColorKeyingVal

Specifies the color key value (RGB), which is used by the Color Keying. This parameter can be a number between 0x0 and 0xffffff.

u8 LCDC_LayerBlendConfig

Specifies the blending factor. This parameter can be a value of 0 (const alpha) or 1 (pixel alpha x constant alpha)

u8 LCDC_LayerConstAlpha

Specifies the Constant Alpha used for blending. This parameter can be a number between 0x00 and 0xff. Hardware divides the Constant Alpha value by 256. When Constant Alpha is 0xFF, it is identified as 1.

LCDC Exported Constants

LCDC IT Clear

RTL8730E:
/* Validates that IT is a legal LCDC interrupt clear bitmask. */
#define IS_LCDC_CLEAR_IT ((((IT) & (u32)0xFFFFFFD2) == 0x00) && ((IT) != 0x00))

LCDC DMA Underflow Mode

RTL8730E:
/* DMA underflow outputs last valid data. */
#define LCDC_DMAUNFW_OUTPUT_LASTDATA (0)

/* DMA underflow outputs configured error data. */
#define LCDC_DMAUNFW_OUTPUT_ERRORDATA (LCDC_BIT_DMA_UN_MODE)

/* Validates that MODE is a legal DMA underflow output mode. */
#define IS_LCDC_DMA_DMA_UNDERFLOW_MODE (((MODE) == LCDC_DMAUNFW_OUTPUT_LASTDATA) || ((MODE) == LCDC_DMAUNFW_OUTPUT_ERRORDATA))

LCDC DMA Debug Out

RTL8730E:
/* Enable secondary DMA write-back debug output. */
#define LCDC_DMA_OUT_ENABLE LCDC_BIT_LCD_DMA_OUT

/* Disable secondary DMA write-back debug output. */
#define LCDC_DMA_OUT_DISABLE (0)

/* Validates that MODE is a legal DMA debug output mode. */
#define IS_LCDC_DMA_DEBUG_OUT_MODE (((MODE) == LCDC_DMA_OUT_ENABLE) || ((MODE) == LCDC_DMA_OUT_DISABLE))

LCDC Layer Burst Size

RTL8730E:
/* DMA burst size: 1 x 64 bytes per burst. */
#define LCDC_LAYER_BURSTSIZE_1X64BYTES (0x1)

/* DMA burst size: 2 x 64 bytes per burst. */
#define LCDC_LAYER_BURSTSIZE_2X64BYTES (0x2)

/* DMA burst size: 3 x 64 bytes per burst. */
#define LCDC_LAYER_BURSTSIZE_3X64BYTES (0x3)

/* DMA burst size: 4 x 64 bytes per burst. */
#define LCDC_LAYER_BURSTSIZE_4X64BYTES (0x4)

/* Validates that x is a legal layer DMA burst size. */
#define IS_LCDC_LAYER_BURSTSIZE (((u32)(x) - 1) < LCDC_LAYER_BURSTSIZE_4X64BYTES)

LCDC Layer IMG Format

RTL8730E:
/* Layer image format: ARGB8888 (32-bit). */
#define LCDC_LAYER_IMG_FORMAT_ARGB8888 (0x0)

/* Layer image format: RGB888 (24-bit). */
#define LCDC_LAYER_IMG_FORMAT_RGB888 (0x1)

/* Layer image format: RGB565 (16-bit). */
#define LCDC_LAYER_IMG_FORMAT_RGB565 (0x2)

/* Layer image format: ARGB1555 (16-bit with 1-bit alpha). */
#define LCDC_LAYER_IMG_FORMAT_ARGB1555 (0x3)

/* Layer image format: ARGB4444 (16-bit with 4-bit alpha). */
#define LCDC_LAYER_IMG_FORMAT_ARGB4444 (0x4)

/* Layer image format: RGB666 (18-bit). */
#define LCDC_LAYER_IMG_FORMAT_RGB666 (0x5)

/* Layer image format: ARGB8666 (32-bit with 8-bit alpha). */
#define LCDC_LAYER_IMG_FORMAT_ARGB8666 (0x6)

/* Validates that MODE is a legal layer image format. */
#define IS_LCDC_LAYER_IMG_FORMAT ((u32)(MODE) <= LCDC_LAYER_IMG_FORMAT_ARGB8666)

LCDC Layer ID

RTL8730E:
/* LCDC layer index: layer 1 (first layer). */
#define LCDC_LAYER_LAYER1 (0x0)

/* LCDC layer index: layer 2 (second layer). */
#define LCDC_LAYER_LAYER2 (0x1)

/* LCDC layer index: layer 3 (third layer). */
#define LCDC_LAYER_LAYER3 (0x2)

/* Total number of available LCDC layers. */
#define LCDC_LAYER_MAX_NUM (0x3)

/* Validates that LayerID is a legal LCDC layer index. */
#define IS_LCDC_A_VALID_LAYER ((u32)(LayerID) <= LCDC_LAYER_LAYER3)

LCDC MCU IF Width Define

RTL8730E:

Not supported.

LCDC RGB IF Width Define

RTL8730E:

Not supported.

LCDC DMA Underflow Mode Define

RTL8730E:

Not supported.

LCDC DMA Underflow Option Define

RTL8730E:

Not supported.

LCDC DMA Mode Define

RTL8730E:

Not supported.

LCDC DMA Burst Size

RTL8730E:

Not supported.

LCDC INTR Type Define

RTL8730E:

Not supported.

LCDC INTR Status Define

RTL8730E:

Not supported.

LCDC RGB Sync Mode Define

RTL8730E:

Not supported.

LCDC RGB DMA Mode Define

RTL8730E:

Not supported.

LCDC RGB Data Pulse Polarity Define

RTL8730E:

Not supported.

LCDC RGB Enable Pulse Polarity Define

RTL8730E:

Not supported.

LCDC RGB HSYNC Pulse Polarity Define

RTL8730E:

Not supported.

LCDC RGB VSYNC Pulse Polarity Define

RTL8730E:

Not supported.

LCDC RGB DCLK Active Edge Define

RTL8730E:

Not supported.

LCDC RGB TE Pulse Polarity Define

RTL8730E:

Not supported.

LCDC MCU Swap Define

RTL8730E:

Not supported.

LCDC MCU Mode Define

RTL8730E:

Not supported.

LCDC MCU Sync Mode Define

RTL8730E:

Not supported.

LCDC MCU VSYNC Pulse Polarity Define

RTL8730E:

Not supported.

LCDC MCU TE Pulse Polarity Define

RTL8730E:

Not supported.

LCDC MCU Data Pulse Polarity Define

RTL8730E:

Not supported.

LCDC MCU Read Pulse Polarity Define

RTL8730E:

Not supported.

LCDC MCU Write Pulse Polarity Define

RTL8730E:

Not supported.

LCDC MCU RS Pulse Polarity Define

RTL8730E:

Not supported.

LCDC MCU CS Pulse Polarity Define

RTL8730E:

Not supported.

LCDC Input Format Define

RTL8730E:

Not supported.

LCDC Output Format Define

RTL8730E:

Not supported.

LCDC Pre-Command Define

RTL8730E:

Not supported.

LCDC Shift Offset Define

RTL8730E:

Not supported.

LCDC RW Parameter

RTL8730E:

Not supported.

LCDC Peripheral Definitions

RTL8730E:

Not supported.

LCDC Exported Functions

LCDC Interrupt Functions

void LCDC_ClearAllINT(LCDC_TypeDef *LCDCx)

Clear all of the LCDC interrupt pending bits.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

void LCDC_LineINTPosConfig(LCDC_TypeDef *LCDCx, u32 LineNum)

Configure line interrupt position.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • LineNum -- The specific line number at which the line interrupt is triggered.

RTL8730E:
void LCDC_ClearINT(LCDC_TypeDef *LCDCx, u32 LCDC_IT)

Clear the LCDC's interrupt pending bits.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • LCDC_IT --

    Specifies the interrupt to be cleared. This parameter can be any combination of the following values:

    • LCDC_BIT_FRM_START_INTS: DMA frame start interrupt

    • LCDC_BIT_LCD_LIN_INTS: Line interrupt

    • LCDC_BIT_LCD_FRD_INTS: LCD refresh frame done interrupt

    • LCDC_BIT_DMA_UN_INTS: DMA FIFO underflow interrupt

u32 LCDC_GetINTStatus(LCDC_TypeDef *LCDCx)

Get LCDC interrupt status.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

返回:

The interrupt status register value. Each bit indicates an interrupt source:

  • LCDC_BIT_FRM_START_INTS: DMA frame start interrupt status

  • LCDC_BIT_LCD_LIN_INTS: Line interrupt status

  • LCDC_BIT_LCD_FRD_INTS: LCD refresh frame done interrupt status

  • LCDC_BIT_DMA_UN_INTS: DMA FIFO underflow interrupt status

u32 LCDC_GetRawINTStatus(LCDC_TypeDef *LCDCx)

Get LCDC Raw Interrupt Status.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

返回:

The raw interrupt status register value. Each bit indicates an interrupt source:

  • LCDC_BIT_FRM_START_INTRS: DMA frame start raw interrupt status

  • LCDC_BIT_LCD_LIN_INTRS: Line raw interrupt status

  • LCDC_BIT_LCD_FRD_INTRS: LCD refresh frame done raw interrupt status

  • LCDC_BIT_DMA_UN_INTRS: DMA FIFO underflow raw interrupt status

void LCDC_INTConfig(LCDC_TypeDef *LCDCx, u32 LCDC_IT, u32 NewState)

Enable or disable the specified LCDC interrupts.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • LCDC_IT --

    Specifies the LCDC interrupts sources to be enabled or disabled. This parameter can be any combination of the following values:

    • LCDC_BIT_FRM_START_INTEN: DMA frame start interrupt

    • LCDC_BIT_LCD_LIN_INTEN: Line interrupt

    • LCDC_BIT_LCD_FRD_INTEN: LCD refresh frame done interrupt

    • LCDC_BIT_DMA_UN_INTEN: DMA FIFO underflow interrupt

  • NewState -- New state of the specified LCDC interrupts. This parameter can be: ENABLE or DISABLE.

void LCDC_GetDmaUnINTCnt(LCDC_TypeDef *LCDCx, u32 *DmaUnIntCnt)

Get the DMA FIFO underflow interrupt count.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • DmaUnIntCnt -- The DMA underflow interrupt count pointer.

LCDC Global Functions

void LCDC_Cmd(LCDC_TypeDef *LCDCx, u32 NewState)

Enable or disable the LCDC.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • NewState -- New state of the LCDC. This parameter can be: ENABLE or DISABLE.

备注

  • When NewState is DISABLE, the disable action will be performed instantly.

  • HW will reset LCDC internal states and disable LCDC, then clear both the disable bit and the enable bit (LCDCEN).

void LCDC_DeInit(LCDC_TypeDef *LCDCx)

Deinitialize the LCDC.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

备注

Disable LCDC instantly, clear and disable all interrupts.

void LCDC_GetCurPosStatus(LCDC_TypeDef *LCDCx, u32 *pCurPosX, u32 *pCurPosY)

Get the current position.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • pCurPosX -- The current X position pointer.

  • pCurPosY -- The current Y position pointer.

RTL8730E:
u8 LCDC_CheckLCDCReady(LCDC_TypeDef *LCDCx)

Check LCDC is ready to work with VO interface after LCDC is enabled.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

返回:

Status:

  • TRUE: Ready

  • FALSE: Not ready

void LCDC_Init(LCDC_TypeDef *LCDCx, LCDC_InitTypeDef *LCDC_InitStruct)

Initialize the LCDC according to the specified parameters in the LCDC_InitStruct.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • LCDC_InitStruct -- Pointer to a LCDC_InitTypeDef structure that contains the configuration information for all LCDC layers.

void LCDC_LayerConfig(LCDC_TypeDef *LCDCx, u8 LayerId, LCDC_LayerConfigTypeDef *EachLayer)

Initialize the LCDC Layer according to the specified parameters in the EachLayer.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • LayerId -- Specifies the LCDC layer to configure.

  • EachLayer -- Pointer to a LCDC_LayerConfigTypeDef structure that contains the configuration information for the specified LCDC layer.

void LCDC_SetBkgColor(LCDC_TypeDef *LCDCx, u8 red_color, u8 green_color, u8 blue_color)

Set the LCDC background color.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • red_color -- Red component of background color.

  • green_color -- Green component of background color.

  • blue_color -- Blue component of background color.

void LCDC_SetPlaneSize(LCDC_TypeDef *LCDCx, u32 ImageWidth, u32 ImageHeight)

Set the LCDC Plane Size.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • ImageWidth -- The width of image (X-channel based), which means pixel number per line.

  • ImageHeight -- The height of image (Y-channel based)

void LCDC_StructInit(LCDC_InitTypeDef *LCDC_InitStruct)

Fill each LCDC_InitTypeDef member with its default value.

参数:
  • LCDC_InitStruct -- Pointer to an LCDC_InitTypeDef structure which will be initialized.

void LCDC_TrigerSHWReload(LCDC_TypeDef *LCDCx)

Trigger Layer's shadow register reload to apply new configuration.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

备注

The shadow registers read back the active values. Until the reload has been done, the 'old' value is read.

LCDC DMA Configure Functions

RTL8730E:
void LCDC_DMADebugConfig(LCDC_TypeDef *LCDCx, u32 DmaWriteBack, u32 ImgDestAddr)

Configure LCDC DMA debug write back function.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • DmaWriteBack --

    Secondary RGB output port enabled, the blended data of entire image will be written back to memory. this parameter can be one of the following values:

    • LCDC_DMA_OUT_ENABLE: Enable the debug function

    • LCDC_DMA_OUT_DISABLE: Disable the debug function

  • ImgDestAddr -- Image DMA destination address. (for debug)

void LCDC_DMAModeConfig(LCDC_TypeDef *LCDCx, u32 BurstSize)

Configure LCDC DMA burst size.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • BurstSize --

    DMA burst size; Unit 64 Bytes.

    • LCDC_LAYER_BURSTSIZE_1X64BYTES: Burst Transactions = 1;

    • LCDC_LAYER_BURSTSIZE_2X64BYTES: Burst Transactions = 2;

    • LCDC_LAYER_BURSTSIZE_3X64BYTES: Burst Transactions = 3;

    • LCDC_LAYER_BURSTSIZE_4X64BYTES: Burst Transactions = 4;

备注

  • If the BurstSize=1, the actual burstsize = 1x64 Bytes; If the BurstSize=2, the actual burstsize = 2x64 = 128 Bytes; etc.

  • The parameter "BurstSize" value range: 1 to 4.

void LCDC_DMAUnderFlowConfig(LCDC_TypeDef *LCDCx, u32 DmaUnFlwMode, u32 ErrorData)

Configure LCDC DMA underflow mode and underflow error data.

参数:
  • LCDCx -- Where LCDCx can be LCDC.

  • DmaUnFlwMode --

    DMA underflow mode, this parameter can be one of the following values:

    • LCDC_DMAUNFW_OUTPUT_LASTDATA: output last data

    • LCDC_DMAUNFW_OUTPUT_ERRORDATA: output error data

  • ErrorData -- The output data when DMA FIFO underflow occurred. When underflow mode is configured as LCDC_DMAUNFW_OUTPUT_ERRORDATA, this parameter is needed, and otherwise it can be ignored.

LCDC MCU Interface Functions

RTL8730E:

Not supported.

LCDC RGB Interface Functions

RTL8730E:

Not supported.

常见问题排查

LCD 没有显示内容

现象

可能原因

解决方法

LCD无显示

  1. 背光电压异常

检查背光电压是否符合LCD规格

  1. 色深与位宽不匹配

确认设定输出像素格式与接口位宽匹配 接口位宽及色深

  1. 帧率过低

确保帧率达到LCD最低要求

  1. 初始化序列错误

(仅MCU LCD)

获取并应用正确的初始化序列

LCD 显示色调异常

现象

可能原因

解决方法

显示色调异常

(如:预期蓝色,实际显示红色)

  1. 像素格式设定与屏幕不匹配

  1. 检查输入输出格式设定

  2. 确保格式与屏幕接口输入要求一致

  1. 接口数据信号未连接成功

  1. 检查引脚复用配置正确

  2. 检查硬件接口信号连通

LCD 显示内容异常

现象

可能原因

解决方法

显示图案不符预期

内存像素数据错误

检查内存中的像素数据,确认与预期写入内容一致

LCD 显示抖动较严重

现象

可能原因

解决方法

LCD 显示抖动较严重

帧率过快

降低帧率,观察抖动现象是否得到改善