Trying to port LVGL on STM32H743 to use Round RGB666 LCD 480x480 pixel

Description

I’m trying to port LVGL on STM32H743 to use Round RGB666 LCD 480x480 pixel. I’ve bought a board from WeACT Studio. Card runs good, LTDC configured and a test framebuffer runs. I can picture 480x480 RGB565 images from Flash to the screen. All the codes ported from arduino examples of LCD. I use AdaFruit’s RGB666 480x480 2.1 Round LCD Round RGB 666 TTL TFT Display - 2.1 480x480 - Capacitive Touch [TL021WVC02CT-B1323] : ID 5792 : $39.95 : Adafruit Industries, Unique & fun DIY electronics and kits
My problem is now this. I’ll use this LCD to make a smartGauges to my CAR. I’ve the code for my ESP32. But It is slow as hell. I want to upgrade it to STM32. I’ve read the instructions. All the time time I have lots of lots of errors that I could not understand why. I’ve watch Youtube videos. All seems correct but they don’t have any errors on their videos, but I have tons of them. Please I need help.

What MCU/Processor/Board and compiler are you using?

I’m using WeACT Studio STM32H743VIT6 miniBoard. I don’t have SDRAM or EXTERNAL stuff.
I could use External QSPI 8MB FLASH and SD-Card interface soon after I could run the LVGL.

What do you want to achieve?

I want to use LVGL on my project. I don’t have so much ram space I have only one full frame buffer.

What have you tried so far?

  • I’ve download the master LVGL code from GITHUB.
  • I’ve install it to my Project directory.
  • I took the lv_conf_template.h file to main directory and rename it to lv_conf.h
  • I’ve set the #if 1

/* clang-format off */
#if 1 /Set it to “1” to enable content/

  • I’ve included the necessary headers to my main.c

#include “…/…/lvgl/lvgl.h”
#include “…/…/lvgl/examples/lv_examples.h”

  • I’ve added LVGL folder to PATH
  • I’ve added the display parameters

static lv_disp_drv_t disp_drv;
static lv_color_t disp_buf1[DISP_HOR_RES * 10];
static lv_color_t disp_buf2[DISP_HOR_RES * 10];

  • I’ve combine my LCD_INIT with Display_init sub.

void Display_init(int rotation)
{
static lv_disp_draw_buf_t buf;
lv_disp_draw_buf_init(&buf, disp_buf1, disp_buf2, DISP_HOR_RES * 10);
lv_disp_drv_init(&disp_drv);

LCD_init();    // My code for 9 bit SPI init parameters
FillFramebuffer(0x0000);  // My code for full black fill of framebuffer

disp_drv.draw_buf = &buf;
disp_drv.flush_cb = tft_flush;
disp_drv.monitor_cb = monitor_cb;
disp_drv.hor_res = DISP_HOR_RES;
disp_drv.ver_res = DISP_VER_RES;
disp_drv.rotated = rotation;
lv_disp_drv_register(&disp_drv);

}

even it is not full finished. I wanted to compile the code and I started to get errors

Errors are like this.

