1683 views|8 replies

931

Posts

3

Resources
The OP
 

Does anyone know how to drive the LCD screen on the GD32F450z_EVAL development board? [Copy link]

A GD32F450Z_EVAL development board with a 3.5-inch LCD color screen. The official DEMO only found an example of displaying animated pictures in tli mode, but no relevant code for writing to a specified position on the screen in LCD mode. I also don't know what driver chip this LCD screen uses and its data sheet. I would like to ask for your help. It would be best if you have an example, or you can provide the data sheet of the LCD screen. Thank you in advance!

The following figure shows the overall picture of the development board:

Here are the details of the screen:

This is the official DEMO:

There seem to be two display modes in the analysis example: LCD and TLI:

This is the official TLI mode display animation:

There is no function in the official example to write the specified position on the LCD screen:

This post is from GD32 MCU

Latest reply

static void tli_config(void) { tli_parameter_struct tli_init_struct; tli_layer_parameter_struct tli_layer_init_struct; rcu_periph_clock_enable(RCU_TLI); tli_gpio_config(); rcu_pll_input_output_clock_range_config(IDX_PLL2, RCU_PLL2RNG_1M_2M, RCU_PLL2VCO_150M_420M); /* configure the PLL2 clock: CK_PLL2P/CK_PLL2Q/CK_PLL2R = HXTAL_VALUE / 25 * 150 / 3 */ if(ERROR == rcu_pll2_config(25, 150, 3, 3, 3)) { while(1) { } } rcu_pll_clock_output_enable(RCU_PLL2R); rcu_tli_clock_div_config(RCU_PLL2R_DIV8); rcu_osci_on(RCU_PLL2_CK); if(ERROR == rcu_osci_stab_wait(RCU_PLL2_CK)) { while(1) { } } /* configure TLI parameter struct */ tli_init_struct.signalpolarity_hs = TLI_HSYN_ACTLIVE_LOW; //水平同步极性 tli_init_struct.signalpolarity_vs = TLI_VSYN_ACTLIVE_LOW; //垂直同步极性 tli_init_struct.signalpolarity_de = TLI_DE_ACTLIVE_LOW; //数据使能极性 tli_init_struct.signalpolarity_pixelck = TLI_PIXEL_CLOCK_TLI; //像素时钟极性 /* LCD display timing configuration */ tli_init_struct.synpsz_hpsz = HORIZONTAL_SYNCHRONOUS_PULSE - 1; //水平同步 tli_init_struct.synpsz_vpsz = VERTICAL_SYNCHRONOUS_PULSE - 1; //垂直同步宽度 tli_init_struct.backpsz_hbpsz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH - 1; //水平同步后沿宽度 tli_init_struct.backpsz_vbpsz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH - 1; //垂直同步后沿高度 tli_init_struct.activesz_hasz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH + ACTIVE_WIDTH - 1; //有效宽度 tli_init_struct.activesz_vasz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH + ACTIVE_HEIGHT - 1; //有效高度 tli_init_struct.totalsz_htsz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH + ACTIVE_WIDTH + //总宽度 HORIZONTAL_FRONT_PORCH - 1; tli_init_struct.totalsz_vtsz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH + ACTIVE_HEIGHT + //总高度 VERTICAL_FRONT_PORCH - 1; /* configure LCD background R,G,B values */ tli_init_struct.backcolor_red = 0xFF; //背景设为白色 tli_init_struct.backcolor_green = 0xFF; tli_init_struct.backcolor_blue = 0xFF; tli_init(&tli_init_struct); /* TLI layer configuration 层初始化配置 */ tli_layer_init_struct.layer_window_leftpos = 80 + HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH + 2; tli_layer_init_struct.layer_window_rightpos = (80 + 320 + HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH - 1); tli_layer_init_struct.layer_window_toppos = 150 + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH; tli_layer_init_struct.layer_window_bottompos = (150 + 100 + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH - 1); tli_layer_init_struct.layer_ppf = LAYER_PPF_RGB565; tli_layer_init_struct.layer_sa = 0xFF; //层透明度 255 为完全不透明 tli_layer_init_struct.layer_default_blue = 0xFF; tli_layer_init_struct.layer_default_green = 0xFF; tli_layer_init_struct.layer_default_red = 0xFF; tli_layer_init_struct.layer_default_alpha = 0x0; //该层显示范围外的颜色 tli_layer_init_struct.layer_acf1 = LAYER_ACF1_PASA; //层混模式 归一化的像素alpha 乘以归一化的恒定 alpha tli_layer_init_struct.layer_acf2 = LAYER_ACF2_PASA; //归一化gImage_logo的像素alhpa, tli_layer_init_struct.layer_frame_bufaddr = (uint32_t)&gImage_logo;; //缓存地址 tli_layer_init_struct.layer_frame_line_length = ((320 * 2) + 3); //行长度 这个值为一行的字节数+3 tli_layer_init_struct.layer_frame_buf_stride_offset = (320 * 2); //步幅偏移,定义了从某行起始处到下一行起始处之间的字节数 tli_layer_init_struct.layer_frame_total_line_number = 100; //总行数 定义了一帧行数 tli_layer_init(LAYER0, &tli_layer_init_struct); } I saw that the screen driver looks like this:   Details Published on 2024-3-3 09:16
 

9702

Posts

24

Resources
2
 

I see that there are functions that can directly write images in the examples, such as ipa_config((uint32_t)&gImage_image1);. In this case, can the data corresponding to gImage_image1 be manipulated to modify the specified position on the screen? In this case, you can find some examples of other microcontrollers and transplant the corresponding functions.

This post is from GD32 MCU

Comments

I analyzed the Logo image data and tried to add a box around the image, which was initially successful. The following figure shows the addition of left and right vertical lines and some horizontal lines. Since the verification was successful, I did not continue to modify the data to close the box. [attachimg]644776[/attachimg] &  Details Published on 2022-9-27 10:36
 
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 

6818

Posts

11

Resources
3
 

Take the screen off and look at the silk screen on the back. If you can't take it off, look at the initialization register of init and compare them to find out. Also, just check the documentation of this development board, and you should be able to find the sample code.

This post is from GD32 MCU
 
 
 

931

Posts

3

Resources
4
 
littleshrimp posted on 2022-9-26 20:21 I see there are functions in the example that directly write images, such as ipa_config((uint32_t)&gImage_image1);, so does this mean that gImag ...

I analyzed the Logo image data and tried to add a box around the image, with initial success. The picture below shows the addition of left and right vertical lines and some horizontal lines. Because the verification was successful, I did not continue to modify the data to close the box.

After preliminary analysis of the image data, this logo image is 320*162 dot matrix pixels, and each pixel data is 2 bytes.

If this solution is used, a display buffer of 320*480*2=307200 bytes, or 300k of flash, needs to be created. Moreover, it is not clear how to set the starting point, width, and height of the image, so it is quite difficult. If a simpler method can be found, it should be easier.

This post is from GD32 MCU
 
 
 

931

Posts

3

Resources
5
 
lugl4313820 posted on 2022-9-26 22:57 Take off the screen and look at the silk screen on the back. If you can't take it off, look at the initialization register of init and compare it to know. Also, check...

There is no silkscreen information about the driver chip on the back of the screen:

The silkscreen information of the chip in the upper right corner is as follows, which does not look like a driver chip:

The information I found on the manufacturer's official website is limited, and Baidu can't find more information. I only found three versions of information:

The latest version of TLI example has 4 LCD models, I am using the second one V1.2:

I can't see any information about the driver chip from the code:

void lcd_power_on1(void)
{
    lcd_command_write(0xC0); //power control1 command电源控制1命令/w/
    lcd_data_write(0x0A);    //P-Gamma level伽马水平//4.1875v
    lcd_data_write(0x0A);    //N-Gamma level
    lcd_command_write(0xC1); //BT & VC Setting//power contrl2 command/w/
    lcd_data_write(0x41);
    lcd_data_write(0x07);    //VCI1 = 2.5V
    lcd_command_write(0xC2); //DC1.DC0 Setting//power control3 for normal mode
    lcd_data_write(0x33);
    lcd_command_write(0xC5); //VCOM control
    lcd_data_write(0x00);    //NV memory is not programmed NV存储器未编程
    lcd_data_write(0x42);    //VCM Setting
    lcd_data_write(0x80);    //VCM Register Enable
    lcd_command_write(0xB0); //interface mode control //Polarity Setting 接口模式控制//极性设置
    lcd_data_write(0x02);
    lcd_command_write(0xB1); //frame rate control for normal mode 正常模式的帧速率控制
    lcd_data_write(0xB0);    //Frame Rate Setting//70 frame per second//no division for internal clocks 帧速率设置//每秒70帧//内部时钟无分割
    lcd_data_write(0x11);    //17 clocks per line period for idle mode at cpu interface CPU接口的空闲模式每行周期17个时钟
    lcd_command_write(0xB4); //dispaly inversion control 显示反转控制
    lcd_data_write(0x00);    // disable Z-inversion , column inversion 禁用Z反转、列反转
    lcd_command_write(0xB6); //display function control// RM.DM Setting 显示功能控制//RM。DM设置
    lcd_data_write(0x70);    //0xF0
    lcd_data_write(0x02);    //direction of gate scan: G1->G480 one by one, source scan: S1->S960, scan cycle if interval scan in non-display area
	                         //门扫描方向:G1->G480逐个,源扫描:S1->S960,非显示区间隔扫描时扫描周期
    lcd_data_write(0x3B);    //number of lines to drive LCD: 8*(0x3C) = 480 驱动LCD的行数:8*(0x3C)=480
    lcd_command_write(0xB7); //Entry Mode 进入模式
    lcd_data_write(0x07);    //disable low voltage detection, normal display 禁用低压检测,正常显示,
    lcd_command_write(0xF0); //Enter ENG , must be set before gamma setting 输入ENG,必须在gamma设置之前设置
    lcd_data_write(0x36);
    lcd_data_write(0xA5);
    lcd_data_write(0xD3);
    lcd_command_write(0xE5); //Open gamma function , must be set before gamma setting打开伽马函数,必须在伽马设置之前设置
    lcd_data_write(0x80);
    lcd_command_write(0xE5); //Page 1
    lcd_data_write(0x01);
    lcd_command_write(0XB3); //WEMODE=0(Page 1) , pixels over window setting will be ignored.//frame rate control in partial mode/full colors
	                         //WEMODE=0(第1页),窗口设置上方的像素将被忽略//部分模式/全色的帧速率控制
    lcd_data_write(0x00);
    lcd_command_write(0xE5); //Page 0
    lcd_data_write(0x00);
    lcd_command_write(0xF0); //Exit ENG , must be set before gamma setting 退出ENG,必须在gamma设置之前设置
    lcd_data_write(0x36);
    lcd_data_write(0xA5);
    lcd_data_write(0x53);
    lcd_command_write(0xE0); //Gamma setting
    //y fine adjustment register for positive polarity y正极微调寄存器
    lcd_data_write(0x00);
    lcd_data_write(0x35);
    lcd_data_write(0x33);
    //y gradient adjustment register for positive polarity 正极性y梯度调整寄存器
    lcd_data_write(0x00);
    //y amplitude adjustment register for positive polarity 正极性的y振幅调整寄存器
    lcd_data_write(0x00);
    lcd_data_write(0x00);
    //y fine adjustment register for negative polarity y负极性微调寄存器
    lcd_data_write(0x00);
    lcd_data_write(0x35);
    lcd_data_write(0x33);
    //y gradient adjustment register for negative polarity 负极性y梯度调整寄存器
    lcd_data_write(0x00);
    //y amplitude adjustment register for negative polarity 负极性的y振幅调整寄存器
    lcd_data_write(0x00);
    lcd_data_write(0x00);
    lcd_command_write(0x36); //memory data access control 存储器数据访问控制
    lcd_data_write(0x48);
    lcd_command_write(0x3A); //interface pixel format setting 界面像素格式设置
    lcd_data_write(0x55);    //16-bits
    lcd_command_write(0x11); //Exit sleep mode
    lcd_command_write(0x29); //Display on 

    delay(10);
}

This post is from GD32 MCU

Comments

The MCU screen seems to be processed in terms of timing.  Details Published on 2024-3-3 09:13
 
 
 

931

Posts

3

Resources
6
 

The LCD driver chip cannot be found on the development board:

This post is from GD32 MCU

Comments

Can the RGB screen be driven by simply outputting signals without interacting with the screen?  Details Published on 2024-3-3 09:14
 
 
 

6818

Posts

11

Resources
7
 
hujj posted on 2022-9-27 10:52 There is no silkscreen information of the driver chip on the back of the screen: The silkscreen information of the chip in the upper right corner is as follows, which does not look like a driver chip: ...

The MCU screen seems to be processed in terms of timing.

This post is from GD32 MCU
 
 
 

6818

Posts

11

Resources
8
 
hujj posted on 2022-9-27 11:02 The LCD driver chip cannot be found on the development board:

Can the RGB screen be driven by simply outputting signals without interacting with the screen?

This post is from GD32 MCU
 
 
 

6818

Posts

11

Resources
9
 
static void tli_config(void)
{
    tli_parameter_struct               tli_init_struct;
    tli_layer_parameter_struct         tli_layer_init_struct;

    rcu_periph_clock_enable(RCU_TLI);
    tli_gpio_config();

    rcu_pll_input_output_clock_range_config(IDX_PLL2, RCU_PLL2RNG_1M_2M, RCU_PLL2VCO_150M_420M);
    /* configure the PLL2 clock: CK_PLL2P/CK_PLL2Q/CK_PLL2R = HXTAL_VALUE / 25 * 150 / 3 */
    if(ERROR == rcu_pll2_config(25, 150, 3, 3, 3)) {
        while(1) {
        }
    }
    rcu_pll_clock_output_enable(RCU_PLL2R);
    rcu_tli_clock_div_config(RCU_PLL2R_DIV8);

    rcu_osci_on(RCU_PLL2_CK);

    if(ERROR == rcu_osci_stab_wait(RCU_PLL2_CK)) {
        while(1) {
        }
    }

    /* configure TLI parameter struct */
    tli_init_struct.signalpolarity_hs = TLI_HSYN_ACTLIVE_LOW;     //水平同步极性
    tli_init_struct.signalpolarity_vs = TLI_VSYN_ACTLIVE_LOW;     //垂直同步极性
    tli_init_struct.signalpolarity_de = TLI_DE_ACTLIVE_LOW;        //数据使能极性
    tli_init_struct.signalpolarity_pixelck = TLI_PIXEL_CLOCK_TLI;  //像素时钟极性

    /* LCD display timing configuration */
    tli_init_struct.synpsz_hpsz = HORIZONTAL_SYNCHRONOUS_PULSE - 1;  //水平同步
    tli_init_struct.synpsz_vpsz = VERTICAL_SYNCHRONOUS_PULSE - 1;    //垂直同步宽度
    tli_init_struct.backpsz_hbpsz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH - 1;  //水平同步后沿宽度
    tli_init_struct.backpsz_vbpsz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH - 1;      //垂直同步后沿高度
    tli_init_struct.activesz_hasz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH + ACTIVE_WIDTH - 1;  //有效宽度
                                    
    tli_init_struct.activesz_vasz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH + ACTIVE_HEIGHT -  1;     //有效高度
                                    
    tli_init_struct.totalsz_htsz = HORIZONTAL_SYNCHRONOUS_PULSE + HORIZONTAL_BACK_PORCH + ACTIVE_WIDTH +       //总宽度
                                   HORIZONTAL_FRONT_PORCH - 1;
    tli_init_struct.totalsz_vtsz = VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH + ACTIVE_HEIGHT +          //总高度
                                   VERTICAL_FRONT_PORCH - 1;
    /* configure LCD background R,G,B values */
    tli_init_struct.backcolor_red = 0xFF;      //背景设为白色
    tli_init_struct.backcolor_green = 0xFF;
    tli_init_struct.backcolor_blue = 0xFF;
    tli_init(&tli_init_struct);

    /* TLI layer configuration  层初始化配置 */
    tli_layer_init_struct.layer_window_leftpos = 80 + HORIZONTAL_SYNCHRONOUS_PULSE +
                                                 HORIZONTAL_BACK_PORCH + 2;
    tli_layer_init_struct.layer_window_rightpos = (80 + 320 + HORIZONTAL_SYNCHRONOUS_PULSE +
                                                   HORIZONTAL_BACK_PORCH - 1);
    tli_layer_init_struct.layer_window_toppos = 150 + VERTICAL_SYNCHRONOUS_PULSE + VERTICAL_BACK_PORCH;
    tli_layer_init_struct.layer_window_bottompos = (150 + 100 + VERTICAL_SYNCHRONOUS_PULSE +
                                                    VERTICAL_BACK_PORCH - 1);
    tli_layer_init_struct.layer_ppf = LAYER_PPF_RGB565;
    tli_layer_init_struct.layer_sa = 0xFF;                 //层透明度 255 为完全不透明
    tli_layer_init_struct.layer_default_blue = 0xFF;       
    tli_layer_init_struct.layer_default_green = 0xFF;
    tli_layer_init_struct.layer_default_red = 0xFF;
    tli_layer_init_struct.layer_default_alpha = 0x0;       //该层显示范围外的颜色
    tli_layer_init_struct.layer_acf1 = LAYER_ACF1_PASA;    //层混模式 归一化的像素alpha 乘以归一化的恒定 alpha
    tli_layer_init_struct.layer_acf2 = LAYER_ACF2_PASA;    //归一化gImage_logo的像素alhpa,
    tli_layer_init_struct.layer_frame_bufaddr = (uint32_t)&gImage_logo;;  //缓存地址
    tli_layer_init_struct.layer_frame_line_length = ((320 * 2) + 3);     //行长度    这个值为一行的字节数+3
    tli_layer_init_struct.layer_frame_buf_stride_offset = (320 * 2);     //步幅偏移,定义了从某行起始处到下一行起始处之间的字节数
    tli_layer_init_struct.layer_frame_total_line_number = 100;           //总行数 定义了一帧行数
    tli_layer_init(LAYER0, &tli_layer_init_struct);
}

I saw that the screen driver looks like this:

This post is from GD32 MCU
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list