RGB 屏

  • 配置PAD为TTL模式:
    # vi infinity2m-ssc011a-s01a-padmux-display.dtsi
/*
* infinity2m-ssc011a-s01a-padmux-display.dtsi- Sigmastar
*
* Copyright (c) [2019~2020] SigmaStar Technology.
*
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License version 2 for more details.
*
*/

#include <../../../../drivers/sstar/include/infinity2m/padmux.h>
#include <../../../../drivers/sstar/include/mdrv_puse.h>

/ {
    soc {
         padmux {
            compatible = "sstar-padmux";
            schematic =
                //<PAD_GPIO0  >,
                <PAD_GPIO1          PINMUX_FOR_GPIO_MODE        MDRV_PUSE_I2C1_DEV_RESET >,
                <PAD_GPIO2          PINMUX_FOR_I2C1_MODE_1      MDRV_PUSE_I2C1_SCL >,
                <PAD_GPIO3          PINMUX_FOR_I2C1_MODE_1      MDRV_PUSE_I2C1_SDA >,
                <PAD_GPIO4             PINMUX_FOR_PWM0_MODE_3         MDRV_PUSE_PWM0 >,
                <PAD_GPIO5             PINMUX_FOR_PWM1_MODE_4         MDRV_PUSE_PWM1 >,
                <PAD_GPIO6          PINMUX_FOR_EJ_MODE_3        MDRV_PUSE_EJ_TDO >,
                <PAD_GPIO7          PINMUX_FOR_EJ_MODE_3        MDRV_PUSE_EJ_TDI >,
                //<PAD_GPIO8  >,
                //<PAD_GPIO9  >,
                //<PAD_GPIO10  >,
                <PAD_GPIO11         PINMUX_FOR_GPIO_MODE        MDRV_PUSE_I2CSW_SCL>,
                <PAD_GPIO12         PINMUX_FOR_GPIO_MODE        MDRV_PUSE_I2CSW_SDA>,
                <PAD_GPIO13         PINMUX_FOR_GPIO_MODE        MDRV_PUSE_I2C1_DEV_IRQ >,
                //<PAD_GPIO14  >,
                //<PAD_FUART_RX  >,
                //<PAD_FUART_TX       PINMUX_FOR_GPIO_MODE        MDRV_PUSE_UTMI_POWER>,
                <PAD_FUART_CTS       PINMUX_FOR_GPIO_MODE       MDRV_PUSE_CPUFREQ_VID0>,
                <PAD_FUART_RTS       PINMUX_FOR_GPIO_MODE       MDRV_PUSE_CPUFREQ_VID1>,
                <PAD_TTL0            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT00 >,
                <PAD_TTL1            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT01 >,
                <PAD_TTL2            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT02 >,
                <PAD_TTL3            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT03 >,
                <PAD_TTL4            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT04 >,
                <PAD_TTL5            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT05 >,
                <PAD_TTL6            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT06 >,
                <PAD_TTL7            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT07 >,
                <PAD_TTL8            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT08 >,
                <PAD_TTL9            PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT09 >,
                <PAD_TTL10           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT10 >,
                <PAD_TTL11           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT11 >,
                <PAD_TTL12           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT12 >,
                <PAD_TTL13           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT13 >,
                <PAD_TTL14           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT14 >,
                <PAD_TTL15           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT15 >,
                <PAD_TTL16           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT16 >,
                <PAD_TTL17           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT17 >,
                <PAD_TTL18           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT18 >,
                <PAD_TTL19           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT19 >,
                <PAD_TTL20           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT20 >,
                <PAD_TTL21           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT21 >,
                <PAD_TTL22           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT22 >,
                <PAD_TTL23           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DOUT23 >,
                <PAD_TTL24           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_CLK >,
                <PAD_TTL25           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_HSYNC >,
                <PAD_TTL26           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_VSYNC >,
                <PAD_TTL27           PINMUX_FOR_TTL_MODE_1      MDRV_PUSE_TTL_DE >,
                <PAD_UART0_RX         PINMUX_FOR_UART0_MODE_1       MDRV_PUSE_UART0_RX >,
                <PAD_UART0_TX         PINMUX_FOR_UART0_MODE_1       MDRV_PUSE_UART0_TX >,
                //<PAD_UART1_RX  >,
                //<PAD_UART1_TX  >,
                //<PAD_SD_CLK             PINMUX_FOR_I2S_MODE_3       MDRV_PUSE_I2S_BCK >,
                <PAD_GPIO0             PINMUX_FOR_GPIO_MODE      MDRV_PUSE_SDIO0_PWR >,
                <PAD_SD_CLK            PINMUX_FOR_SDIO_MODE_1       MDRV_PUSE_SDIO0_CLK >,
                //<PAD_SD_CMD             PINMUX_FOR_I2S_MODE_3       MDRV_PUSE_I2S_SDI >,
                <PAD_SD_CMD            PINMUX_FOR_SDIO_MODE_1       MDRV_PUSE_SDIO0_CMD >,
                //<PAD_SD_D0              PINMUX_FOR_I2S_MODE_3       MDRV_PUSE_I2S_WCK >,
                <PAD_SD_D0            PINMUX_FOR_SDIO_MODE_1       MDRV_PUSE_SDIO0_D0 >,
                <PAD_SD_D1              PINMUX_FOR_SDIO_MODE_1      MDRV_PUSE_SDIO0_D1>,
                <PAD_SD_D2              PINMUX_FOR_SDIO_MODE_1      MDRV_PUSE_SDIO0_D2>,
                //<PAD_SD_D3              PINMUX_FOR_I2S_MODE_3       MDRV_PUSE_I2S_SDO >,
                <PAD_SD_D3            PINMUX_FOR_SDIO_MODE_1      MDRV_PUSE_SDIO0_D3>,
                <PAD_PM_SD_CDZ          PINMUX_FOR_GPIO_MODE      MDRV_PUSE_SDIO0_CDZ>,
                <PAD_PM_IRIN            PINMUX_FOR_PM_IRIN_MODE     MDRV_PUSE_IR>,  // IR: default non-GPIO
                //<PAD_PM_SPI_CZ  >,                // default not-GPIO
                //<PAD_PM_SPI_CK  >,                // default not-GPIO
                //<PAD_PM_SPI_DI  >,                // default not-GPIO
                //<PAD_PM_SPI_DO  >,                // default not-GPIO
                //<PAD_PM_SPI_WPZ  >,               // default not-GPIO
                //<PAD_PM_SPI_HLD  >,               // default not-GPIO
                //<PAD_PM_LED0  >,
                //<PAD_PM_LED1  >,
                <PAD_SAR_GPIO0          PINMUX_FOR_SAR_MODE     MDRV_PUSE_SAR_GPIO0 >, // sar: default not-GPIO,
                //<PAD_SAR_GPIO1  >,                // sar: default not-GPIO
                //<PAD_SAR_GPIO2  >,                // sar: default not-GPIO
                //<PAD_ETH_RN  >,                   // ETH: default not-GPIO
                //<PAD_ETH_RP  >,                   // ETH: default not-GPIO
                //<PAD_ETH_TN  >,                   // ETH: default not-GPIO
                //<PAD_ETH_TP  >,                   // ETH: default not-GPIO
                <PAD_DM_P1              PINMUX_FOR_USB_MODE     MDRV_PUSE_UTMI1_DM >,  // utmi: default not-GPIO
                <PAD_DP_P1              PINMUX_FOR_USB_MODE     MDRV_PUSE_UTMI1_DP >,  // utmi: default not-GPIO
                <PAD_DM_P2              PINMUX_FOR_USB_MODE     MDRV_PUSE_UTMI2_DM >,  // utmi: default not-GPIO
                <PAD_DP_P2              PINMUX_FOR_USB_MODE     MDRV_PUSE_UTMI2_DP >,  // utmi: default not-GPIO
                //<PAD_HSYNC_OUT  >,
                //<PAD_VSYNC_OUT  >,
                <PAD_HDMITX_SCL PINMUX_FOR_DMIC_MODE_2 MDRV_PUSE_DMIC_D1 >,
                <PAD_HDMITX_SDA PINMUX_FOR_DMIC_MODE_2 MDRV_PUSE_DMIC_D0 >,
                <PAD_HDMITX_HPD PINMUX_FOR_DMIC_MODE_2 MDRV_PUSE_DMIC_CLK >,
                <PAD_HSYNC_OUT          PINMUX_FOR_IDAC_MODE        MDRV_PUSE_IDAC_HSYNC>,
                <PAD_VSYNC_OUT          PINMUX_FOR_IDAC_MODE        MDRV_PUSE_IDAC_VSYNC>;
                //<PAD_SATA_GPIO  >;
            status = "ok"; // ok or disable
            //status = "disable";
        };

    };

};

  • 从屏幕的数据手册中获得时序表:

  • 修改屏参
    从百度云链接————下载JpegPlayer.rar并解压,找到SAT070CP50_1024x600.h,在其基础上根据屏幕实际参数修改对应数据:
    注意:7寸开发板验证,屏参可参考百度云网盘:开发板—->LCD文件夹内的屏参
