Screen strips when using external RAM (SDRAM) and two buffers for lv_disp_buf_init()

Description

In tft_init() if I use external RAM instead of intern RAM and call lv_disp_buf_init() with both buffers, I get horizontal strips on the display as well as some graphics is overided by white strips.

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

STM32F769I-DISCO compiled by STM32CubeIde

What do you want to achieve?

I would like to use two buffers for greater speed

What have you tried so far?

If I don’t use a second buffer, it all works as it should
In other words calling

lv_disp_buf_init(&disp_buf, buf, buf2, TFT_HOR_RES * 48);

produce strips
but:

lv_disp_buf_init(&disp_buf, buf, NULL, TFT_HOR_RES * 48);

dose not

Code to reproduce

        //Original RAM buffers not used
	//	static lv_color_t buf[TFT_HOR_RES * 48];
	//	static lv_color_t buf2[TFT_HOR_RES * 48];


#define SDRAM_START_ADDR          ((uint32_t)0xC0000000) // base adress for SDRAM
#define FB_SIZE       	          ((uint32_t)800*480*2)	// Frame buffer already using this space


	//SDRAM pointers
	static lv_color_t *buf=(lv_color_t *)(SDRAM_START_ADDR+FB_SIZE); // first buffer just after frame buffer
	static lv_color_t *buf2= (lv_color_t*)(SDRAM_START_ADDR+FB_SIZE+(TFT_HOR_RES * 48));// second buffer just after the first one

	static lv_disp_buf_t disp_buf;
	//lv_disp_buf_init(&disp_buf, buf, buf2, TFT_HOR_RES * 48);
	lv_disp_buf_init(&disp_buf, buf, NULL, TFT_HOR_RES * 48);

Screenshot and/or video

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

1 Like

Please show your flush_cb implementation.

This is the original tft_flush_cb() from the STM32F769I-DISCO port

static void tft_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)
{
//    lv_disp_flush_ready(drv);
//    return;
	SCB_CleanInvalidateDCache();

	/*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;
	err = HAL_DMA_Start_IT(&DmaHandle,(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*/
	}
}

Is it the same with our example project?