CPU usage & FPS count & memory - are corrupted image

Description

I have enabled the:
LV_USE_PERF_MONITOR 1
LV_USE_MEM_MONITOR 1

When I run an example like the “lv_example_anim_3()” without the debug information the image displayed fine, but when I use debug window the debug window is corrupted.

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

I’m using STM32 h7.

What do you want to achieve?

I’m trying to see the debug window without corruption.

What have you tried so far?

I don’t really know where the problem comes from.

Code

void ili9488_flush_cb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {

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

	int height = lv_area_get_height(area);
	int width = lv_area_get_width(area);

	HAL_DMA2D_Start(&hdma2d, (uint32_t) color_p,
			(uint32_t) (0x60000000 | 0x0200000), width, height);

	HAL_DMA2D_PollForTransfer(&hdma2d, HAL_MAX_DELAY);

	lv_disp_flush_ready(disp);
}

void my_clean_dcache_cb(lv_disp_drv_t *disp_drv) {
	/* Example for Cortex-M (CMSIS) */
	SCB_CleanInvalidateDCache();
}

Screenshot


There should be a problem with the code.

Ok, Thanks for the hint. I will update this post when it will be fixed.

Can you try running the benchmark instead? Enable it via lv_conf.h and call lv_demo_benchmark() after setting up LVGL.

If this completes without graphical issues, the problem might not be with your own code.

Hi, I run the benchmark and it completes with graphical issues. I’m trying to follow and adjust to this example: STM32F769I-DISCO-LVGL/master.cpp at master · tdjastrzebski/STM32F769I-DISCO-LVGL · GitHub
to my STM32 H7 with no luck.
Interesting case - It works great when I use regular DMA or “Regular” transfers individually.
Interesting case - I saw when I send the picture or some pixel data that is static the output to display is not distorted but in some other cases it is distorted.

I don’t think I can help you much as I have no idea of how STM32 DMA2D works,
however I think this line is the issue:

I suspect the third argument is the start address for DMA? In my project I was writing directly to a framebuffer in DMA so I had to set the start address of DMA to the x/y positions of the area to be drawn.

However, it seems you already set the drawing position with LCD_SetPos… so I’m not sure.
My last hint is that you would have to figure out if there are functional differences between DMA2D on your MCU (STM32 H7) and the STM32F7-xxx, considering the other drawing functions have no graphical issues.

1 Like

thank you very much, I will update if there will be any change.

Your flush_cb seems be complete bad, and works only for full screen refresh maybe.

Hi, I would really love to here why do you think so, so I can maybe try to fix the problem.

Example

static void CopyPicture(uint32_t *pSrc, uint32_t *pDst, uint16_t x, uint16_t y, uint16_t xsize, uint16_t ysize)
{

  uint32_t destination = (uint32_t)pDst + (y * 800 + x) * 4;
  uint32_t source      = (uint32_t)pSrc;

  /*##-1- Configure the DMA2D Mode, Color Mode and output offset #############*/
  hdma2d.Init.Mode         = DMA2D_M2M;
  hdma2d.Init.ColorMode    = DMA2D_ARGB8888;
  hdma2d.Init.OutputOffset = 800 - xsize;

  /*##-2- DMA2D Callbacks Configuration ######################################*/
  hdma2d.XferCpltCallback  = NULL;

  /*##-3- Foreground Configuration ###########################################*/
  hdma2d.LayerCfg[0].AlphaMode = DMA2D_NO_MODIF_ALPHA;
  hdma2d.LayerCfg[0].InputAlpha = 0xFF;
  hdma2d.LayerCfg[0].InputColorMode = CM_ARGB8888;
  hdma2d.LayerCfg[0].InputOffset = 0;

  hdma2d.Instance          = DMA2D;

too you dont show SetPos and wait for DMA end is good for testing, but dont offload effective. usw

Thanks, I will try it.
But one more question. I’m using FMC to interface to the LCD, so if I correct the line :

destination = (uint32_t)pDst + (y * 800 + x) * 4;

won’t work?