Skip to main content
Graduate
November 15, 2024
Solved

Parallel TFT Display not working

  • November 15, 2024
  • 2 replies
  • 1096 views

Hello Guys,

Currently I am using Parallel RGB888 TFT display with resolution 800X480 in which I am using STM32F429ZIT6 controller using LTDC with DMA2 and I am printing whole RED color on display but display showing lines.

My question is as I am not using external SDRAM will internal SDRAM of STM32F4 is sufficient to drive this. and if not then what is the issue

int main(void)
{

/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_LTDC_Init();
MX_DMA2D_Init();
/* USER CODE BEGIN 2 */


// Fill the screen with a solid color as a test
uint32_t color = 0x00FF00; // RGB888 for green
HAL_DMA2D_Start(&hdma2d, color, FRAME_BUFFER_ADDRESS, SCREEN_WIDTH, SCREEN_HEIGHT);
HAL_DMA2D_PollForTransfer(&hdma2d, 10);

HAL_LTDC_Reload(&hltdc, LTDC_RELOAD_IMMEDIATE);


/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}



static void MX_DMA2D_Init(void)
{

/* USER CODE BEGIN DMA2D_Init 0 */

/* USER CODE END DMA2D_Init 0 */

/* USER CODE BEGIN DMA2D_Init 1 */

/* USER CODE END DMA2D_Init 1 */
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB888;
hdma2d.Init.OutputOffset = 0;
hdma2d.LayerCfg[1].InputOffset = 0;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB888;
hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
hdma2d.LayerCfg[1].InputAlpha = 0;
if (HAL_DMA2D_Init(&hdma2d) != HAL_OK)
{
Error_Handler();
}
if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN DMA2D_Init 2 */

/* USER CODE END DMA2D_Init 2 */

}

/**
* @brief LTDC Initialization Function
* @PAram None
* @retval None
*/
static void MX_LTDC_Init(void)
{

/* USER CODE BEGIN LTDC_Init 0 */

/* USER CODE END LTDC_Init 0 */

LTDC_LayerCfgTypeDef pLayerCfg1 = {0};

/* USER CODE BEGIN LTDC_Init 1 */

/* USER CODE END LTDC_Init 1 */
hltdc.Instance = LTDC;
hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
hltdc.Init.HorizontalSync = 7;
hltdc.Init.VerticalSync = 3;
hltdc.Init.AccumulatedHBP = 14;
hltdc.Init.AccumulatedVBP = 5;
hltdc.Init.AccumulatedActiveW = SCREEN_WIDTH;
hltdc.Init.AccumulatedActiveH = SCREEN_HEIGHT;
hltdc.Init.TotalWidth = SCREEN_WIDTH;
hltdc.Init.TotalHeigh = SCREEN_HEIGHT;
hltdc.Init.Backcolor.Blue = 0;
hltdc.Init.Backcolor.Green = 0;
hltdc.Init.Backcolor.Red = 0;
if (HAL_LTDC_Init(&hltdc) != HAL_OK)
{
Error_Handler();
}
pLayerCfg1.WindowX0 = 0;
pLayerCfg1.WindowX1 = 0;
pLayerCfg1.WindowY0 = 0;
pLayerCfg1.WindowY1 = 0;
pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_RGB888;
pLayerCfg1.Alpha = 0;
pLayerCfg1.Alpha0 = 0;
pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
pLayerCfg1.FBStartAdress = 0;
pLayerCfg1.ImageWidth = 0;
pLayerCfg1.ImageHeight = 0;
pLayerCfg1.Backcolor.Blue = 0;
pLayerCfg1.Backcolor.Green = 0;
pLayerCfg1.Backcolor.Red = 0;
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN LTDC_Init 2 */

/* USER CODE END LTDC_Init 2 */

}

 

    This topic has been closed for replies.
    Best answer by KDJEM.1

    Hello @tobbymathew and welcome to the Community,

     

    For STM32F429, the total embedded SRAM size is 256 Kbytes and 4 Kbytes of backup SRAM.

    KDJEM1_2-1732010175282.png

     

    So, you need to check if the frame can be located in the internal SRAM or the size of frame buffer exceeds the internal SRAM size. Note that the double frame buffer calculation depends on color depth and display.  

    For that, I recommend you to take a look at  AN4861 precisely 7.2 Example: creating a basic graphical application.

    This section provides an example based on the STM32F746G-DISCO board, describing the steps required to
    create a basic graphic application and explains how determining framebuffer size and location.  

    KDJEM1_1-1732008856046.png

    I hope this help you.

    Thank you.

    Kaouthar

    2 replies

    KDJEM.1Answer
    Technical Moderator
    November 19, 2024

    Hello @tobbymathew and welcome to the Community,

     

    For STM32F429, the total embedded SRAM size is 256 Kbytes and 4 Kbytes of backup SRAM.

    KDJEM1_2-1732010175282.png

     

    So, you need to check if the frame can be located in the internal SRAM or the size of frame buffer exceeds the internal SRAM size. Note that the double frame buffer calculation depends on color depth and display.  

    For that, I recommend you to take a look at  AN4861 precisely 7.2 Example: creating a basic graphical application.

    This section provides an example based on the STM32F746G-DISCO board, describing the steps required to
    create a basic graphic application and explains how determining framebuffer size and location.  

    KDJEM1_1-1732008856046.png

    I hope this help you.

    Thank you.

    Kaouthar

    Graduate
    November 20, 2024

    hello ,

    Do you have reference code for the same 

    Technical Moderator
    November 21, 2024

    Hello @tobbymathew ,

     

    I advise you to start with an available example like as LTDC_Display_2Layers in STM32CubeF4 and get inspired to create your own project.

    Also, I think 7.2 Example: creating a basic graphical application section in  AN4861 can help you.

     

    Thank you.

    Kaouthar