2232 views|7 replies

1452

Posts

1

Resources
The OP
 

[NUCLEO-L452RE Review] +2.2-inch TFT display driver display [Copy link]

This post was last edited by jinglixixi on 2020-12-25 18:00

The previous article introduced using STM32L452RE to drive the OLED screen, but its screen is relatively small. This time, it will be used to drive a 2.2- inch TFT display.

Since the STM32L452RE development board is equipped with an Arduino interface, it is directly used to connect the TFT display. The connection relationship between the display and the MCU is:

CS---PA5

RST---PA6

D/C---PA7

SDI---PB6

SCK---PC7

LED---PA9

The statements for outputting high and low levels are defined as:

#define LCD_CS_High() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_SET) // PA5

#define LCD_CS_Low() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_RESET)

#define LCD_REST_High() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_6,GPIO_PIN_SET) // PA6

#define LCD_REST_Low() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_6,GPIO_PIN_RESET)

#define LCD_DC_High() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_7,GPIO_PIN_SET) // PA7

#define LCD_DC_Low() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_7,GPIO_PIN_RESET)

#define LCD_SDI_High() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_6,GPIO_PIN_SET) // PB6

#define LCD_SDI_Low() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_6,GPIO_PIN_RESET)

#define LCD_SCK_High() HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_SET) // PC7

#define LCD_SCK_Low() HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,GPIO_PIN_RESET)

#define LCD_LED_High() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_9,GPIO_PIN_SET) // PA9

The configuration function of the pin output function is:

void APP_TFT_init(void)
{
 __HAL_RCC_GPIOA_CLK_ENABLE();
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 GPIO_InitStruct.Pin = GPIO_PIN_5;
 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 GPIO_InitStruct.Pin = GPIO_PIN_6;
 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_7;
 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_9;
 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
__HAL_RCC_GPIOB_CLK_ENABLE();
 GPIO_InitStruct.Pin = GPIO_PIN_6;
 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
__HAL_RCC_GPIOC_CLK_ENABLE();
 GPIO_InitStruct.Pin = GPIO_PIN_7;
 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 LCD_LED_High();
}

The function to realize the picture display is:

void show_pic(const unsigned char *p)
{
 int i,j;
 unsigned char picH,picL;
        Address_set(0,0,LCD_W-1,LCD_H-1);
 for(i=0;i<240;i++)
 {
 for(j=0;j<320;j++)
  {
  picH=*p++;
  picL=*p++;
  LCD_WR_DATA8(picH);
 LCD_WR_DATA8(picL);
  }
       }
}

The main program to achieve the display effect is:

int main(void)
{
 HAL_Init();
 /* Configure the system clock to 80 MHz */
 SystemClock_Config();
 APP_TFT_init();
 LCD_Init();
  //LCD_Clear(WHITE);
 show_pic(gImage_a);
 while (1);
}

After the program is compiled and downloaded, the display effect is as shown in the figure.

Display Effect

If the 2.2 -inch TFT display is still too small, we can add a 2.8 -inch touch screen later.

This post is from stm32/stm8

Latest reply

ST NUCLEO-L452RE review Summary post: https://en.eeworld.com/bbs/thread-1151850-1-1.html、   Details Published on 2020-12-28 11:00
 

7422

Posts

2

Resources
2
 

The beauty is ok, but the resolution is not good.

This post is from stm32/stm8

Comments

What is the most basic resolution standard in your mind?  Details Published on 2020-12-25 20:11
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 

1452

Posts

1

Resources
3
 
freebsder posted on 2020-12-25 18:24 The beauty is ok, but the resolution is not good.

What is the most basic resolution standard in your mind?

This post is from stm32/stm8
 
 

1942

Posts

2

Resources
4
 

I think this screen is more suitable for me. Haha!

This post is from stm32/stm8

Comments

Yes, this screen can be directly plugged into the Arduino interface, which saves the wiring and is more convenient. The 2.8-inch touch screen is not possible, as some pins cannot be directly plugged into the socket, so it can only be connected by wire.  Details Published on 2020-12-26 11:02
 
 
 

1452

Posts

1

Resources
5
 
w494143467 posted on 2020-12-26 10:41 I think this screen is more suitable for me. Haha!

Yes, this screen can be directly plugged into the Arduino interface, which saves the wiring and is more convenient. The 2.8-inch touch screen is not possible, as some pins cannot be directly plugged into the socket, so it can only be connected by wire.

This post is from stm32/stm8

Comments

SOGA, then I need a screen like this. I think many development boards now have Arduino interfaces.  Details Published on 2020-12-26 17:43
 
 
 

1942

Posts

2

Resources
6
 
jinglixixi posted on 2020-12-26 11:02 Yes, this screen can be directly plugged into the Arduino interface, which saves the wiring and is more convenient. The 2.8-inch touch screen is not good, as some pins cannot be directly plugged in...

SOGA, then I need a screen like this. I think many development boards now have Arduino interfaces.

This post is from stm32/stm8

Comments

Yes, that's right.  Details Published on 2020-12-26 20:23
 
 
 

1452

Posts

1

Resources
7
 
w494143467 Published on 2020-12-26 17:43 SOGA, then I need a screen like this. Many development boards should have Arduino interfaces now.

Yes, that's right.

This post is from stm32/stm8
 
 
 

1w

Posts

204

Resources
8
 

ST NUCLEO-L452RE review

Summary post: https://en.eeworld.com/bbs/thread-1151850-1-1.html

This post is from stm32/stm8
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
Personal signature

玩板看这里:

http://en.eeworld.com/bbs/elecplay.html

EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!

 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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