cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429II LTDC Image size error

Jdogk
Associate II

Hello, I was controlling the LTDC image with STM32F429II (Flash 2MB, RAM 256 + 4KB) from ST.

I think there is an error in memory allocation, so I leave a question.
The compiler i use is IAR.

Currently, we have implemented the RGB888 image as 1.22MB size of the array => const uint8_t RGB888_854x480 [1229760] directly into the code LTDC.c and designated the RGB888 image as 854x480.

 

The LTDC initialization utilized the demo code of the Standard Peripheral Library (SPL) provided by ST and used the same structure as the initialization and image structure like /// const uint8_t RGB888_854x480 [1229760]={0x00, ...};

In my case, I referred to the LTDC manual AN4861 provided by ST, and it shows the fastest performance when used for Internal Flash Memory and for the STM32F429II series, it says Up to 2M... I tried using it, but I'm having the problem

Jdogk_0-1715230831448.png

 


When tested, there is no problem with the image size up to 500Kbyte, but if it goes up more than that, the PWM of TIMER 1 is not enabled

I think I'm having a memory allocation problem when I run code in the main statement.
I am initializing the PWM Timer first, but I confirmed that the PWM Timer is not working when it is stored in Flash memory.

To determine if this problem is an image problem of 1.22MB, I experimented as follows.

1. 1.22MB Image Storage O / LTDC Image Control O / PWM Timer X

2. 1.22MB Image Storage O / LTDC Image Control X / PWM Timer X

3. 400KB Image Storage O / LTDC Image Control O / PWM Timer O

4. 400MB Image Storage O / LTDC Image Control X / PWM Timer O

 

Here's my code in LTDC settings

 

how do i fix it?

 

 

 

/* Includes ------------------------------------------------------------------*/
#include "core_sys_config.h"
#include "ltdc_drv.h"
#include "RGB_Image.h"

/* Private function prototypes -----------------------------------------------*/
void LTDC_InitDriver(void);
static void LCD_Config(void);  
static void LCD_AF_GPIOConfig(void);

/* Private functions ---------------------------------------------------------*/
static void LCD_Config(void)
{
    LTDC_InitTypeDef       LTDC_InitStruct;
    LTDC_Layer_InitTypeDef LTDC_Layer_InitStruct;

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

    RCC_PLLSAIConfig(106, 4, 4); // N Q R PLLSAI DivR_Div8 // 13.4375 
    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 = 4;
    int HBP = 4;
    int Active_Width = 854;
    int HFP = 8;
    int Vsync = 1;
    int VBP = 1;
    int Active_Height = 480;
    int VFP = 1;

    LTDC_InitStruct.LTDC_HSPolarity = LTDC_HSPolarity_AH;     
    LTDC_InitStruct.LTDC_VSPolarity = LTDC_VSPolarity_AH;     
    LTDC_InitStruct.LTDC_DEPolarity = LTDC_DEPolarity_AL;     
    LTDC_InitStruct.LTDC_PCPolarity = LTDC_PCPolarity_IIPC;

    LTDC_InitStruct.LTDC_HorizontalSync = Hsync - 1;
    LTDC_InitStruct.LTDC_VerticalSync = Vsync -1;
    LTDC_InitStruct.LTDC_AccumulatedHBP = Hsync + HBP - 1; 
    LTDC_InitStruct.LTDC_AccumulatedVBP = Vsync + VBP - 1;  
    LTDC_InitStruct.LTDC_AccumulatedActiveW = Hsync + HBP + Active_Width - 1;
    LTDC_InitStruct.LTDC_AccumulatedActiveH = Vsync + VBP + Active_Height - 1;
    LTDC_InitStruct.LTDC_TotalWidth = Hsync + HBP + Active_Width + HFP - 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; 

    /* LTDC Interrupt */
    // LTDC_ITConfig(LTDC_IT_LI, ENABLE);s

    /* Initialize LTDC */          
    LTDC_Init(&LTDC_InitStruct);
    
  /* LTDC initialization end ---------------------------------------------------*/

  /* Layer1 Configuration ------------------------------------------------------*/
    
    /* Windowing configuration */ 
    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_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_854x480;

    LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((Active_Width * 3) + 3);
    
    LTDC_Layer_InitStruct.LTDC_CFBLineNumber = 480;
    
    /* Initializes the Layer */ 
    LTDC_LayerInit(LTDC_Layer1, &LTDC_Layer_InitStruct);
    
  /* Layer1 Configuration end --------------------------------------------------*/
}

 

 

 

 

 

 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __RGB_IMAGE_H
#define __RGB_IMAGE_H
const uint8_t RGB888_854x480[1229760] = 
{0x00, ..... };
#endif /* __RGB_IMAGE_H */

 

 

 

 

0 REPLIES 0