emWin and DMA2D

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • 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]

    The post was edited 4 times, last by Raash ().

  • 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.


  • 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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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.
  • 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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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?