cancel
Showing results for 
Search instead for 
Did you mean: 

Icons and DMA2D / STM32F746

S A
Associate II
Posted on July 07, 2017 at 04:55

Hi, I currently have STM32F746 connected to a 640x480LCD which is working as expected.

I'm using one LTDC hardware layer and doing everything through DMA2D and an external SRAM. So far all is good, I can load images and so on

I have a question though regarding the HAL_DMA2D_STARTxxxx functions. Obviousy those functions need a pointer to the LCD memory, the input bitmap and also the size of the bitmap but it seems that the bitmap size is basically ignored.

What I am trying to do is to place a 100x100 icon at some point of the screen, it should be as easy as passing the position in the video memory, the place where the icon is plus the icon size but it doesn't work as one would expect. It only works if the defined size of the LCD window (640x480 in my case) is exactly the same as the icon, otherwise it  places the icon linearly without respecting the 100x100 dimensions I passed to it.

I've searched the samples and there is a 'screen paint'  example where it does load small icons and place them at a location but it is accomplished manually by sending line by line with all the associated overheads of setting up the DMA2D every single line and calculating the memory location plus then waiting for the DMA2D to finish every line or handling a lot of interruptions while the lines are painted...

Perhaps I am misunderstanding the use of those functions but then there is little point on them as the Y size will be always 1 and we will have to handle the elements manually. The documentation indicates otherwise but it is a bit vague...

has anyone come to this problem and perhaps found something I am missing?

thank you!

2 REPLIES 2
S A
Associate II
Posted on July 07, 2017 at 08:02

I answer myself in case anyone has the same issue.

The DMA2D takes care of this through one of the DMA2D registers but the libraries aren't updating it.

The register OOR is an offset that determines where the next line is started, by writing the difference of the total screen width minus the bitmap width everything is aligned.

Very useful to paint fonts on screen or any other item without resorting to go pixel by pixel as in the STM32 paint example.

Posted on October 20, 2017 at 20:56

I think this is excactly what the CopyBuffer function does within the 

LCD_DSI_VideoMode_DoubleBuffering project, isn't it? It uses :   hdma2d.Init.OutputOffset = 800 - xsize;     

Cube F4 project:

C:\STM32Cube_FW_F4_V1.16.0\Projects\STM32469I-Discovery\Examples\LCD_DSI\LCD_DSI_VideoMode_DoubleBuffering\