cancel
Showing results for 
Search instead for 
Did you mean: 

How to display the image throught LTDC signal in stm32f746-disco

Yugenthar
Senior

Hello everyone ,

I am Yugenthar .Now working in stm32f746-dosco board LTDC concept Try to display the image throught RGB LTDC Signal  

But I cannot able the display the image. but code working no error is comming .

step;

1.i have convert to image to LDC image convertor app (is convert image to c-header file)

then i give my main code Please give the sollution .

#include "main.h"

#include "bird1.h"

LTDC_HandleTypeDef hltdc;

UART_HandleTypeDef huart3;

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

static void MX_USART3_UART_Init(void);

static void MX_LTDC_Init(void);

int main(void)

{

  

 HAL_Init();

 SystemClock_Config();

 MX_GPIO_Init();

 MX_USART3_UART_Init();

 MX_LTDC_Init();

 while (1)

 {

   

 }

}

void SystemClock_Config(void)

{

 RCC_OscInitTypeDef RCC_OscInitStruct = {0};

 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  

 HAL_PWR_EnableBkUpAccess();

 __HAL_RCC_PWR_CLK_ENABLE();

 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

 RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;

 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

 RCC_OscInitStruct.PLL.PLLM = 4;

 RCC_OscInitStruct.PLL.PLLN = 96;

 RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;

 RCC_OscInitStruct.PLL.PLLQ = 4;

 RCC_OscInitStruct.PLL.PLLR = 2;

 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

 {

  Error_Handler();

 }

 if (HAL_PWREx_EnableOverDrive() != HAL_OK)

 {

  Error_Handler();

 }

 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

               |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;

 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)

 {

  Error_Handler();

 }

}

static void MX_LTDC_Init(void)

{

 LTDC_LayerCfgTypeDef pLayerCfg = {0};

 LTDC_LayerCfgTypeDef pLayerCfg1 = {0};

 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 = 654;

 hltdc.Init.AccumulatedActiveH = 485;

 hltdc.Init.TotalWidth = 660;

 hltdc.Init.TotalHeigh = 487;

 hltdc.Init.Backcolor.Blue = 0;

 hltdc.Init.Backcolor.Green = 0;

 hltdc.Init.Backcolor.Red = 0;

 if (HAL_LTDC_Init(&hltdc) != HAL_OK)

 {

  Error_Handler();

 }

 pLayerCfg.WindowX0 = 0;

 pLayerCfg.WindowX1 = 0;

 pLayerCfg.WindowY0 = 0;

 pLayerCfg.WindowY1 = 0;

 pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;

 pLayerCfg.Alpha = 0;

 pLayerCfg.Alpha0 = 0;

 pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

 pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

 pLayerCfg.FBStartAdress = 0;

 pLayerCfg.ImageWidth = 0;

 pLayerCfg.ImageHeight = 0;

 pLayerCfg.Backcolor.Blue = 0;

 pLayerCfg.Backcolor.Green = 0;

 pLayerCfg.Backcolor.Red = 0;

 if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)

 {

  Error_Handler();

 }

 pLayerCfg1.WindowX0 = 0;

 pLayerCfg1.WindowX1 = 0;

 pLayerCfg1.WindowY0 = 0;

 pLayerCfg1.WindowY1 = 0;

 pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;

 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();

 }

}

static void MX_USART3_UART_Init(void)

{

 huart3.Instance = USART3;

 huart3.Init.BaudRate = 115200;

 huart3.Init.WordLength = UART_WORDLENGTH_8B;

 huart3.Init.StopBits = UART_STOPBITS_1;

 huart3.Init.Parity = UART_PARITY_NONE;

 huart3.Init.Mode = UART_MODE_TX_RX;

 huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;

 huart3.Init.OverSampling = UART_OVERSAMPLING_16;

 huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;

 huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;

 if (HAL_UART_Init(&huart3) != HAL_OK)

 {

  Error_Handler();

 }

  

}

static void MX_GPIO_Init(void)

{

 GPIO_InitTypeDef GPIO_InitStruct = {0};

 __HAL_RCC_GPIOC_CLK_ENABLE();

 __HAL_RCC_GPIOF_CLK_ENABLE();

 __HAL_RCC_GPIOH_CLK_ENABLE();

 __HAL_RCC_GPIOA_CLK_ENABLE();

 __HAL_RCC_GPIOB_CLK_ENABLE();

 __HAL_RCC_GPIOE_CLK_ENABLE();

 __HAL_RCC_GPIOD_CLK_ENABLE();

 __HAL_RCC_GPIOG_CLK_ENABLE();

 HAL_GPIO_WritePin(GPIOB, LD3_Pin|LD2_Pin, GPIO_PIN_RESET);

 GPIO_InitStruct.Pin = USER_Btn_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(USER_Btn_GPIO_Port, &GPIO_InitStruct);

 GPIO_InitStruct.Pin = RMII_MDC_Pin|RMII_RXD0_Pin|RMII_RXD1_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

 GPIO_InitStruct.Alternate = GPIO_AF11_ETH;

 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

 /*Configure GPIO pin : RMII_CRS_DV_Pin */

 GPIO_InitStruct.Pin = RMII_CRS_DV_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

 GPIO_InitStruct.Alternate = GPIO_AF11_ETH;

 HAL_GPIO_Init(RMII_CRS_DV_GPIO_Port, &GPIO_InitStruct);

 /*Configure GPIO pin : RMII_TXD1_Pin */

 GPIO_InitStruct.Pin = RMII_TXD1_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

 GPIO_InitStruct.Alternate = GPIO_AF11_ETH;

 HAL_GPIO_Init(RMII_TXD1_GPIO_Port, &GPIO_InitStruct);

 /*Configure GPIO pins : LD3_Pin LD2_Pin */

 GPIO_InitStruct.Pin = LD3_Pin|LD2_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

}

void Error_Handler(void)

{

 /* USER CODE BEGIN Error_Handler_Debug */

 /* User can add his own implementation to report the HAL error return state */

 __disable_irq();

 while (1)

 {

 }

#ifdef USE_FULL_ASSERT

void assert_failed(uint8_t *file, uint32_t line)

{

}

1 ACCEPTED SOLUTION

Accepted Solutions
Yugenthar
Senior

Thank you bro i have check the ltdc pin schematic setup then finaly i got the output.

so thanks

View solution in original post

2 REPLIES 2
KDJEM.1
ST Employee

Hello @Yugenthar​ ,

Please check the LTDC Parameter Settings, for that I recommend you to refer to AN4861 LCD-TFT display controller (LTDC) on STM32 MCUs and precisely LTDC application examples Section.

Also, I advise you to start with an available LTDC_Display_1Layer example in the STM32CubeF7 package.

I hope this help you to solve the issue!

Kaouthar

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.

Yugenthar
Senior

Thank you bro i have check the ltdc pin schematic setup then finaly i got the output.

so thanks