Help needed - STM32L562E-DK - Correct way to efficiently write to TFT LCD-Display, ST7789H2 driver
Hello community,
I am trying to efficiently display graphics on my STM32L562E-DK board with low-level code (only drivers and util-methods) without using any big external software like TouchGFX, Embedded Wizard, etc.
In short: I am not achieving the same frame rate / update effect with my code as i.e. Embedded Wizard does. They have a high frame rate and no visible screen update effect.
(I am just beginning with using displays on microcontrollers.)
Additional Board information: The display is connected via a 29-pin FCP connector to FMC of the microcontroller.
After inspecting the official Github-Democode for the STM32L562E-DK, I grabbed myself the classes:
"stm32l562e_discovery_lcd.h"
"lcd.h"
"st7789h2.h"
"st7789h2_reg.h"
"stm32l552e_eval_lcd.h"
"../Components/hx8347i/hx8347i.h"
// also included its associated .c filesThose files work perfectly fine, I can for example use this function to display stuff on the display:
static void Display_DemoDescription(void)
{
char desc[60];
/* Set font */
UTIL_LCD_SetFont(&Font24);
/* Clear the LCD */
UTIL_LCD_Clear(UTIL_LCD_COLOR_WHITE);
/* Set the LCD Text Color */
UTIL_LCD_SetTextColor(UTIL_LCD_COLOR_DARKBLUE);
UTIL_LCD_SetBackColor(UTIL_LCD_COLOR_WHITE);
/* Display LCD messages */
UTIL_LCD_DisplayStringAt(0, 10, (uint8_t *)"STM32L552-EV BSP", CENTER_MODE);
UTIL_LCD_DisplayStringAt(0, 35, (uint8_t *)"drivers example", CENTER_MODE);
/* Draw Bitmap */
UTIL_LCD_DrawBitmap(120, 65, (uint8_t *)stlogo);
UTIL_LCD_SetFont(&Font12);
UTIL_LCD_DisplayStringAt(0, 220, (uint8_t *)"Copyright (c) STMicroelectronics 2019", CENTER_MODE);
UTIL_LCD_SetFont(&Font16);
UTIL_LCD_FillRect(0, 150, 320, 50, UTIL_LCD_COLOR_BLUE);
UTIL_LCD_SetTextColor(UTIL_LCD_COLOR_WHITE);
UTIL_LCD_SetBackColor(UTIL_LCD_COLOR_BLUE);
UTIL_LCD_DisplayStringAt(0, 150, (uint8_t *)"Press Wakeup push-button", CENTER_MODE);
UTIL_LCD_DisplayStringAt(0, 165, (uint8_t *)"to start :", CENTER_MODE);
sprintf(desc,"%s example", BSP_examples[DemoIndex].DemoName);
UTIL_LCD_DisplayStringAt(0, 180, (uint8_t *)desc, CENTER_MODE);
}But here comes the problem: The screen update is so slow, so that I can even see the pixels of a rect or oval building up in a short flash, or I see the stlogo getting drawn from top to bottom in approx. 50milliseconds or so.
I'm now asking for help to correctly display graphics on the screen with a fast frame rate and without a visible display update effect.
My suspected possible causes:
I think, the above code and its util-functions like fillrect(..) send each drawn pixel individually to the display.
I know that for a smooth view you need to use framebuffers. They are (as far as I see) not utilized in the above code. But I'm also wondering where to store the framebuffer. 256kB of Ram available, 240*240 pixels *4bytes/pixel = 230kB Ram for framebuffer.
I really would appreciate help on this topic on how to really draw efficiently on the display. If also anyone knows how Embedded Wizard is doing it, I would really appreciate help.
Thanks in advance.