DMA frame buffer copy

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

    • DMA frame buffer copy

      In an effort to optimize my application, I am investigating DMA transfer for frame buffer copies. The "Multiple Buffering" chapter in the manual describes how to inform emWin to use a custom callback routine in LCD_X_Config():

      LCD_SetDevFunc(0, LCD_DEVFUNC_COPYBUFFER, (void (*)())_CopyBuffer);

      The problem I'm having with DMA implementation is how to notify emWin that the buffer copy is completed. Since emWin is not expecting _CopyBuffer() to return anything, I end up with one of the following scenarios:
      1. DMA transfer is started inside _CopyBuffer() and the function returns. emWin thinks upon return that the frame buffer copy is done, so I end up with the incorrect buffer being displayed (flipping between buffers which are obviously wrong). I am using triple buffering.
      2. I create a loop inside _CopyBuffer() which waits for the DMA transfer to complete. This is no benefit over a standard memcpy().


      Am I missing something simple or is this just not possible?

      emWin V5.38
      NXP LPC546xx
    • Hi,

      You have to implement a VSYNC interrupt routine which tells emWin the back buffer has become the front buffer. Only setting a CopyBuffer function is not sufficient.

      Attached is a LCD configuration used for the LPC54608. Just use it a reference.

      Regards,
      Sven
      Files
      • LCDConf.zip

        (2.61 kB, downloaded 236 times, last: )
      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.