Parts that are rendered cause glitches

Description

Hi, I have a problem with glitches on the parts that are rendered (you can see the photo down).
Im using “set_Window” function and I think this is the one that causing the problem, or maybe something else … I’m not quite sure.

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

Im using STM32H7 interfacing the ili9488 LCD screen using DBI type B with FMC as interface.

What LVGL version are you using?

8.3V

What do you want to achieve?

I just want to transfer the frame buffer(internal memory) to the display using the DMA2D → FMC → LCD.
by the way… if Im using regular DMA everything works fine.

Code

void ili9488_flush_cb(lv_disp_drv_t *disp, const lv_area_t *area,
		lv_color_t *color_p) {
	int height = lv_area_get_height(area);
	int width = lv_area_get_width(area);

	//Set the drawing region
	set_Window(area->x1, area->x2  , area->y1,  area->y2 );

	SCB_CleanDCache();
	SCB_InvalidateDCache();
	SCB_InvalidateICache();

	HAL_DMA2D_Start(&hdma2d, (uint32_t)(&color_p->full),
			(uint32_t) (0x60000000 | 0x0080000), width, height);

	HAL_DMA2D_PollForTransfer(&hdma2d, HAL_MAX_DELAY);

	SCB_InvalidateDCache();
	SCB_CleanDCache();
	SCB_InvalidateICache();

	lv_disp_flush_ready(&disp_drv); /* Indicate you are ready with the flushing */
}

void set_Window(uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2) {
    // Ensure valid window coordinates
    if (x1 >= DISP_HOR_RES|| x2 >= DISP_HOR_RES|| y1 >= DISP_VER_RES || y2 >= DISP_VER_RES ) {
        // Invalid window coordinates
        // return an error code or take appropriate action
        return;
    }

    // Adjust window coordinates to prevent overflow
    x1 = (x1 > x2) ? DISP_HOR_RES - 1 : x1;
    x2 = (x2 >= DISP_HOR_RES ) ? DISP_HOR_RES - 1 : x2;
    y1 = (y1 > y2) ? DISP_VER_RES - 1 : y1;
    y2 = (y2 >= DISP_VER_RES ) ? DISP_VER_RES - 1 : y2;


    // Set column address range
    LCD_WriteCommand(0x2A);  // CASET command
    LCD_WriteData(x1 >> 8);  // SC[15:8]
    LCD_WriteData(x1 & 0xFF);  // SC[7:0]
    LCD_WriteData(x2 >> 8);  // EC[15:8]
    LCD_WriteData(x2 & 0xFF);  // EC[7:0]

    // Set page address range
    LCD_WriteCommand(0x2B);  // PASET command
    LCD_WriteData(y1 >> 8);  // SP[15:8]
    LCD_WriteData(y1 & 0xFF);  // SP[7:0]
    LCD_WriteData(y2 >> 8);  // EP[15:8]
    LCD_WriteData(y2 & 0xFF);  // EP[7:0]

    // Write the RAMWR command to prepare for data writing
    LCD_WriteCommand(0x2C);  // RAMWR command
}

Screenshot

This code part is ugly and question is for STM forum not lvgl.

Thanks, I guess.

For example my set addr window

void writeAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h)
{
    bus->writeC8D16D16(ST7796_CASET, x, x + w - 1);
    bus->writeC8D16D16(ST7796_RASET, y, y + h - 1);
  bus->writeCommand(ST7796_RAMWR); // write to RAM
}

1 Like

Thanks, for the help.
I managed to solve the problem with the following code and I still need to learn why:

disp_drv.rounder_cb = &my_rounder_cb;
void my_rounder_cb(lv_disp_drv_t * disp_drv, lv_area_t * area)
{
	  /* Update the areas as needed.
	   * For example it makes the area start only on 8th rows and have Nx8 pixel height.
	  */
	   area->y1 = area->y1 & 0xfff8;	//1111,1111,1111,1000
	   area->x1 = area->x1 & 0xfff8;
	   area->y2 = (area->y2 & 0xfff8) + 8 - 1;
	   area->x2 = (area->x2 & 0xfff8) + 8 - 1;
}