Edit online

屏幕配置

8 Nov 2024
Read time: 7 minute(s)

屏幕的调试尽量在 RT-Thread 中完成,然后再移植到 Bootloader 中。

RGB

调试 RGB 屏时,仅需在相应的配置文件中加入规格书描述的时序和规格参数,无需添加额外的驱动程序。具体流程如下所示:

Luban-Lite 根目录下执行 me,进入 menuconfig 的功能配置界面。

  1. 选择显示接口 Display RGB interface
    Board options  --->
        [*] Using Display Engine (DE)
            Display Parameter  --->
                select Display interface (Display RGB interface)  --->
                RGB interface options  --->
    
  2. 配置 RGB interface options 中的接口参数:
    Board options  --->
     Graphics Support  --->
         Graphics support
             [*] Display Support
                 select Display interface (Display RGB interface)  --->
                 RGB interface options  --->
                     rgb mode (PRGB)  --->
                     interface format (PRGB 16 BIT LD)  --->
                     data order (RGB)  --->
                     clock phase select(0 degree)  --->
    
  3. 配置屏参数:
    Board options  --->
        Graphics Support  --->
            Graphics support
                [*] Display Support
                    select Display interface (Display RGB interface)  --->
                    RGB interface options  --->
                    Display Panels  --->
                        ArtInChip Panel Drivers (ArtInChip simple panel)  --->
                        display timing of simple panel  --->
    
  4. 编辑 pinmux.c 文件配置引脚。

    demo128-nand 工程为例,在配置文件 target/d21x/demo128-nand/pinmux.c 中添加以下配置:

    #ifdef AIC_PRGB_16BIT_LD
        {2, PIN_PULL_DIS, 3, "PD.8"},
        {2, PIN_PULL_DIS, 3, "PD.9"},
        {2, PIN_PULL_DIS, 3, "PD.10"},
        {2, PIN_PULL_DIS, 3, "PD.11"},
        {2, PIN_PULL_DIS, 3, "PD.12"},
        {2, PIN_PULL_DIS, 3, "PD.13"},
        {2, PIN_PULL_DIS, 3, "PD.14"},
        {2, PIN_PULL_DIS, 3, "PD.15"},
        {2, PIN_PULL_DIS, 3, "PD.16"},
        {2, PIN_PULL_DIS, 3, "PD.17"},
        {2, PIN_PULL_DIS, 3, "PD.18"},
        {2, PIN_PULL_DIS, 3, "PD.19"},
        {2, PIN_PULL_DIS, 3, "PD.20"},
        {2, PIN_PULL_DIS, 3, "PD.21"},
        {2, PIN_PULL_DIS, 3, "PD.22"},
        {2, PIN_PULL_DIS, 3, "PD.23"},
        {2, PIN_PULL_DIS, 3, "PD.24"},
        {2, PIN_PULL_DIS, 3, "PD.25"},
        {2, PIN_PULL_DIS, 3, "PD.26"},
        {2, PIN_PULL_DIS, 3, "PD.27"},
    #endif

LVDS

调试 LVDS 屏时,仅需在相应的配置文件中添加规格书中所描述的时序和规格参数,无需额外添加驱动程序。

Luban-Lite 根目录下执行 me,进入 menuconfig 的功能配置界面。

  1. 选择显示接口:
    Board options  --->
        [*] Using Display Engine (DE)
            Display Parameter  --->
                select Display interface (Display LVDS interface)  --->
                LVDS interface options  --->
    
  2. 配置下列接口参数:
    Board options  --->
      Graphics Support  --->
          Graphics support
              [*] Display Support
                  select Display interface (Display LVDS interface)  --->
                  LVDS interface options  --->
                      lvds mode (vesa-24)  --->
                      lvds link mode (single link 1)  --->
    
  3. 配置屏参数:
    Board options  --->
        Graphics Support  --->
            Graphics support
                [*] Display Support
                    select Display interface (Display LVDS interface)  --->
                    LVDS interface options  --->
                    Display Panels  --->
                        ArtInChip Panel Drivers (ArtInChip simple panel)  --->
                        display timing of simple panel  --->
    
  4. 编辑 pinmux.c 文件配置引脚。

    以 demo128-nand 工程为例,在 target/d21x/demo128-nand/pinmux.c 中添加以下配置:

    #ifdef AIC_LVDS_LINK_1
        {3, PIN_PULL_DIS, 3, "PD.8"},
        {3, PIN_PULL_DIS, 3, "PD.9"},
        {3, PIN_PULL_DIS, 3, "PD.10"},
        {3, PIN_PULL_DIS, 3, "PD.11"},
        {3, PIN_PULL_DIS, 3, "PD.12"},
        {3, PIN_PULL_DIS, 3, "PD.13"},
        {3, PIN_PULL_DIS, 3, "PD.14"},
        {3, PIN_PULL_DIS, 3, "PD.15"},
        {3, PIN_PULL_DIS, 3, "PD.16"},
        {3, PIN_PULL_DIS, 3, "PD.17"},
    #endif

