cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DMA2D

Hello Dear Engineers,

I am looking for using DMA2D with stm32f429IGT6. So far I have been able to use RAM and LCD in cooperation. Now I want to use LVGL as the main framework. The main problem is I don't know how should I use dma2d in the bare-metal case. I was able to use it with Touchgfx, but the configuration then is made by stm32cubemx and the Touchgfx designer.

The flush routine is as follows

static void tft_lcd_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p) 
{
	for(int y = area->y1; y <= area->y2; y++)
    	for(int x = area->x1; x <= area->x2; x++)
			LCD_FB[x+(y * LV_HOR_RES_MAX)]=(color_p++->full);  //pixelColor;
//	HAL_DMA2D_Start(&hdma2d, &color_p[0], &LCD_FB[0], 800, 480);
//	lv_gpu_stm32_dma2d_fill(LCD_FB, 800*480, color_p, 800, 480);
	lv_disp_flush_ready(drv);
}

In the code above, LCD_FB is a pointer to the LCD address which is associated with external RAM. In the mentioned code, the nested for{for{}} are working perfectly, but the two commented code lines are not working as an alternate for the nested for{for{}}.

As for the DMA2D, I have used only

MX_DMA2D_Init();

Is there any other configuration I should implement?

Your help is appreciated

Sincerely yours

1 REPLY 1
Petr DAVID
ST Employee

Hello Vahid Ajalluian,

I cannot tell if the configuration of the DMA2D is alright, but I think that after HAL_DMA2D_Start() you should wait for end of transfer with HAL_DMA2D_PollForTransfer(). This procedure is explained in the user manual of the STM32F4 HAL libraries UM1725 page 237. I would also recommend to check the DMA2D examples in STM32F4Cube FW package.

Please click on Select as Best if my reply answered your question. This will help other users with the same problem to find the solution faster!