STM32H735 Disco HAL DMA2D Not Working
Since a few days I own an STM32H735 Disco board. But I can't get HAL DMA2D to work correctly. The following code shall copy a line of pixels from RAM into the framebuffer:
DMA2D_HandleTypeDef hdma2d;
static void ConvertLineToRGB(uint32_t *pSrc, uint32_t *pDst, uint32_t xSize)
{
hdma2d.Instance = DMA2D;
/* Configure the DMA2D Mode, Color Mode and output offset */
hdma2d.Init.Mode = DMA2D_M2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
hdma2d.Init.OutputOffset = 0;
/* Foreground Configuration */
hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
//hdma2d.LayerCfg[1].InputAlpha = 0xFF;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
hdma2d.LayerCfg[1].InputOffset = 0;
/* DMA2D Initialization */
if(HAL_DMA2D_Init(&hdma2d) == HAL_OK)
{
if(HAL_DMA2D_ConfigLayer(&hdma2d, 1) == HAL_OK)
{
HAL_DMA2D_Start(&hdma2d, (uint32_t)pSrc, (uint32_t)pDst, xSize, 1);
HAL_DMA2D_PollForTransfer(&hdma2d, 25);
}
}
//memcpy(pDst, pSrc, xSize * 4);
}I can see in the debugger that HAL_DMA2D_Start() writes all zeroes into the target memory, instead of copying the data from pSrc. If I activate the memcpy() below, the data is copied correctly and the LCD display shows the correct graphics. I have the impression there is a bug in the HAL.
Indeed there is a similar function LL_ConvertLineToRGB() in the BSP (Board Support Package). But in the BSP the DMA2D code is deactivated by #define and pixels are copied one by one by code. It seems, DMA2D did not work at ST either. Has someone an idea?