#include "mi_panel_datatype.h"

MI_PANEL_ParamConfig_t stPanelParam =
{
    "SAT070CP50_800x480_60", // const char *m_pPanelName;                ///<  PanelName
    0, //MS_U8 m_bPanelDither :1;                 ///<  PANEL_DITHER, keep the setting
    E_MI_PNL_LINK_TTL, //MHAL_DISP_ApiPnlLinkType_e m_ePanelLinkType   :4;  ///<  PANEL_LINK

    ///////////////////////////////////////////////
    // Board related setting
    ///////////////////////////////////////////////
    1,  //MS_U8 m_bPanelDualPort  :1;              ///<  VOP_21[8], MOD_4A[1],    PANEL_DUAL_PORT, refer to m_bPanelDoubleClk
    0,  //MS_U8 m_bPanelSwapPort  :1;              ///<  MOD_4A[0],               PANEL_SWAP_PORT, refer to "LVDS output app note" A/B channel swap
    0,  //MS_U8 m_bPanelSwapOdd_ML    :1;          ///<  PANEL_SWAP_ODD_ML
    0,  //MS_U8 m_bPanelSwapEven_ML   :1;          ///<  PANEL_SWAP_EVEN_ML
    0,  //MS_U8 m_bPanelSwapOdd_RB    :1;          ///<  PANEL_SWAP_ODD_RB
    0,  //MS_U8 m_bPanelSwapEven_RB   :1;          ///<  PANEL_SWAP_EVEN_RB

    0,  //MS_U8 m_bPanelSwapLVDS_POL  :1;          ///<  MOD_40[5], PANEL_SWAP_LVDS_POL, for differential P/N swap
    0,  //MS_U8 m_bPanelSwapLVDS_CH   :1;          ///<  MOD_40[6], PANEL_SWAP_LVDS_CH, for pair swap
    0,  //MS_U8 m_bPanelPDP10BIT      :1;          ///<  MOD_40[3], PANEL_PDP_10BIT ,for pair swap
    1,  //MS_U8 m_bPanelLVDS_TI_MODE  :1;          ///<  MOD_40[2], PANEL_LVDS_TI_MODE, refer to "LVDS output app note"

    ///////////////////////////////////////////////
    // For TTL Only
    ///////////////////////////////////////////////
    0,  //MS_U8 m_ucPanelDCLKDelay;                ///<  PANEL_DCLK_DELAY
    0,  //MS_U8 m_bPanelInvDCLK   :1;              ///<  MOD_4A[4],                   PANEL_INV_DCLK
    0,  //MS_U8 m_bPanelInvDE     :1;              ///<  MOD_4A[2],                   PANEL_INV_DE
    0,  //MS_U8 m_bPanelInvHSync  :1;              ///<  MOD_4A[12],                  PANEL_INV_HSYNC
    0,  //MS_U8 m_bPanelInvVSync  :1;              ///<  MOD_4A[3],                   PANEL_INV_VSYNC

    ///////////////////////////////////////////////
    // Output driving current setting
    ///////////////////////////////////////////////
    // driving current setting (0x00=4mA, 0x01=6mA, 0x02=8mA, 0x03=12mA)
    1,  //MS_U8 m_ucPanelDCKLCurrent;              ///<  define PANEL_DCLK_CURRENT
    1,  //MS_U8 m_ucPanelDECurrent;                ///<  define PANEL_DE_CURRENT
    1,  //MS_U8 m_ucPanelODDDataCurrent;           ///<  define PANEL_ODD_DATA_CURRENT
    1,  //MS_U8 m_ucPanelEvenDataCurrent;          ///<  define PANEL_EVEN_DATA_CURRENT

    ///////////////////////////////////////////////
    // panel on/off timing
    ///////////////////////////////////////////////
    30,  //MS_U16 m_wPanelOnTiming1;                ///<  time between panel & data while turn on power
    400,  //MS_U16 m_wPanelOnTiming2;                ///<  time between data & back light while turn on power
    80,  //MS_U16 m_wPanelOffTiming1;               ///<  time between back light & data while turn off power
    30,  //MS_U16 m_wPanelOffTiming2;               ///<  time between data & panel while turn off power

    ///////////////////////////////////////////////
    // panel timing spec.
    ///////////////////////////////////////////////
    // sync related
    48,  //MS_U8 m_ucPanelHSyncWidth;               ///<  VOP_01[7:0], PANEL_HSYNC_WIDTH
    46,  //MS_U8 m_ucPanelHSyncBackPorch;           ///<  PANEL_HSYNC_BACK_PORCH, no register setting, provide value for query only

                                             ///<  not support Manuel VSync Start/End now
                                             ///<  VOP_02[10:0] VSync start = Vtt - VBackPorch - VSyncWidth
                                             ///<  VOP_03[10:0] VSync end = Vtt - VBackPorch
    4,  //MS_U8 m_ucPanelVSyncWidth;               ///<  define PANEL_VSYNC_WIDTH
    23,  //MS_U8 m_ucPanelVBackPorch;               ///<  define PANEL_VSYNC_BACK_PORCH

    // DE related
    98,  //MS_U16 m_wPanelHStart;                   ///<  VOP_04[11:0], PANEL_HSTART, DE H Start (PANEL_HSYNC_WIDTH + PANEL_HSYNC_BACK_PORCH)
    27,  //MS_U16 m_wPanelVStart;                   ///<  VOP_06[11:0], PANEL_VSTART, DE V Start
    1024,  //MS_U16 m_wPanelWidth;                    ///< PANEL_WIDTH, DE width (VOP_05[11:0] = HEnd = HStart + Width - 1)
    600,  //MS_U16 m_wPanelHeight;                   ///< PANEL_HEIGHT, DE height (VOP_07[11:0], = Vend = VStart + Height - 1)

    // DClk related
    1400,  //MS_U16 m_wPanelMaxHTotal;                ///<  PANEL_MAX_HTOTAL. Reserved for future using.
    1344,  //MS_U16 m_wPanelHTotal;                   ///<  VOP_0C[11:0], PANEL_HTOTAL
    1114,  //MS_U16 m_wPanelMinHTotal;                ///<  PANEL_MIN_HTOTAL. Reserved for future using.

    800,  //MS_U16 m_wPanelMaxVTotal;                ///<  PANEL_MAX_VTOTAL. Reserved for future using.
    635,  //MS_U16 m_wPanelVTotal;                   ///<  VOP_0D[11:0], PANEL_VTOTAL
    610,  //MS_U16 m_wPanelMinVTotal;                ///<  PANEL_MIN_VTOTAL. Reserved for future using.

    67,  //MS_U8 m_dwPanelMaxDCLK;                  ///<  PANEL_MAX_DCLK. Reserved for future using.
    51,  //MS_U8 m_dwPanelDCLK;                     ///<  LPLL_0F[23:0], PANEL_DCLK          ,{0x3100_10[7:0], 0x3100_0F[15:0]}
    40,  //MS_U8 m_dwPanelMinDCLK;                  ///<  PANEL_MIN_DCLK. Reserved for future using.
                                             ///<  spread spectrum
    25,  //MS_U16 m_wSpreadSpectrumStep;            ///<  move to board define, no use now.
    192,  //MS_U16 m_wSpreadSpectrumSpan;            ///<  move to board define, no use now.

    160,  //MS_U8 m_ucDimmingCtl;                    ///<  Initial Dimming Value
    255,  //MS_U8 m_ucMaxPWMVal;                     ///<  Max Dimming Value
    80,  //MS_U8 m_ucMinPWMVal;                     ///<  Min Dimming Value

    0,  //MS_U8 m_bPanelDeinterMode   :1;          ///<  define PANEL_DEINTER_MODE,  no use now
    E_MI_PNL_ASPECT_RATIO_WIDE,  //MHAL_DISP_PnlAspectRatio_e m_ucPanelAspectRatio; ///<  Panel Aspect Ratio, provide information to upper layer application for aspect ratio setting.
  /*
    *
    * Board related params
    *
    *  If a board ( like BD_MST064C_D01A_S ) swap LVDS TX polarity
    *    : This polarity swap value =
    *      (LVDS_PN_SWAP_H<<8) | LVDS_PN_SWAP_L from board define,
    *  Otherwise
    *    : The value shall set to 0.
    */
    0,  //MS_U16 m_u16LVDSTxSwapValue;
    E_MI_PNL_TI_8BIT_MODE,  //MHAL_DISP_ApiPnlTiBitMode_e m_ucTiBitMode;                         ///< MOD_4B[1:0], refer to "LVDS output app note"
    E_MI_PNL_OUTPUT_8BIT_MODE,  //MHAL_DISP_ApiPnlOutPutFormatBitMode_e m_ucOutputFormatBitMode;

    3,  //MS_U8 m_bPanelSwapOdd_RG    :1;          ///<  define PANEL_SWAP_ODD_RG
    2,  //MS_U8 m_bPanelSwapEven_RG   :1;          ///<  define PANEL_SWAP_EVEN_RG
    1,  //MS_U8 m_bPanelSwapOdd_GB    :1;          ///<  define PANEL_SWAP_ODD_GB
    1,  //MS_U8 m_bPanelSwapEven_GB   :1;          ///<  define PANEL_SWAP_EVEN_GB

    /**
    *  Others
    */
    1,  //MS_U8 m_bPanelDoubleClk     :1;             ///<  LPLL_03[7], define Double Clock ,LVDS dual mode
    0x001c848e,  //MS_U32 m_dwPanelMaxSET;                     ///<  define PANEL_MAX_SET
    0x0018eb59,  //MS_U32 m_dwPanelMinSET;                     ///<  define PANEL_MIN_SET
    E_MI_PNL_CHG_VTOTAL,  //MHAL_DISP_ApiPnlOutTimingMode_e m_ucOutTimingMode;   ///<Define which panel output timing change mode is used to change VFreq for same panel
    0,  //MS_U8 m_bPanelNoiseDith     :1;             ///<  PAFRC mixed with noise dither disable
    (MI_PANEL_ChannelSwapType_e)0,
    (MI_PANEL_ChannelSwapType_e)1,
    (MI_PANEL_ChannelSwapType_e)2,
    (MI_PANEL_ChannelSwapType_e)3,
    (MI_PANEL_ChannelSwapType_e)4,
};


