cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F469 development board to output MIPI video to a custom screen (GC9503CV), and the screen shows tearing

Lewis233
Associate III

I am using the STM32F469 development board to output MIPI video to a custom screen (GC9503CV), and the screen shows tearing.

The left side of the screen displays normally, while the right side shows a jagged appearance. How should I locate and resolve the issue?

 

 

 

6 REPLIES 6
Osman SOYKURT
ST Employee

Hello @Lewis233 ,

We would need more info about your project configuration to help you.

Have you started your project from the STM32F469i-disco TBS on TouchGFX Designer?
What strategy have you selected for your video decoding (direct to framebuffer? single? double?)
What's your screen resolution? what about the video?
What's you framebuffer format? 
Is your video located in external QSPI Flash?

Osman SOYKURT
ST Software Developer | TouchGFX
Lewis233
Associate III

I am using the STM32F469 development kit and have replaced the screen with a GC9503CV. This is my init 

void BSP_LCD_InitEx()
{
	  DSI_PLLInitTypeDef dsiPllInit;
	  DSI_PHY_TimerTypeDef  PhyTimings;
	  uint32_t LcdClock  = 27429;//35000; /*!< LcdClk = 27429 kHz */
	  uint32_t laneByteClk_kHz = 0;
	  uint32_t                   VSA; /*!< Vertical start active time in units of lines */
	  uint32_t                   VBP; /*!< Vertical Back Porch time in units of lines */
	  uint32_t                   VFP; /*!< Vertical Front Porch time in units of lines */
	  uint32_t                   VACT; /*!< Vertical Active time in units of lines = imageSize Y in pixels to display */
	  uint32_t                   HSA; /*!< Horizontal start active time in units of lcdClk */
	  uint32_t                   HBP; /*!< Horizontal Back Porch time in units of lcdClk */
	  uint32_t                   HFP; /*!< Horizontal Front Porch time in units of lcdClk */
	  uint32_t                   HACT; /*!< Horizontal Active time in units of lcdClk = imageSize X in pixels to display */

	  /* Toggle Hardware Reset of the DSI LCD using
	  * its XRES signal (active low) */
	  BSP_LCD_Reset();

	  /* Call first MSP Initialize only in case of first initialization
	  * This will set IP blocks LTDC, DSI and DMA2D
	  * - out of reset
	  * - clocked
	  * - NVIC IRQ related to IP blocks enabled
	  */
	  BSP_LCD_MspInit();

	  /* Base address of DSI Host/Wrapper registers to be set before calling De-Init */
	  hdsi.Instance = DSI;
	  HAL_DSI_DeInit(&(hdsi));

	  dsiPllInit.PLLNDIV  = 125;
	  dsiPllInit.PLLIDF   = DSI_PLL_IN_DIV2;
	  dsiPllInit.PLLODF   = DSI_PLL_OUT_DIV1;
	  //dsiPllInit.

	  laneByteClk_kHz = 62500; /* 500 MHz / 8 = 62.5 MHz = 62500 kHz */

	  /* Set number of Lanes */
	  hdsi.Init.NumberOfLanes = DSI_TWO_DATA_LANES;

	  /* TXEscapeCkdiv = f(LaneByteClk)/15.62 = 4 */
	  hdsi.Init.TXEscapeCkdiv = laneByteClk_kHz/15620;

	  HAL_DSI_Init(&(hdsi), &(dsiPllInit));

	  /* Start DSI */
	  HAL_DSI_Start(&hdsi);

	  /* Enable the DSI BTW for read operations */
	  HAL_DSI_ConfigFlowControl(&hdsi, DSI_FLOW_CONTROL_BTA);

	  BSP_LCD_Reset();
	  HAL_DSI_Stop(&hdsi);

	  HACT = lcd_x_size;
	  VACT = lcd_y_size;

//	  VSA  = 120;
//	  VBP  = 150;
//	  VFP  = 150;
//	  HSA  = 2;
	  HBP  = 75;
	  HFP  = 160;

	  VSA = 2;
	  VBP = 15;
	  VFP = 8;
	  HSA = 10;
//	  HBP = 130;
//	  HFP = 130;




	  hdsivideo_handle.VirtualChannelID = 0;
	  hdsivideo_handle.ColorCoding = DSI_RGB565;
	  hdsivideo_handle.VSPolarity = DSI_VSYNC_ACTIVE_LOW;
	  hdsivideo_handle.HSPolarity = DSI_VSYNC_ACTIVE_LOW;
	  hdsivideo_handle.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH;
	  hdsivideo_handle.Mode = DSI_VID_MODE_BURST; /* Mode Video burst ie : one LgP per line */
	  hdsivideo_handle.NullPacketSize = 0;
	  hdsivideo_handle.NumberOfChunks = 0;
	  hdsivideo_handle.PacketSize                = HACT; /* Value depending on display orientation choice portrait/landscape */
	  hdsivideo_handle.HorizontalSyncActive      = (HSA * laneByteClk_kHz) / LcdClock;
	  hdsivideo_handle.HorizontalBackPorch       = (HBP * laneByteClk_kHz) / LcdClock;
	  hdsivideo_handle.HorizontalLine            = ((HACT + HSA + HBP + HFP) * laneByteClk_kHz) / LcdClock; /* Value depending on display orientation choice portrait/landscape */
	  hdsivideo_handle.VerticalSyncActive        = VSA;
	  hdsivideo_handle.VerticalBackPorch         = VBP;
	  hdsivideo_handle.VerticalFrontPorch        = VFP;
	  hdsivideo_handle.VerticalActive            = VACT; /* Value depending on display orientation choice portrait/landscape */

	  hdsivideo_handle.LPCommandEnable = DSI_LP_COMMAND_ENABLE; /* Enable sending commands in mode LP (Low Power) */

	  /* Only useful when sending LP packets is allowed while streaming is active in video mode */
	  hdsivideo_handle.LPLargestPacketSize = 16;

	  /* Only useful when sending LP packets is allowed while streaming is active in video mode */
	  hdsivideo_handle.LPVACTLargestPacketSize = 0;

	  /* while streaming is active in video mode                                                                         */
	  hdsivideo_handle.LPHorizontalFrontPorchEnable = DSI_LP_HFP_ENABLE;   /* Allow sending LP commands during HFP period */
	  hdsivideo_handle.LPHorizontalBackPorchEnable  = DSI_LP_HBP_ENABLE;   /* Allow sending LP commands during HBP period */
	  hdsivideo_handle.LPVerticalActiveEnable = DSI_LP_VACT_ENABLE;  /* Allow sending LP commands during VACT period */
	  hdsivideo_handle.LPVerticalFrontPorchEnable = DSI_LP_VFP_ENABLE;   /* Allow sending LP commands during VFP period */
	  hdsivideo_handle.LPVerticalBackPorchEnable = DSI_LP_VBP_ENABLE;   /* Allow sending LP commands during VBP period */
	  hdsivideo_handle.LPVerticalSyncActiveEnable = DSI_LP_VSYNC_ENABLE; /* Allow sending LP commands during VSync = VSA period */

	  /* Configure DSI Video mode timings with settings set above */
	  HAL_DSI_ConfigVideoMode(&(hdsi), &(hdsivideo_handle));

	  /* Configure DSI PHY HS2LP and LP2HS timings */
	  PhyTimings.ClockLaneHS2LPTime = 35;
	  PhyTimings.ClockLaneLP2HSTime = 35;
	  PhyTimings.DataLaneHS2LPTime = 35;
	  PhyTimings.DataLaneLP2HSTime = 35;
	  PhyTimings.DataLaneMaxReadTime = 0;
	  PhyTimings.StopWaitTime = 10;
	  HAL_DSI_ConfigPhyTimer(&hdsi, &PhyTimings);

	  /* Timing Configuration */
	  hltdc.Init.HorizontalSync = (HSA - 1);
	  hltdc.Init.AccumulatedHBP = (HSA + HBP - 1);
	  hltdc.Init.AccumulatedActiveW =(lcd_x_size + HSA + HBP - 1);
	  hltdc.Init.TotalWidth = (lcd_x_size + HSA + HBP + HFP - 1);
	  hltdc.Init.VerticalSync = (VSA - 1);
	  hltdc.Init.AccumulatedVBP = (VSA + VBP - 1);
	  hltdc.Init.AccumulatedActiveH =(lcd_y_size + VSA + VBP - 1);
	  hltdc.Init.TotalHeigh = (lcd_y_size + VSA + VBP + VFP - 1);

	  /* Initialize the LCD pixel width and pixel height */
	  hltdc.LayerCfg->ImageWidth  = lcd_x_size;
	  hltdc.LayerCfg->ImageHeight = lcd_y_size;

	  /* LCD clock configuration */
	  /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
	  /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 384 Mhz */
	  /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 384 MHz / 7 = 54.857 MHz */
	  /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 54.857 MHz / 2 = 27.429 MHz */
	  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
	  PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
	  PeriphClkInitStruct.PLLSAI.PLLSAIR = 7;
	  PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
	  HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);

	  /* Background value */
	  hltdc.Init.Backcolor.Blue = 0;
	  hltdc.Init.Backcolor.Green = 0;
	  hltdc.Init.Backcolor.Red = 0;
	  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.Instance = LTDC;

	  /* Get LTDC Configuration from DSI Configuration */
	  HAL_LTDCEx_StructInitFromVideoConfig(&(hltdc), &(hdsivideo_handle));

	  /* Initialize the LTDC */
	  HAL_LTDC_Init(&hltdc);

	  /* Enable the DSI host and wrapper after the LTDC initialization
	     To avoid any synchronization issue, the DSI shall be started after enabling the LTDC */
	  HAL_DSI_Start(&(hdsi));

	  fresh_flag_temp = HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1);
	  if(fresh_flag_temp == 0x1234)
	  {
		  GC9503CV_Init_2();
		  iwdg_fresh_flag = 1;
	  }else {
		  GC9503CV_Init();
		  HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR1,fresh_flag);
	  }
}

 

 

 

 

 

Hello @Lewis233 ,

Could you please provide your answers to the questions from my previous message?

@Osman SOYKURT wrote:

Have you started your project from the STM32F469i-disco TBS on TouchGFX Designer?
What strategy have you selected for your video decoding (direct to framebuffer? single? double?)
What's your screen resolution? what about the video?
What's you framebuffer format? 
Is your video located in external QSPI Flash?


Osman SOYKURT
ST Software Developer | TouchGFX
  1. I modified the STM32F469i-Disco TBS and used TouchGFX Designer.
  2. LTDC with single buffer and one data lane; DSI video also in single-lane mode.
  3. Screen resolution is 480 × 800; video mode is DSI_VID_MODE_BURST.
  4. Single framebuffer, RGB565 format.
  5. The display uses the MIPI protocol; only UI widgets are running—no video module is present.

T。T 

Hi, what additional information do I need to provide? How long will it take to receive a response?