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
}