cancel
Showing results for 
Search instead for 
Did you mean: 

DSI Horizontal values calculator based on video modes BURST vs NOBURST and LP ENABLED vs DISABLED

MM..1
Chief III

Now i fight with my third DSI LCD and have trouble with set parameters.

CubeMX say , that adopt from LTDC , but on changes nothing is recalculated.

Please simply write me formulas for calculate this :

VidCfg.Mode = DSI_VID_MODE_BURST;
  VidCfg.PacketSize = 480;
  VidCfg.NumberOfChunks = 0;
  VidCfg.NullPacketSize = 0;
 
//this values i need calculate
  VidCfg.HorizontalSyncActive = 9;
  VidCfg.HorizontalBackPorch = 87;
  VidCfg.HorizontalLine = 1569;

 i know calculate from DSI datasheet , but this dont work everytime.

2 REPLIES 2
Imen.D
ST Employee

Hello @MM..1​ ,

I recommend you to have a look to AN4860 Application note about DSI Host on STM32F469/479, STM32F7x8/x9 and STM32L4R9/S9 MCUs, which describes the DSI Host interface on STM32 microcontrollers and provides practical examples on how to configure the DSI Host depending on the operating mode.

Please follow the instructions in the section 6 to configure the DSI Host in different operating modes

0693W000006EiaUQAS.jpgHope this helps you.

Please mark my answer as best by clicking on the "Select as Best" button if it fully solved your issue. This will help other users find this solution more quickly.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
MM..1
Chief III

OK i ask directly for my LCD driver IC NV3051D 2160-channel 8-bit Source Driver and GOA/GIP Gate Driver with System-on chip for Color Amorphous TFTLCDs

Resolution 480x1280 .

Now i use this init attached

and call it in dsihost init

/**
  * @brief DSIHOST Initialization Function
  * @param None
  * @retval None
  */
