cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429IGT6 LTDC with RGB888 Settings

Jdogk
Associate II

Hello,

 I use STM32F429IGT6 MCU I am trying to communicate with TI's DLPC through HW connection.

To use this, use LTDC.

SW uses the Standard Peripheral Library and Complier uses IAR.

The HW GPIO settings were set using CubeIDE, and were set as follows according to the IDE's GPIO settings.

I am trying to send a 24bit image by setting it to RGB888.

 

1. When sending as RGB888, the settings are as follows. Is this the correct format?

 

 

 

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 -------------------------------------------------------*/

    uint8_t Hsync = 40;
    uint8_t HBP = 8;
    uint16_t Active_Width = 120;
    uint8_t HFP = 12;
    uint8_t Vsync = 10;
    uint8_t VBP = 4;
    uint16_t Active_Heigh = 100;
    uint8_t VFP = 6;
    
    /* Polarity configuration */
    /* Initialize the horizontal synchronization polarity as active low */
    LTDC_InitStruct.LTDC_HSPolarity = LTDC_HSPolarity_AH;     
    /* Initialize the vertical synchronization polarity as active low */  
    LTDC_InitStruct.LTDC_VSPolarity = LTDC_VSPolarity_AH;     
    /* 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_IIPC;
    
    /* 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_Heigh - 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_Heigh + 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 
      Horizontal stop = Horizontal start + window width -1 
      Vertical start   = vertical synchronization + vertical back porch     
      Vertical stop   = Vertical start + window height -1      */ 

    LTDC_Layer_InitStruct.LTDC_HorizontalStart = Hsync + HBP;
    LTDC_Layer_InitStruct.LTDC_HorizontalStop = (Hsync + HBP + Active_Width - 1); 
    LTDC_Layer_InitStruct.LTDC_VerticalStart = Vsync + VBP;
    LTDC_Layer_InitStruct.LTDC_VerticalStop = (Vsync + VBP + Active_Heigh - 1);

    /* Pixel Format configuration*/           
    LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB888;
    
    /* Alpha constant (255 totally opaque) */
    LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 255; 
    // LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 0; 

    /* 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_120x100; // CFBA

    /* 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 * 2) + 3);
    LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((Active_Width * 3) + 3);  // bit up to 1FFF = 8191

    /*  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 * 2);  
    LTDC_Layer_InitStruct.LTDC_CFBPitch = (Active_Width * 3);   // CFBP

    /* Configure the number of lines */
    LTDC_Layer_InitStruct.LTDC_CFBLineNumber = Active_Heigh;  // CFBL

    /* Initializes the Layer */ 
    LTDC_LayerInit(LTDC_Layer1, &LTDC_Layer_InitStruct);
    
  /* Layer1 Configuration end --------------------------------------------------*/
}

 

 

 

 

 

 
 

2. When sending data as shown below, Logic Analyzer seems to display something strange.

 

 

 

static const uint32_t RGB888_120x100[9000]

for(int i = 0; i<9000; i+=4)
{
   RGB888_120x100[i] = 0x0f00000f; // B 0000 1111 G 0000 0000 R 0000 0000 B 0000 1111
   RGB888_120x100[i+1] = 0x00000f00; // G 0000 0000 R 0000 0000 B 0000 1111 G 0000 0000
   RGB888_120x100[i+2] = 0x000f0000; // R 0000 0000 B 0000 1111 G 0000 0000 R 0000 0000
}

 

Jdogk_0-1710832727399.png

 

 

3. There is no problem when data is not being sent, but when data is sent, the TIMER system dies.

0 REPLIES 0