cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429IGT6 LTDC with RGB888 (854x480) image

Jdogk
Associate II

Hello everyone!

 

The MCU used is STM32F429IGT6.
Among the functions, we want to use LTDC.
Currently external memory cannot be used.
using internal flash memory
I am trying to use an RGB888 (854x480) 24bit image.
However, this image has a total size of 1.2MB and cannot be used in flash memory.

 

The image I use is below.
The first line of data determines all image data.
So, can the entire data be transmitted with the first (854x1) 24bit data?

 

 

Jdogk_2-1710831788476.png

 

Code is being written using the Standard Peripheral Library,
The code used is as follows.
This is the part where LTDC Initialize and Start of layer frame buffer are specified, as well as line length and ptich.

 

 

static uint32_t RGB888_854x1[641]=
{
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,

  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,

  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,

  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,

  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,

  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,

  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 
  0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555,
  0x00000000
};
static void LCD_Config(void)
{
    LTDC_InitTypeDef       LTDC_InitStruct;
    LTDC_Layer_InitTypeDef LTDC_Layer_InitStruct;

  /* Enable Pixel Clock --------------------------------------------------------*/

    /* Configure PLLSAI prescalers for LCD */
    /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 8 / 4 =>  2 Mhz*/
    /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAI_N = 2 * 107 = 214 Mhz */
    /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAI_R = 214 / 5 =  42.8Mhz */
    /* LTDC clock frequency = PLLLCDCLK / RCC_PLLSAIDivR =  42.8 / 4 = 10.7 Mhz */

    RCC_PLLSAIConfig(107, 4, 5); // N Q R 
    RCC_LTDCCLKDivConfig(RCC_PLLSAIDivR_Div4);
    
    /* Enable PLLSAI Clock */
    RCC_PLLSAICmd(ENABLE);
    /* Wait for PLLSAI activation */
    while(RCC_GetFlagStatus(RCC_FLAG_PLLSAIRDY) == RESET)
    {
    }
    
  /* Enable the LTDC Clock -----------------------------------------------------*/
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_LTDC, ENABLE);

  /* Configure the LCD Control pins --------------------------------------------*/
    LCD_AF_GPIOConfig();
        
  /* LTDC Initialization -------------------------------------------------------*/

    int Hsync = 10;
    int HBP = 2;
    int Active_Width = 854;
    int HFP = 2;
    int Vsync = 10;
    int VBP = 2;
    int Active_Height = 480;
    int VFP = 2;

    /* Polarity configuration */
    /* Initialize the horizontal synchronization polarity as active low */
    LTDC_InitStruct.LTDC_HSPolarity = LTDC_HSPolarity_AL;     
    /* Initialize the vertical synchronization polarity as active low */  
    LTDC_InitStruct.LTDC_VSPolarity = LTDC_VSPolarity_AL;     
    /* Initialize the data enable polarity as active low */ 
    LTDC_InitStruct.LTDC_DEPolarity = LTDC_DEPolarity_AL;     
    /* Initialize the pixel clock polarity as input pixel clock */ 
    LTDC_InitStruct.LTDC_PCPolarity = LTDC_PCPolarity_IPC;

    /* Timing configuration */
    /* Horizontal synchronization width = Hsync - 1 */     
    LTDC_InitStruct.LTDC_HorizontalSync = Hsync - 1;
    /* Vertical synchronization height = Vsync - 1 */
    LTDC_InitStruct.LTDC_VerticalSync = Vsync -1;
    /* Accumulated horizontal back porch = Hsync + HBP - 1 */
    LTDC_InitStruct.LTDC_AccumulatedHBP = Hsync + HBP - 1; 
    /* Accumulated vertical back porch = Vsync + VBP - 1 */
    LTDC_InitStruct.LTDC_AccumulatedVBP = Vsync + VBP - 1;  
    /* Accumulated active width = Hsync + HBP + Active Width - 1 */  
    LTDC_InitStruct.LTDC_AccumulatedActiveW = Hsync + HBP + Active_Width - 1;
    /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */
    LTDC_InitStruct.LTDC_AccumulatedActiveH = Vsync + VBP + Active_Height - 1;
    /* Total width = Hsync + HBP + Active Width + HFP - 1 */
    LTDC_InitStruct.LTDC_TotalWidth = Hsync + HBP + Active_Width + HFP - 1; 
    /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */
    LTDC_InitStruct.LTDC_TotalHeigh = Vsync + VBP + Active_Height + VFP - 1;
  
    /* Configure R,G,B component values for LCD background color */                   
    LTDC_InitStruct.LTDC_BackgroundRedValue = 0;            
    LTDC_InitStruct.LTDC_BackgroundGreenValue = 0;          
    LTDC_InitStruct.LTDC_BackgroundBlueValue = 0; 
    
    /* Initialize LTDC */          
    LTDC_Init(&LTDC_InitStruct);
    
  /* LTDC initialization end ---------------------------------------------------*/

  /* Layer1 Configuration ------------------------------------------------------*/
    
    /* Windowing configuration */ 
    /* In this case all the active display area is used to display a picture then :
      Horizontal start = horizontal synchronization + Horizontal back porch  
      Vertical start   = vertical synchronization + vertical back porch   
      Horizontal stop = Horizontal start + window width -1 
      Vertical stop   = Vertical start + window height -1      */ 
    LTDC_Layer_InitStruct.LTDC_HorizontalStart = Hsync + HBP;
    LTDC_Layer_InitStruct.LTDC_VerticalStart = Vsync + VBP;
    LTDC_Layer_InitStruct.LTDC_HorizontalStop = (Active_Width + Hsync + HBP - 1); 
    LTDC_Layer_InitStruct.LTDC_VerticalStop = (Active_Height + Vsync + VBP - 1);
    
    /* Pixel Format configuration*/           
    // LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB565;
    LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB888;
    
    /* Alpha constant (255 totally opaque) */
    LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 255; 
    
    /* Default Color configuration (configure A,R,G,B component values) */          
    LTDC_Layer_InitStruct.LTDC_DefaultColorBlue = 0;        
    LTDC_Layer_InitStruct.LTDC_DefaultColorGreen = 0;       
    LTDC_Layer_InitStruct.LTDC_DefaultColorRed = 0;         
    LTDC_Layer_InitStruct.LTDC_DefaultColorAlpha = 0;   

    /* Configure blending factors */       
    LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_CA;    
    LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_CA;
    
    /* Start Address configuration : frame buffer is located at FLASH memory */    
    LTDC_Layer_InitStruct.LTDC_CFBStartAdress = (uint32_t)&RGB888_854x1;
    
    /* the length of one line of pixels in bytes + 3 then :
      Line Lenth = Active high width x number of bytes per pixel + 3 
      Active high width         = 480 
      number of bytes per pixel = 2    (pixel_format : RGB565)
      number of bytes per pixel = 3    (pixel_format : RGB888) */
    LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((Active_Width * 3) + 3);
    
    /*  the pitch is the increment from the start of one line of pixels to the 
        start of the next line in bytes, then :
        Pitch = Active high width x number of bytes per pixel     */
    LTDC_Layer_InitStruct.LTDC_CFBPitch = (Active_Width * 3);  
    
    /* Configure the number of lines */
    LTDC_Layer_InitStruct.LTDC_CFBLineNumber = Active_Height;
    
    /* Initializes the Layer */ 
    LTDC_LayerInit(LTDC_Layer1, &LTDC_Layer_InitStruct);
    
  /* Layer1 Configuration end --------------------------------------------------*/
}

 

 

 

Jdogk_3-1710832290039.png

 

2 REPLIES 2
SofLit
ST Employee

Hello,

Don't know if you're aware about the AN4861 "Introduction to LCD-TFT display controller (LTDC) on STM32 MCUs ". You may find some answers there ..

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thank you for your response.
Yes, I already understood the contents of LTDC provided by ST, and I carefully read AN4861.


This is what I asked in my current HW (TI DLPC3470) attempt to use it as an internal mode and change the mode.

I left a message on ST Communities because I was wondering if there was a part that could be solved in a SW.