static void MX_DSIHOST_DSI_Init(void)
{
 
  /* USER CODE BEGIN DSIHOST_Init 0 */
 
  /* USER CODE END DSIHOST_Init 0 */
 
  DSI_PLLInitTypeDef PLLInit = {0};
  DSI_HOST_TimeoutTypeDef HostTimeouts = {0};
  DSI_PHY_TimerTypeDef PhyTimings = {0};
  DSI_VidCfgTypeDef VidCfg = {0};
 
  /* USER CODE BEGIN DSIHOST_Init 1 */
 
  /* USER CODE END DSIHOST_Init 1 */
  hdsi.Instance = DSI;
  hdsi.Init.AutomaticClockLaneControl = DSI_AUTO_CLK_LANE_CTRL_DISABLE;
  hdsi.Init.TXEscapeCkdiv = 10;
  hdsi.Init.NumberOfLanes = DSI_TWO_DATA_LANES;
  PLLInit.PLLNDIV = 125;
  PLLInit.PLLIDF = DSI_PLL_IN_DIV2;
  PLLInit.PLLODF = DSI_PLL_OUT_DIV1;
  if (HAL_DSI_Init(&hdsi, &PLLInit) != HAL_OK)
  {
    Error_Handler();
  }
  HostTimeouts.TimeoutCkdiv = 1;
  HostTimeouts.HighSpeedTransmissionTimeout = 0;
  HostTimeouts.LowPowerReceptionTimeout = 0;
  HostTimeouts.HighSpeedReadTimeout = 0;
  HostTimeouts.LowPowerReadTimeout = 0;
  HostTimeouts.HighSpeedWriteTimeout = 0;
  HostTimeouts.HighSpeedWritePrespMode = DSI_HS_PM_DISABLE;
  HostTimeouts.LowPowerWriteTimeout = 0;
  HostTimeouts.BTATimeout = 0;
  if (HAL_DSI_ConfigHostTimeouts(&hdsi, &HostTimeouts) != HAL_OK)
  {
    Error_Handler();
  }
  PhyTimings.ClockLaneHS2LPTime = 28;
  PhyTimings.ClockLaneLP2HSTime = 32;
  PhyTimings.DataLaneHS2LPTime = 18;
  PhyTimings.DataLaneLP2HSTime = 18;
  PhyTimings.DataLaneMaxReadTime = 0;
  PhyTimings.StopWaitTime = 0;
  if (HAL_DSI_ConfigPhyTimer(&hdsi, &PhyTimings) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_DSI_SetLowPowerRXFilter(&hdsi, 10000) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_DSI_ConfigErrorMonitor(&hdsi, HAL_DSI_ERROR_NONE) != HAL_OK)
  {
    Error_Handler();
  }
  VidCfg.VirtualChannelID = 0;
  VidCfg.ColorCoding = DSI_RGB888;
  VidCfg.LooselyPacked = DSI_LOOSELY_PACKED_DISABLE;
  VidCfg.Mode = DSI_VID_MODE_BURST;
  VidCfg.PacketSize = WDTH;
  VidCfg.NumberOfChunks = 0;
  VidCfg.NullPacketSize = 0;
  VidCfg.HSPolarity = DSI_HSYNC_ACTIVE_LOW;
  VidCfg.VSPolarity = DSI_VSYNC_ACTIVE_LOW;
  VidCfg.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH;
  VidCfg.HorizontalSyncActive = HSPW*KKDD;
  VidCfg.HorizontalBackPorch = HBPD*KKDD;
  VidCfg.HorizontalLine = 1+((HBPD+HFPD+HSPW+WDTH)*KKDD);
  VidCfg.VerticalSyncActive = 2;
  VidCfg.VerticalBackPorch = 8;
  VidCfg.VerticalFrontPorch = 8;
  VidCfg.VerticalActive = 1280;
  VidCfg.LPCommandEnable = DSI_LP_COMMAND_ENABLE;
  VidCfg.LPLargestPacketSize = 66;
  VidCfg.LPVACTLargestPacketSize = 8;
  VidCfg.LPHorizontalFrontPorchEnable = DSI_LP_HFP_DISABLE;
  VidCfg.LPHorizontalBackPorchEnable = DSI_LP_HBP_DISABLE;
  VidCfg.LPVerticalActiveEnable = DSI_LP_VACT_ENABLE;
  VidCfg.LPVerticalFrontPorchEnable = DSI_LP_VFP_ENABLE;
  VidCfg.LPVerticalBackPorchEnable = DSI_LP_VBP_ENABLE;
  VidCfg.LPVerticalSyncActiveEnable = DSI_LP_VSYNC_ENABLE;
  VidCfg.FrameBTAAcknowledgeEnable = DSI_FBTAA_DISABLE;
  if (HAL_DSI_ConfigVideoMode(&hdsi, &VidCfg) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_DSI_SetGenericVCID(&hdsi, 0) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN DSIHOST_Init 2 */
  NV3051D_Init(NV3051D_FORMAT_RGB888, LCD_ORIENTATION_LANDSCAPE);
 
  /* USER CODE END DSIHOST_Init 2 */
 
}

as you can see i create formulas

VidCfg.HorizontalSyncActive = HSPW*KKDD;

VidCfg.HorizontalBackPorch = HBPD*KKDD;

VidCfg.HorizontalLine = 1+((HBPD+HFPD+HSPW+WDTH)*KKDD);

KKDD=625/330 what is clock DSI / clock LTDC pixel Sync 2 front 12 back 16 width 480

And now trouble:

  1. when i set some porch combination display start randomly ok , randomly shifted horizontaly, randomly not synced, randomloy bad colour or missed lines
  2. when i repeat later after around 300ms call to init DSI //// display sync ok over 90%
  if (HAL_DSI_ConfigVideoMode(&hdsi, &VidCfg) != HAL_OK)
  {
    Error_Handler();
  }

Same order i use on previous display with other driver IC , and all works ok allways.

H e l p