cancel
Showing results for 
Search instead for 
Did you mean: 

DMA2D Blend ARGB8888 with RGB565

mwp
Senior

Hi all,

I would like to blend a ARGB8888 image onto my RGB565 frame buffer. Is this possible?

The code I'm currently testing (that does not work) is the following:

 

	//configure DMA2D options
	LL_DMA2D_SetMode(DMA2D, LL_DMA2D_MODE_M2M_BLEND);
	LL_DMA2D_SetOutputColorMode(DMA2D, LL_DMA2D_OUTPUT_MODE_RGB565);
	LL_DMA2D_SetOutputRBSwapMode(DMA2D, LL_DMA2D_RB_MODE_REGULAR);
	//output
	LL_DMA2D_SetOutputMemAddr(DMA2D, (uint32_t)OutAddr);
	LL_DMA2D_SetLineOffsetMode(DMA2D, LL_DMA2D_LINE_OFFSET_PIXELS);
	LL_DMA2D_SetLineOffset(DMA2D, 0);
	LL_DMA2D_SetNbrOfLines(DMA2D, LCD_HEIGHT);
	LL_DMA2D_SetNbrOfPixelsPerLines(DMA2D, LCD_WIDTH);
	//background config (same as output)
	LL_DMA2D_BGND_SetColorMode(DMA2D, LL_DMA2D_INPUT_MODE_RGB565);
	LL_DMA2D_BGND_SetMemAddr(DMA2D, (uint32_t)OutAddr);
	LL_DMA2D_BGND_SetLineOffset(DMA2D, 0);
	LL_DMA2D_BGND_SetAlpha(DMA2D, 0xFF);
	LL_DMA2D_BGND_SetAlphaInvMode(DMA2D, LL_DMA2D_ALPHA_REGULAR);
	//foreground (input)
	LL_DMA2D_FGND_SetColorMode(DMA2D, LL_DMA2D_INPUT_MODE_ARGB8888);
	LL_DMA2D_FGND_SetMemAddr(DMA2D, (uint32_t)SrcAddr);
	LL_DMA2D_FGND_SetLineOffset(DMA2D, 0);
	LL_DMA2D_FGND_SetAlphaMode(DMA2D, LL_DMA2D_ALPHA_MODE_COMBINE);
	LL_DMA2D_FGND_SetAlphaInvMode(DMA2D, LL_DMA2D_ALPHA_REGULAR);
	LL_DMA2D_FGND_SetAlpha(DMA2D, AlphaValue);
	//go
	LL_DMA2D_Start(DMA2D);

 

Thanks in advance.

2 REPLIES 2
KDJEM.1
ST Employee

Hello @mwp ,

Could you please precise which STM32 MCUs devices are you using?

Concerning the first question about the conversion from YCBCR to RGB. I think that  AN4996 can help in this conversion case.

Concerning the second issue how to configure DMA2D with blending transfer mode. 

I advise you to get inspired from an available DMA2D_MemToMemWithBlending example by following the steps shared in readme.txt.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks for the reply. I worked out the YCBCR problem, but couldn't delete this forum post, so edited it with a new question instead.
The mcu is a STM32H7A3.
I have blending working fine for other colour modes, like ARGB4444 to RGB565, but ARGB8888 to RGB565 give me unexpected results.