MI_PANEL_MipiDsiConfig_t stMipiDsiConfig =
{

};

关注以下变量的值:
m_ucPanelHSyncWidth = HSYNC.(FrontPorch) + HSYNC.(PulseWidth)
m_ucPanelHSyncBackPorch = HSYNC.(BackPorch)
m_ucPanelVSyncWidth = VSYNC.(FrontPorch) + VSYNC.(PulseWidth)
m_ucPanelVBackPorch = VSYNC.(BackPorch)
m_wPanelHStart = m_ucPanelHSyncWidth + m_ucPanelHSyncBackPorch
m_wPanelVStart = m_ucPanelVSyncWidth + m_ucPanelVBackPorch
m_wPanelWidth = HSYNC.(DisplayPeriod)
m_wPanelHeight = VSYNC.(DisplayPeriod)

m_wPanelMaxHTotal
=m_wPanelHTotal
=m_wPanelMinHTotal
=m_wPanelHStart + m_wPanelWidth

m_dwPanelMaxDCLK
=m_dwPanelDCLK
=m_dwPanelMinDCLK
=m_wPanelHTotalm_wPanelVTotalFPS(自定义)

(DCLKFrequency).min <= m_dwPanelMaxDCLK <= (DCLKFrequency).max


  • 修改swap的值
    3,  //MS_U8 m_bPanelSwapOdd_RG    :1;          ///<  define PANEL_SWAP_ODD_RG
    2,  //MS_U8 m_bPanelSwapEven_RG   :1;          ///<  define PANEL_SWAP_EVEN_RG
    1,  //MS_U8 m_bPanelSwapOdd_GB    :1;          ///<  define PANEL_SWAP_ODD_GB
    1,  //MS_U8 m_bPanelSwapEven_GB   :1;          ///<  define PANEL_SWAP_EVEN_GB

默认情况下各个TTL引脚与RGB对应关系如下:


如果实际连线不是默认的连线,则需要修改swap值。需要关注以下4个值:
m_bPanelSwapOdd_RG,其值为0或3时,对应R;值为1时,对应B;值为2时,对应G;

m_bPanelSwapEven_RG,其值为0或2时,对应G;值为1时,对应B;值为3时,对应R;

m_bPanelSwapOdd_GB,其值为0或1时,对应B;值为3时,对应R;值为2时,对应G;

m_bPanelSwapEven_GB,其值为0时,RGB高低位不反转;值为1时,RGB高低位反转;

在高低位不反转的情况下,引脚对应关系如下:


高低位反转后,引脚对应关系变为:

文档更新时间: 2021-03-22 14:04   作者:Aeeditor