…/Core/Src/main.c:90:8: error: unknown type name ‘lv_disp_drv_t’
90 | static lv_disp_drv_t disp_drv;
| ^~~~~~~~~~~~~
…/Core/Src/main.c:97:17: error: unknown type name ‘lv_disp_drv_t’; did you mean ‘lv_fs_drv_t’?
97 | void monitor_cb(lv_disp_drv_t * d, uint32_t t, uint32_t p)
| ^~~~~~~~~~~~~
| lv_fs_drv_t
…/Core/Src/main.c:102:23: error: unknown type name ‘lv_disp_drv_t’; did you mean ‘lv_fs_drv_t’?
102 | static void tft_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p);
| ^~~~~~~~~~~~~
| lv_fs_drv_t
…/Core/Src/main.c:155:23: error: unknown type name ‘lv_disp_drv_t’; did you mean ‘lv_fs_drv_t’?
155 | static void tft_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)
| ^~~~~~~~~~~~~
| lv_fs_drv_t
…/Core/Src/main.c: In function ‘Display_init’:
…/Core/Src/main.c:275:16: error: unknown type name ‘lv_disp_draw_buf_t’
275 | static lv_disp_draw_buf_t buf;
| ^~~~~~~~~~~~~~~~~~
…/Core/Src/main.c:277:9: warning: implicit declaration of function ‘lv_disp_draw_buf_init’; did you mean ‘lv_draw_buf_init’? [-Wimplicit-function-declaration]
277 | lv_disp_draw_buf_init(&buf, disp_buf1, disp_buf2, DISP_HOR_RES * 10);
| ^~~~~~~~~~~~~~~~~~~~~
| lv_draw_buf_init
…/Core/Src/main.c:279:9: warning: implicit declaration of function ‘lv_disp_drv_init’; did you mean ‘lv_fs_drv_init’? [-Wimplicit-function-declaration]
279 | lv_disp_drv_init(&disp_drv);
| ^~~~~~~~~~~~~~~~
| lv_fs_drv_init
…/Core/Src/main.c:286:17: error: request for member ‘draw_buf’ in something not a structure or union
286 | disp_drv.draw_buf = &buf;
| ^
…/Core/Src/main.c:287:17: error: request for member ‘flush_cb’ in something not a structure or union
287 | disp_drv.flush_cb = tft_flush;
| ^
…/Core/Src/main.c:287:29: error: ‘tft_flush’ undeclared (first use in this function)
287 | disp_drv.flush_cb = tft_flush;
| ^~~~~~~~~
…/Core/Src/main.c:287:29: note: each undeclared identifier is reported only once for each function it appears in
…/Core/Src/main.c:288:17: error: request for member ‘monitor_cb’ in something not a structure or union
288 | disp_drv.monitor_cb = monitor_cb;
| ^
…/Core/Src/main.c:288:31: error: ‘monitor_cb’ undeclared (first use in this function)
288 | disp_drv.monitor_cb = monitor_cb;
| ^~~~~~~~~~
…/Core/Src/main.c:289:17: error: request for member ‘hor_res’ in something not a structure or union
289 | disp_drv.hor_res = DISP_HOR_RES;
| ^
…/Core/Src/main.c:290:17: error: request for member ‘ver_res’ in something not a structure or union
290 | disp_drv.ver_res = DISP_VER_RES;
| ^
…/Core/Src/main.c:291:17: error: request for member ‘rotated’ in something not a structure or union
291 | disp_drv.rotated = rotation;
| ^
…/Core/Src/main.c:292:9: warning: implicit declaration of function ‘lv_disp_drv_register’; did you mean ‘lv_fs_drv_register’? [-Wimplicit-function-declaration]
292 | lv_disp_drv_register(&disp_drv);
| ^~~~~~~~~~~~~~~~~~~~
| lv_fs_drv_register
At top level:
…/Core/Src/main.c:939:6: warning: ‘MPU_Config’ defined but not used [-Wunused-function]
939 | void MPU_Config(void)
| ^~~~~~~~~~
make: *** [Core/Src/subdir.mk:34: Core/Src/main.o] Error 1
“make -j32 all” terminated with exit code 2. Build might be incomplete.

14:33:00 Build Failed. 14 errors, 5 warnings. (took 26s.977ms)

this point is primary miss. You need
#include <lvgl.h>

and folders is require add into include path not system path.

Yes I’ve already added that to include path. But as you see if I use “#include <lvgl.h>” line I get error

If I use #include “…/…/lvgl/lvgl.h” I don’t have a problem.

main.c is C file then C++ setup is irelevant. And why you ask when no problem ?

Why I am asking when no problem? Please you clearly did not see the first post that I’ve put here. Even I put it to “C” relevant PATH I have problems. I don’t think I have PATH problems.

This above is my problem.

  • Maybe I put the LVGL to wrong place ???
  • Maybe I should have put it to Drivers folder ??

I don’t know. I’m so confused here, It should be very easy to implement the library.

No all this error is unable use lvgl.h file

