cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 FMC Display

gvigelet
Associate II
Posted on July 12, 2016 at 08:23

Hi everyone, I have a display hooked up to an STM32F767 via the FMC and all is working properly.  When I try to use DMA2D the DMA2D will only transfer the first 64K of data.  There is no error generated, it appears to be successful and the first 64K of the image looks fine.  Using buffers smaller than 64K work flawlessly.  Has anyone found a way to DMA a full screen buffer in one DMA2D pass.  This seems to work when using the LTDC controller, but I have had no luck getting it to work with a FMC 8080 interface.  I have tried it on an ssd1289 display and a raio8875 and both have this 64k boundary issue.  The only way I have been able to get the data over using DMA2D is to transfer 64K at a time.  

Any help would be greatly appreciated.

Thank You.
3 REPLIES 3
Walid FTITI_O
Senior II
Posted on July 12, 2016 at 17:48

Hi vigelette.george.002, 

I recommend that you refer to the DMA2D example in

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef7.html

intiteled ''DMA2D_MemToMemWithLCD'' ath this path:

STM32Cube_FW_F7_V1.4.0\Projects\STM32756G_EVAL\Examples\DMA2D

This example provides a description of how to configure DMA2D peripheral in  Memory_to_Memory transfer mode and display the result on LCD. The source buffer in format ARGB4444 and size 150x150 located in Flash is copied in Memory to Memory mode by the DMA2D in SRAM Destination buffer of same size and format. This SRAM buffer is then displayed by the LTDC centered on LCD screen.

How to calculate the size of the transferred data ?

 => selected color mode gives the number of bits per pixel and we have

    (ARGB4444 => 16bits/pixel) the number of pixel per line and the number of line,

    therefore :

   

    data_size = (bits per pixel) X (pixel per line + output offset) X (number of line)

-Hannibal- 

      

gvigelet
Associate II
Posted on July 12, 2016 at 20:42

Hi Hannibal,

I ported the project you referenced to to the discovery board and the Nucleo board.  On the discovery board the project works fine and on the Nucleo works fine if I run the same code and perform the mem to mem copy to sram buffer, when i try to do the memory copy directly to the FMC mapped LCD directly the DMA2D transfer only transfers the first 64K bytes which is my problem.  I have been able to port the demonstrations over using the provided examples without an issue (blending and such) but all images are small and under 64K it is only when I have images over 64K that I see the problem and only with the FMC 8080 interface.  I have used multiple 8080 interface chips RAIO, SSD1289, SSD1936 and they all seem to exhibit the same behavior.  Below is the code that runs to the sram buffer without issues and when I try to replace the sram buffer with the LCD mapped address I see the issue.  I thought it was a cache problem, but I already have the MPU set for the LCD mapped region.    

static void DMA2D_Test2(void)

{   

  /*##-1- Configure the DMA2D Mode, Color Mode and output offset #############*/ 

  Dma2dHandle.Init.Mode         = DMA2D_M2M;

  Dma2dHandle.Init.ColorMode    = DMA2D_OUTPUT_RGB565;

  Dma2dHandle.Init.OutputOffset = 0; 

  Dma2dHandle.Init.AlphaInverted = DMA2D_REGULAR_ALPHA;  /* No Output Alpha Inversion*/  

  Dma2dHandle.Init.RedBlueSwap   = DMA2D_RB_REGULAR;     /* No Output Red & Blue swap */   

  

  /*##hdma2d2- DMA2D Callbacks Configuration ######################################*/

  

  Dma2dHandle.XferCpltCallback  = TransferComplete;

  Dma2dHandle.XferErrorCallback = TransferError;

  

  /*##-3- Foreground Configuration ###########################################*/

  Dma2dHandle.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; //DMA2D_REPLACE_ALPHA;

  Dma2dHandle.LayerCfg[1].InputAlpha = 0xFF;

  Dma2dHandle.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;

  Dma2dHandle.LayerCfg[1].InputOffset = 0;

  Dma2dHandle.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR; /* No ForeGround Red/Blue swap */

  Dma2dHandle.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA; /* No ForeGround Alpha inversion */  

  Dma2dHandle.Instance          = DMA2D; 

  /* DMA2D Initialization */

  if(HAL_DMA2D_Init(&Dma2dHandle) == HAL_OK) 

  {

    if(HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1) == HAL_OK) 

    {

image_ready = 0;

/* setup RAIO controller to receive data

Active_Window(0,319,0,239);

LCD_SetCursor(0,0); 

LCD_WriteRAM_Prepare(); */

      if (HAL_DMA2D_Start_IT(&Dma2dHandle,(uint32_t)&RGB565_circ,

                                          (uint32_t)&aBufferResult,  //0x60000000,

                                          320,

                                          240) == HAL_OK)

      {

while(image_ready == 0){;}

      }

    }

  }  

}

gvigelet
Associate II
Posted on July 12, 2016 at 20:56

Hi Hannibal,

Well typing through my reply actually helped me out....I thought it is weird it is like it is masked at 64K, so I looked at my address bit A16 moved it to A17 and walla it works now.

Thank You for your effort