MIPI

Luban-Lite 根目录下执行 me,进入 menuconfig 的功能配置界面。
  1. 配置显示接口:
    Board options  --->
        [*] Using Display Engine (DE)
            Display Parameter  --->
                select Display interface (Display MIPI-DSI interface)  --->
  2. 新增一款屏驱动。根据屏接口类型选择一个模板,拷贝该模板文件,命名为panel_dsi_xxx.c
    • MIPI-DSI 接口可参考 panel_dsi_xm91080.c

    • MIPI-DBI 接口可参考 panel_dbi_ili9486l.c

    因为每一款 MIPI 屏幕的参数都不尽相同,ArtInChip 平台不支持 menuconfig 配置 MIPI 屏幕参数。,,推荐在 panel 驱动中使用 hardcode 的形式进行配置。

  3. 使用下列方式将重新命名的文件添加进 Kconfig 和 SConscript 文件中:
    // bsp/artinchip/drv/display/panel/Kconfig
    config AIC_PANEL_DSI_XXX
        bool "ArtInChip MIPI DSI xxx panel" depends on AIC_DISP_MIPI_DSI
    # bsp/artinchip/SConscript
    if GetDepend('AIC_PANEL_DSI_XXX'):
        src += Glob('drv/display/panel/panel_dsi_xxx.c')
  4. 修改 struct aic_panel 的命名,并注册 struct aic_panel
    1. struct aic_panel 添加到 panel_com.c 文件的 panels[] 指针数组中。
      // panel_com.c
      static struct aic_panel *panels[] = {
          ...
          #ifdef AIC_PANEL_DSI_XXX
              &dsi_xxx,
          #endif
      };
    2. panel_com.h 文件中 extern struct aic_panel
      // panel_com.h
      extern struct aic_panel dsi_xxx;
  5. 修改 struct display_timing 结构体,根据 LCD 屏幕规格书修改时序参数。
    static struct display_timing xm91080_timing = {
        .pixelclock = 130000000,
        .hactive = 1080,
        .hfront_porch = 160,
        .hback_porch = 160,
        .hsync_len = 40,
        .vactive = 1920,
        .vfront_porch = 10,
        .vback_porch = 20,
        .vsync_len = 8,
    };
  6. 重新实现 aic_panel_funcs 结构体中的 prepare 或者 enable 接口,添加初始化操作。
  7. 在 menuconfig 的功能配置界面选择此屏,以 xm91080 panel 为例:
    Board options  --->
        Graphics Support  --->
            Graphics support
                [*] Display Support
                    select Display interface (Display MIPI-DSI interface)  --->
                    Display Panels  --->
                        ArtInChip Panel Drivers (ArtInChip MIPI DSI xm91080 panel)  --->
  8. 配置 MIPI 引脚。
    demo128-nand 工程为例,在 target/d21x/demo128-nand/pinmux.c 中添加以下参数:
    #ifdef AIC_DISP_MIPI_DSI
        {4, PIN_PULL_DIS, 3, "PD.18"},
        {4, PIN_PULL_DIS, 3, "PD.19"},
        {4, PIN_PULL_DIS, 3, "PD.20"},
        {4, PIN_PULL_DIS, 3, "PD.21"},
        {4, PIN_PULL_DIS, 3, "PD.22"},
        {4, PIN_PULL_DIS, 3, "PD.23"},
        {4, PIN_PULL_DIS, 3, "PD.24"},
        {4, PIN_PULL_DIS, 3, "PD.25"},
        {4, PIN_PULL_DIS, 3, "PD.26"},
        {4, PIN_PULL_DIS, 3, "PD.27"},
    #endif

背光配置

根据是否需要调节背光亮度,用户可以选择以下任意方式控制背光:
  • GPIO 控制背光:如果没有调节背光亮度需求,仅仅是亮或黑屏。

    打开 menuconfig 配置界面,选择 GPIO 方式控制背光,以字符串的形式指定 GPIO 引脚,背光 GPIO 引脚默认高电平有效。

    Board options  --->
        [*] Using Display Engine (DE)
            Display Parameter  --->
                panel backlight control (gpio)  --->
            (PE.19) panel backlight enable pin
            [ ] panel backlight enable pin low active
  • PWM 控制背光:如果有调节背光亮度的需求。
    1. 打开 menuconfig 配置界面。,
    2. 使能 PWM,选择 PWM 方式控制背光。
      Board options  --->
          [*] Using PWM3
    3. 配置 PWM-BACKLIGHT 的通道和默认占空比 [0, 100]
      Board options  --->
          [*] Using Display Engine (DE)
              Display Parameter  --->
                  panel backlight control (pwm)  --->
              (3) pwm backlight channel
              (80)default brightness level