Monday, December 11th 2017, 11:59pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Raash

Beginner

Date of registration: Oct 29th 2016

Posts: 16

1

Wednesday, November 8th 2017, 10:21pm

emWin and DMA2D

Hello.
Used controller STM32F429, LTDC, DMA2D and LCD 7 inc resolution 800x480 pixels.
For example, the function of copying the buffer looks like this:
static void DMA2D_CopyBuffer(uint32_t layer_index, void* pSrc, void* pDst, uint32_t x_size, uint32_t y_size, uint32_t off_line_src, uint32_t off_line_dst)
{
uint32_t PixelFormat = GetPixelformat(layer_index);
DMA2D->CR = 0x00000000UL | (1 << 9); // Memory to memory and TCIE
/* Set up pointers */
DMA2D->FGMAR = (uint32_t)pSrc; // Source address
DMA2D->OMAR = (uint32_t)pDst; // Destination address
DMA2D->FGOR = off_line_src; // Source line offset
DMA2D->OOR = off_line_dst; // Destination line offset
/* Set up pixel format */
DMA2D->FGPFCCR = PixelFormat; // Defines the number of pixels to be transfered */
/* Set up size */
DMA2D->NLR = (uint32_t)(x_size << 16) | (U16)y_size; // Size configuration of area to be transfered
DMA2D->CR |= DMA2D_CR_START; // Start operation
/* Wait until transfer is done */
while(DMA2D->CR & DMA2D_CR_START)
{ }
}

Interruption that is not used anywhere.
// Transfer complete interrupt of DMA2Dvoid DMA2D_ISR_Handler(void)
{
DMA2D->IFCR = (U32)DMA2D_IFSR_CTCIF;
}

This starts DMA2D
DMA2D->CR |= DMA2D_CR_START; // Start operation

And here in the cycle is expected to perform a copy operation.
/* Wait until transfer is done */
while(DMA2D->CR & DMA2D_CR_START)
{ }

Copy for resolution 800x480 is 19 ms. That is, the CPU runs 19 ms in a cycle. and the program does not do anything useful. As I see, the use of DMA2D gives a minimal benefit.

Is it possible, instead of a loop, to insert a semaphore in the emWin function? To continue copying, the CPU does a useful job.[/size]

This post has been edited 4 times, last edit by "Raash" (Nov 8th 2017, 10:47pm)


Raash

Beginner

Date of registration: Oct 29th 2016

Posts: 16

2

Tuesday, November 14th 2017, 8:05am

Dear Segger.
Is there an option in EmWin, determine end of transmission DMA2D, using the interrupt DMA2D_ISR_Handler() . And do not use poling while(DMA2D->CR & DMA2D_CR_START).
Example in the previous post.



SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 440

3

Tuesday, November 14th 2017, 9:32am

Hi,

emWin doesn't offer this functionality. It is not part of the emWin library itself.

The LCDConf.c you are referring to configures just the interface between emWin and the hardware. How this is done is more or less user defined. So, please feel free to modify the LCDConf.c as you wish.

Regards
SVen

Raash

Beginner

Date of registration: Oct 29th 2016

Posts: 16

4

Tuesday, November 14th 2017, 1:04pm

I understand, the chain of calls is this:
GUI_EXec()
..->_LCD_DrawBitmap16bpp()
....->_DMA_Copy()
......{
...........................
........DMA2D->CR |= DMA2D_CR_START;
........while(DMA2D->CR & DMA2D_CR_START)

......}


if I write the parameters of the _DMA_Copy() function in my circular buffer and I will call them using DMA2D_ISR_Handler(), then the picture collapses. Since the pointers for _DMA_Copy () will no longer be relevant.

Can I use it LCD_ControlCache(LCD_CC_LOCK) and LCD_ControlCache(LCD_CC_UNLOCK) so that the allocated memory under the emWin widgets is not cleared or overwritten. Or there is another way.

Sorry for my English.

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 440

5

Thursday, November 16th 2017, 9:54am

Hi,

LCD_ControlCache() makes only sence if you are usin a driver for an indirect interface like GUIDRV_FlexColor. With GUIDRV_Lin it has no effect.

Regards
Sven

Raash

Beginner

Date of registration: Oct 29th 2016

Posts: 16

6

Thursday, November 16th 2017, 10:34am

Hello.
LCD_ControlCache() I tried, there was no result.
To date, there is no way to buffer the data pointers that need to be displayed? To output these pointers using the interrupt DMA2D.
Is such a functional expected in the future for the full use of DMA2D?