2022-02-22 04:38 AM
Hello,
I hope someone can help me. After days over days reading docs, other questions and so on i am still confused how all the LTDC and DSI stuff works.
OK, so what i have is a STM32F469 Disovery board which already has a display on it.
I create a project in touchgfx with just a blue screen and 4 white boxes in the corners.
Opened in the IDE i can upload it and it works. No wonder, it is all original.
Now i changed the display using the same FPC connector. I am using a small pcb for changing the wires to match the spec of the new display.
It is also 2 lane DSI.
As program "template" i still use one of the 469-disco
I removed all the otm8009a stuff, and used the power-on sequence of the new display with the HX8363 instead of the OTM8009a
HAL_DSI_ShortWrite(&hdsi, 0x00, DSI_DCS_SHORT_PKT_WRITE_P1, 0x11, 0x00);
HAL_Delay(201);
uint8_t enExtCmd[5] = {0xFF, 0x83, 0x63};
HAL_DSI_LongWrite(&hdsi, 0x00, DSI_DCS_LONG_PKT_WRITE, 4, 0xB9, enExtCmd);
uint8_t setLaneNumer[15] ={0x80, 0x00, 0x10, 0x08, 0x08, 0x10, 0x7E, 0x6E, 0x6D, 0x0A, 0x01, 0x80, 0x43};
HAL_DSI_LongWrite(&hdsi, 0x00, DSI_DCS_LONG_PKT_WRITE, 14, 0xBA, setLaneNumer);
HAL_DSI_ShortWrite(&hdsi, 0x00, DSI_DCS_SHORT_PKT_WRITE_P1, 0x36, 0x00);
HAL_Delay(7);
HAL_DSI_ShortWrite(&hdsi, 0x00, DSI_DCS_SHORT_PKT_WRITE_P1, 0xCC, 0x0B);
HAL_Delay(11);
HAL_DSI_ShortWrite(&hdsi, 0x00, DSI_DCS_SHORT_PKT_WRITE_P1, 0x29, 0x00);
After countless attempts playing around without knowing what i am doing i got the display showing something. For me it was a big success. I opened the IOC to change the touchgfx interface to Parallel RGB (LTDC) and Driver to LTDC.
DSI Host to Video Mode.
Datasheet:
- 4.0 inch diagonal display, 480 x RGB [H] x 800 [V] dots.
- 24bitRGB ( 8-8-8 Format ) / 16.7 Million colors.
- MIPI DSI as high-speed interface. Video mode only.
So far so good. I thought it would be easy now to get the timing and all the other parameters. Just use the datasheet and put the values in the correct parameter using the IOC config.
And here i started to read many many docs about LTDC, DSI and so on. But still do not understand it.
So the display is 4.0" WVGA 480 x RGB x 800 Portrait
In the dimensions part of the datasheet there is "Number of dots" 1440[H] x 800[V]. Is that something important to adjust or does that be controlled by the IC driver HX8363 ?
What about the timings? In all the datasheets some other people posted in their questions, which did not help me, the "Item" and "Symbol" is different, so it seems that every manufacturer use different namings of functions.
In my case:
And:
This is what my display actually show:
Using this settings:
static void MX_DMA2D_Init(void)
{
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
hdma2d.Init.OutputOffset = 0;
hdma2d.LayerCfg[1].InputOffset = 0;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
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();
}
}
static void MX_DSIHOST_DSI_Init(void)
{
/* USER CODE BEGIN DSIHOST_Init 0 */
/* Activate XRES active low */
HAL_Delay(20); /* wait 20 ms */
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_RESET);
HAL_Delay(20); /* wait 20 ms */
/* Desactivate XRES */
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_SET);
/* Wait for 11ms after releasing XRES before sending commands */
HAL_Delay(11);
/* USER CODE END DSIHOST_Init 0 */
DSI_PLLInitTypeDef PLLInit = {0};
DSI_HOST_TimeoutTypeDef HostTimeouts = {0};
DSI_PHY_TimerTypeDef PhyTimings = {0};
DSI_VidCfgTypeDef VidCfg = {0};
hdsi.Instance = DSI;
hdsi.Init.AutomaticClockLaneControl = DSI_AUTO_CLK_LANE_CTRL_DISABLE;
hdsi.Init.TXEscapeCkdiv = 4;
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 = 33;
PhyTimings.DataLaneHS2LPTime = 15;
PhyTimings.DataLaneLP2HSTime = 25;
PhyTimings.DataLaneMaxReadTime = 0;
PhyTimings.StopWaitTime = 0;
if (HAL_DSI_ConfigPhyTimer(&hdsi, &PhyTimings) != HAL_OK)
{
Error_Handler();
}
if (HAL_DSI_ConfigFlowControl(&hdsi, DSI_FLOW_CONTROL_BTA) != 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_NB_PULSES;
VidCfg.PacketSize = 1;
VidCfg.NumberOfChunks = 200;
VidCfg.NullPacketSize = 0;
VidCfg.HSPolarity = DSI_HSYNC_ACTIVE_LOW;
VidCfg.VSPolarity = DSI_VSYNC_ACTIVE_LOW;
VidCfg.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH;
VidCfg.HorizontalSyncActive = 4;
VidCfg.HorizontalBackPorch = 2;
VidCfg.HorizontalLine = 425;
VidCfg.VerticalSyncActive = 2;
VidCfg.VerticalBackPorch = 1;
VidCfg.VerticalFrontPorch = 1;
VidCfg.VerticalActive = 480;
VidCfg.LPCommandEnable = DSI_LP_COMMAND_DISABLE;
VidCfg.LPLargestPacketSize = 0;
VidCfg.LPVACTLargestPacketSize = 0;
VidCfg.LPHorizontalFrontPorchEnable = DSI_LP_HFP_DISABLE;
VidCfg.LPHorizontalBackPorchEnable = DSI_LP_HBP_DISABLE;
VidCfg.LPVerticalActiveEnable = DSI_LP_VACT_DISABLE;
VidCfg.LPVerticalFrontPorchEnable = DSI_LP_VFP_DISABLE;
VidCfg.LPVerticalBackPorchEnable = DSI_LP_VBP_DISABLE;
VidCfg.LPVerticalSyncActiveEnable = DSI_LP_VSYNC_DISABLE;
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();
}
}
I have to split here because i can not send the question "Text too large".
Solved! Go to Solution.
2022-02-24 08:47 AM
Then try change to video mode
VidCfg.Mode = DSI_VID_MODE_BURST;
VidCfg.PacketSize = 480;
VidCfg.NumberOfChunks = 1;
2022-02-24 09:01 AM
Closer and closer....
Some pixel on the left side are clear now....
2022-02-24 09:15 AM
Now try decrement/increment by 1
VidCfg.HorizontalSyncActive = 31;
VidCfg.HorizontalBackPorch = 31;
VidCfg.HorizontalLine = 1015;
and for rotate mirror use datasheet register command...
2022-02-24 10:56 AM
Unbelievable!
You are a hero.
That made it. SyncActive and BackPorch seems to have no effect, i can change with whatever i want.
HorizontalLine 1014 makes it good but a few pixels on one side are still bad.
1013 and half screen is bad. But increase it by 1 to this values the screen is clear.
VidCfg.HorizontalSyncActive = 31;
VidCfg.HorizontalBackPorch = 31;
VidCfg.HorizontalLine = 1016;
Thank you so much.
Send me a message with your paypal please, i want to say thankyou with a beer :)