LVGL Demo Out Image Corruption

Description

Hi
In My Project When Using Internal RAM As Main Framebuffer, The Out Image Gets Corrupted, For Fixed Frame By Reading an Image From Internal Flash The Out Image is Fine.

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

MCU: STM32U5A, STM32CubeIDE

What LVGL version are you using?

V8.2

What do you want to achieve?

What’s Will be the Main Source of Problem, How to Change The Code For Direct Mode Option.

What have you tried so far?

Changing the Buffer Address And Partial Frame Buffer

Code to reproduce

/*void tft_init(void)
{

// FMC_Bank1->BTCR[0] = 0x000030D2;

// DMA_Config();

  HAL_DMA_RegisterCallback(&handle_GPDMA1_Channel0, HAL_DMA_XFER_CPLT_CB_ID, DMA_TransferComplete);

static lv_color_t disp_buf1[TFT_HOR_RES * 172];
static lv_color_t disp_buf2[TFT_HOR_RES * 172];

// static uint16_t * disp_buf1 = (uint16_t *)BUF1_ADDRESS;
// static uint16_t * disp_buf2 = (uint16_t *)BUF2_ADDRESS;
// static lv_disp_draw_buf_t * buf = (lv_disp_draw_buf_t *)BUF_ADDRESS;

static lv_disp_draw_buf_t buf;
lv_disp_draw_buf_init(&buf, disp_buf1, disp_buf2, TFT_HOR_RES * 172);

lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf = &buf;
disp_drv.flush_cb = tft_flush_cb;
disp_drv.monitor_cb = monitor_cb;
disp_drv.sw_rotate = 1;
disp_drv.hor_res = 480;
disp_drv.ver_res = 854;
lv_disp_drv_register(&disp_drv);

}

static void tft_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)
{

// uint16_t act_x1, act_x2, act_y1, act_y2;
//
// if(area->x2 < 0 || area->y2 < 0)
// return;
//
// if(area->x1 > (LCD_WIDTH - 1) || area->y1 > (LCD_HEIGHT - 1))
// return;
//
// act_x1 = area->x1 < 0 ? 0 : area->x1;
// act_y1 = area->y1 < 0 ? 0 : area->y1;
// act_x2 = area->x2 > LCD_WIDTH - 1 ? LCD_WIDTH - 1 : area->x2;
// act_y2 = area->y2 > LCD_HEIGHT - 1 ? LCD_HEIGHT - 1 : area->y2;

// SCB_InvalidateDCache_by_Addr((uint32_t *)&my_fb[act_y1 * TFT_HOR_RES + act_x1], 480 *854);

// SCB_CleanDCache_by_Addr((uint32_t *)(color_p), 480 * 854);

// dma2d_transfer((uint32_t)color_p, act_x1, act_y1, act_x2 - act_x1 + 1, act_y2 - act_y1 + 1);
// lv_disp_flush_ready(&disp_drv);

/*Truncate the area to the screen*/
int32_t act_x1 = area->x1 < 0 ? 0 : area->x1;
int32_t act_y1 = area->y1 < 0 ? 0 : area->y1;
int32_t act_x2 = area->x2 > TFT_HOR_RES - 1 ? TFT_HOR_RES - 1 : area->x2;
int32_t act_y2 = area->y2 > TFT_VER_RES - 1 ? TFT_VER_RES - 1 : area->y2;

x1_flush = act_x1;
y1_flush = act_y1;
x2_flush = act_x2;
y2_flush = act_y2;
y_flush_act = act_y1;
buf_to_flush = color_p;

/*Use DMA instead of DMA2D to leave it free for GPU*/
HAL_StatusTypeDef err;

// SCB_CleanDCache_by_Addr((uint32_t *)buf_to_flush, 480 * 2);

err = HAL_DMA_Start_IT(&handle_GPDMA1_Channel0,(uint32_t)buf_to_flush, (uint32_t)&my_fb[y_flush_act * TFT_HOR_RES + x1_flush],
		  (x2_flush - x1_flush + 1));

if(err != HAL_OK)
{
	while(1);	/*Halt on error*/
}

 lv_disp_flush_ready(&disp_drv);

}

#define LCD_FB_START_ADDRESS ((uint32_t)0x200D0000)
//#define BUF1_ADDRESS ((uint32_t)0x201A0000)
//#define BUF2_ADDRESS ((uint32_t)0x201BE3C0)
//#define BUF_ADDRESS ((uint32_t)0x201DC780)

*/

## Screenshot and/or video