cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX code generation STM32H7xx DMA2D RGB565 mode bug

Jan Nowak_2
Associate II

Hello,

I've found a bug during code generation using STM32CubeMX on STM32H725AE MCU.

STM32CubeMX doesn't generete correct code for DMA2D using RGB565 format.

In function:

void MX_DMA2D_Init(void)
{
 
  /* USER CODE BEGIN DMA2D_Init 0 */
 
  /* USER CODE END DMA2D_Init 0 */
 
  /* USER CODE BEGIN DMA2D_Init 1 */
 
  /* USER CODE END DMA2D_Init 1 */
  hdma2d.Instance = DMA2D;
  hdma2d.Init.Mode = DMA2D_M2M;
  hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB565;
  hdma2d.Init.OutputOffset = 0;
  hdma2d.LayerCfg[1].InputOffset = 0;
  hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
  hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
  hdma2d.LayerCfg[1].InputAlpha = 0;
  hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
  hdma2d.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR;
  hdma2d.LayerCfg[1].ChromaSubSampling = DMA2D_NO_CSS;
  if (HAL_DMA2D_Init(&hdma2d) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN DMA2D_Init 2 */
 
  /* USER CODE END DMA2D_Init 2 */
 
}

It doesn't generate this line, which causes wrong pixel color to be displayed.

hdma2d.Init.BytesSwap = DMA2D_BYTES_SWAP;

BR,

JN

2 REPLIES 2
Aymen ABBES
ST Employee

Hello, 

First of all let me thank you for posting.

Could you please provide the *.ioc file and the CubeMx and CubeIDE version so I be able to investigate the issue.

Kind regards,

Aymen

Jan Nowak_2
Associate II

Hello,

Thank you for the respond. I'm sorry, but i cannot provide *.ioc file, because the project is private. The version of CubeMX is 6.6.1. I'm not using CubeIDE, just CubeMX. I hope it will be helpfull.

BR,

Jan