Lvgl drawing issue 9.0 stm32

Hello everyone! i am having drawing issues with lvgl 9.0
driven by stm32 and ILI9341
if i place object to position near start of coords - all seems ok but if i move it a little bit - lvgl draws garbage/. and even if i place object to its original position - lvgl draws garbage.(but first drawing is ok at start)

for a start ive checked my default method that fills lcd (it can draw rectangles)
it works fine and all coords are ok (i can place rectangles where i want it to.
here`s my code

void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
		if(area->x2 < 0) return;
    if(area->y2 < 0) return;
    if(area->x1 > TFT_HOR_RES - 1) return;
    if(area->y1 > TFT_VER_RES - 1) return;
	  uint32_t x=0, y=0;
    LCD_SetAddrWindow(area->x1, area->y1, area->x2, area->y2);
	  for(y = area->y1; y <= area->y2; y++) {
    for(x = area->x1; x <= area->x2; x++) {
    LCD_WriteData((color_p->full >> 8)& 0xFF);
		LCD_WriteData(color_p->full & 0xFF);
		color_p++;
        }
				}
		lv_disp_flush_ready(disp);         /* Indicate you are ready with the flushing*/
}
void init_lvgl(void)
{
lv_init();
lv_disp_draw_buf_init(&draw_buf, buf1, NULL, MY_DISP_HOR_RES * MY_DISP_VER_RES / 10);  /*Initialize the display buffer.*/
lv_disp_drv_init(&disp_drv);          /*Basic initialization*/
disp_drv.flush_cb = my_disp_flush;    /*Set your driver function*/
disp_drv.draw_buf = &draw_buf;        /*Assign the buffer to the display*/
disp_drv.hor_res = MY_DISP_HOR_RES;   /*Set the horizontal resolution of the display*/
disp_drv.ver_res = MY_DISP_VER_RES;   /*Set the vertical resolution of the display*/
lv_disp_drv_register(&disp_drv);      /*Finally register the driver*/
}

i am running out of time so i really appreciate for someone help…

wrong code
LCD_SetAddrWindow(area->x1, area->y1, area->x2, area->y2);
working code
LCD_SetAddrWindow(area->x1, area->y1, area->x2-area->x1, area->y2-area->y1);  

so problem was in method that sets window where bytes will be in lcd memory.

1 Like