Porting V8 to STM32F411CE Black Pill + ILI9341 On STM32CubeIDE


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

STM32F411CE Black Pill + ILI9341 on STM32CubeIDE

What LVGL version are you using?

V 8.0

What do you want to achieve?

Porting successfully

What have you tried so far?

Following porting document and use porting template, compiled without error but halt in lv_disp_drv_register(),

Code to reproduce

printf("Initialize Display \n");

static lv_disp_draw_buf_t draw_buf_dsc_1;
static lv_color_t buf_1[MY_DISP_HOR_RES * 10];    /*A buffer for 10 rows*/

printf("Initialize Buffer\n");
lv_disp_draw_buf_init(&draw_buf_dsc_1, buf_1, NULL, MY_DISP_HOR_RES * MY_DISP_VER_RES/10);   /*Initialize the display buffer*/

static lv_disp_drv_t disp_drv;				/*Descriptor of a display driver*/
printf("Initialize Display Driver\n");
lv_disp_drv_init(&disp_drv);				/*Basic initialization*/

disp_drv.hor_res = MY_DISP_HOR_RES;
disp_drv.ver_res = MY_DISP_VER_RES;

disp_drv.flush_cb = disp_flush;

disp_drv.draw_buf = &draw_buf_dsc_1;

printf("Register Display Driver\n");

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

You’re creating your array for the buffer (buf_1) with 10 rows worth of pixels (MY_DISP_HOR_RES * 10), but initialising your display buffer with 1/10th of a display’s worth of pixels (MY_DISP_HOR_RES * MY_DISP_VER_RES/10). This should be changed so that they are both the same value.

Thanks, I changed that array from 10 rows to 1/10 during my trial but not help. I changed it back to 10 rows or vice versa but things still halt.

Last parameter of lv_disp_draw_buf_init is the size of the buffer.
Change your code with this line:

lv_disp_draw_buf_init(&draw_buf_dsc_1, buf_1, NULL, MY_DISP_HOR_RES * 10);

Thanks, I have tried both ways. Changed it to HOR_RES10 and to (HOR_RESVER_RES/10). Still no return back from lv_disp_drv_register().

I have looked into the function and tried to cancel some part, the problem may begin since the first line,
lv_disp_t * disp = _lv_ll_ins_head(&LV_GC_ROOT(_lv_disp_ll));

can this happen when a call to lv_init() is missing?
A problem with wrong display buffer should first rise when the first screen refresh starts.

1 Like

Thanks JojoS, You are right. I did not call lv_init() before entering to porting session. Thank you so much. It is OK now.