I’m sorry I did check everything in documents again. I have the LVGL forder in the project folder. What else should I do?

beside “#include <lvgl.h>” this line. I’ve added that. I did remove #include “…/…/lvgl/lvgl.h” line. And still has the error of

…/Core/Src/main.c:96:8: error: unknown type name ‘lv_disp_drv_t’
96 | static lv_disp_drv_t disp_drv;
| ^~~~~~~~~~~~~
…/Core/Src/main.c:96:22: warning: ‘disp_drv’ defined but not used [-Wunused-variable]
96 | static lv_disp_drv_t disp_drv;
| ^~~~~~~~
make: *** [Core/Src/subdir.mk:34: Core/Src/main.o] Error 1

I create test project over MX. Then copy as you lvgl folder to project root.
Next add include lvgl

and for you test code

/* USER CODE BEGIN PFP */
static lv_disp_drv_t disp_drv;
static lv_color_t disp_buf1[480 * 10];
static lv_color_t disp_buf2[480 * 10];
/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
void Display_init(int rotation)
{
static lv_disp_draw_buf_t buf;
lv_disp_draw_buf_init(&buf, disp_buf1, disp_buf2, 480 * 10);
lv_disp_drv_init(&disp_drv);

//LCD_init();    // My code for 9 bit SPI init parameters
//FillFramebuffer(0x0000);  // My code for full black fill of framebuffer

disp_drv.draw_buf = &buf;
disp_drv.flush_cb = NULL; //tft_flush;
disp_drv.hor_res = 480;
disp_drv.ver_res = 480;
disp_drv.rotated = rotation;
lv_disp_drv_register(&disp_drv);
}
/* USER CODE END 0 */

plus on start

/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <lvgl.h>
/* USER CODE END Includes */

compiled without error. Ofcourse after copy lvgl used Refresh on project.

arm-none-eabi-objdump -h -S testlvgl.elf > “testlvgl.list”
arm-none-eabi-objcopy -O binary testlvgl.elf “testlvgl.bin”
text data bss dec hex filename
15648 24 1872 17544 4488 testlvgl.elf
Finished building: default.size.stdout
Finished building: testlvgl.bin
Finished building: testlvgl.list
18:40:06 Build Finished. 0 errors, 1 warnings. (took 1s.680ms)

1 Like

I did everything you’ve told me to do. But Still have the problem.

*I’ve open a new project. I did not add any code, and setup any device.

  • I compiled the pure code for test. no error.
  • I’ve opened the ZIP file that I’ve downloaded from GITHUB and copied the files to ROOT directory as you can see in the image.
  • I’ve copied and renamed the “lv_conf.h”
  • I’ve set the file to “1”
  • I’ve added the lines that you recommended to exact places.

but still no hope. Maybe My downloaded files are not good?

Cube IDE is up to date as always

Your project seem as C++ and for real compilation is required one next step.
Click on lvgl/src and disable excluded from build.
I test C project for C++ maybe add …\lvgl too for g++ includes
Too my test lvgl is 8.3.7

Ahahaha, I went to GITHUB, downloaded the 8.3.7 version. Replace the LVGL directory.
rename the lv_conf.h file. And I did not touch anything else. Compiled now.

What a relief. But I could not do without asking why? Should I try something else? Or maybe TRY latest 8.x.x version again ?

Ahahaha place call to your func in main , now is not linked.
And yes i mean 8.3.11 or other latest work too. But src require include to project , now lvgl is complete excluded.

1 Like

Now I’ve included the LVGL 8.x.x to may original Project and compiled it.
In the controller I have only one FULL Frame Buffer. I can draw pixel on it. and LTDC unit immediately shows the Buffer to the LCD. There is DMA open right now. Because I could not use 2nd buffer or anything else for now.

Frame buffer is in the RAM_D1, as you see 480x480x2 = 460800Bytes, RAM_D1 has 512Kb and I can use it. Do I still need to use something like “void my_flush_cb” ?? I’m also checking other samples from the Internet

Read about direct mode, but isnt simple sync it with LTDC…