cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX dynamic data graph and LCD driver on stm32f469i-disco board

Lewis233
Associate II

hello , T。T     

I’m developing a GUI using TouchGFX on the STM32F469I-DISCO board.
In the handleTickEvent() function, I add 5 points to a dynamic data graph each time it is called. However, when doing this, the frequency of handleTickEvent() drops significantly, and the display performance becomes very poor.

In comparison, an older project based on the demo uses MIPI DSI in command mode and configures LTDC as 480×200×4, and it performs noticeably better than my current setup where LTDC is configured as 480×800 and DSI is set to video mode.

Lewis233_0-1754473187613.png

The scan is 480 * 800 .

static void MX_LTDC_Init(void)
{

  /* USER CODE BEGIN LTDC_Init 0 */

  /* USER CODE END LTDC_Init 0 */

  LTDC_LayerCfgTypeDef pLayerCfg = {0};

  /* USER CODE BEGIN LTDC_Init 1 */

  /* USER CODE END LTDC_Init 1 */
  hltdc.Instance = LTDC;
  hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AH;	
  hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AH;	
  hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;	
  hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;	
  hltdc.Init.HorizontalSync = 1;	
  hltdc.Init.VerticalSync = 1;		
  hltdc.Init.AccumulatedHBP = 2;	
  hltdc.Init.AccumulatedVBP = 2;	
  hltdc.Init.AccumulatedActiveW = 202;
  hltdc.Init.AccumulatedActiveH = 482;
  hltdc.Init.TotalWidth = 203;
  hltdc.Init.TotalHeigh = 483;
  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 = 200;
  pLayerCfg.WindowY0 = 0;
  pLayerCfg.WindowY1 = 480;
  pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
  pLayerCfg.Alpha = 255;
  pLayerCfg.Alpha0 = 0;
  pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
  pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
  pLayerCfg.FBStartAdress = 0xC0000000;
  pLayerCfg.ImageWidth = 200;
  pLayerCfg.ImageHeight = 480;
  pLayerCfg.Backcolor.Blue = 0;
  pLayerCfg.Backcolor.Green = 0;
  pLayerCfg.Backcolor.Red = 0;
  if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN LTDC_Init 2 */
  __HAL_LTDC_DISABLE(&hltdc);
  DSI_LPCmdTypeDef LPCmd;

  HAL_DSI_Start(&hdsi);
  NT35510_Init(NT35510_FORMAT_RBG565, LCD_ORIENTATION_LANDSCAPE);
  HAL_DSI_ShortWrite(&hdsi, 0, DSI_DCS_SHORT_PKT_WRITE_P1, NT35510_CMD_DISPOFF, 0x00);

  LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_DISABLE;
  LPCmd.LPGenShortWriteOneP = DSI_LP_GSW1P_DISABLE;
  LPCmd.LPGenShortWriteTwoP = DSI_LP_GSW2P_DISABLE;
  LPCmd.LPGenShortReadNoP = DSI_LP_GSR0P_DISABLE;
  LPCmd.LPGenShortReadOneP = DSI_LP_GSR1P_DISABLE;
  LPCmd.LPGenShortReadTwoP = DSI_LP_GSR2P_DISABLE;
  LPCmd.LPGenLongWrite = DSI_LP_GLW_DISABLE;
  LPCmd.LPDcsShortWriteNoP = DSI_LP_DSW0P_DISABLE;
  LPCmd.LPDcsShortWriteOneP = DSI_LP_DSW1P_DISABLE;
  LPCmd.LPDcsShortReadNoP = DSI_LP_DSR0P_DISABLE;
  LPCmd.LPDcsLongWrite = DSI_LP_DLW_DISABLE;
  HAL_DSI_ConfigCommand(&hdsi, &LPCmd);

  HAL_LTDC_SetPitch(&hltdc, 800, 0);
  __HAL_LTDC_ENABLE(&hltdc);
  /* USER CODE END LTDC_Init 2 */

}


this is the comparison I’ve observed.

1.  How can I improve the performance of my graph display? 

2. Why is the example project configured this way for LTDC? What are the advantages? Why is its configuration different from what's stated in the datasheet?

3. If I use video mode, will this kind of configuration provide any optimization?




16 REPLIES 16

I am a junior application-layer engineer, and I encountered this issue while using dynamic charts. I'm trying to resolve it. The development board is the STM32F469I-DISCO, but the screen is a newer, brighter one that supports DSI-Video. Which part of the code do you need?
1. If I don't add datapoint , tick rate is 40 hz . LTDC-TFT is 25Hz. 
I mute all code , only add point in handletickevent , refresh rate will change to 3~10 hz

Oh, I was not aware you had changed the display.

Do you know what display controller the new display uses? Your code indicates NT35510, is this correct?

If you like, you can zip the entire project, if it is indeed still the same controller it should work as-is here, that would be easier.

I'll upload  the code a little later.

I commented out part of the code; the graph might perform better, but as more points are added, the screen refresh rate will decrease.

I have already uploaded the code. There will be more controls in the complete project, and more points have been added as well.

mathiasmarkussen
ST Employee

I've downloaded your code and had a look, but your display configuration obviously does not work on my boards.
I imported you GUI to our project and commented out some code that did not work outside your project.

Here are some performance measurements from that:

mathiasmarkussen_0-1756283235769.png

This shows that for me, the acutal rendering of each screen takes almost 1 second when adding a data point every other tick. At the same time, the MCU is active during that entire period. 

So basically, the MCU cannot handle the graph.

As I state earlier, the graph widget is surprisingly heavy to render, because all the points need to be connected. When using the scrolling graph mode, this is even worse, because all the points need to be updated every time a new point is added.

When using dots instead of lines in the "Elements" section of the graph, perfomance increases significantly, but the graph is pretty much ureadable with 300 points in the graph, and performance is still far from 60 fps:

mathiasmarkussen_1-1756285507678.png

Going back to lines, and using the "wrap and overwrite" mode of the graph and using a vertical frontline with a width of 4 pixels to make it easier to determine where new data is input, it gets pretty close to the 16 ms you need for 60 fps:

mathiasmarkussen_2-1756286668233.png

In this mode, there is practically no gain to be had from changing to points or altering the number of elements.

So the conclusion must be that if you are going for 60 fps and the graph is necessary, the F469 is not powerful enough for your application.

 

Other than that, your LTDC is not set up according to your table, which may be the reason you only see 40 fps when not adding points to the graph. What you want is this:

mathiasmarkussen_3-1756287024119.png

And an LTDC clock of 26.37 MHz. If you cannot get that clock, you can lower the porches as long as they are above the minimum values specified in your table until the timing is right.

You can get the performance outputs I showed on the screen by assigning a few output pins with specific labels:

Performance Measurement | TouchGFX Documentation

 

THX  mathiasmarkussen,

    1. I've uploaded the data manual of the screen. If in dsi-video mode , the results you obtained using the NT35510 are the same as mine.
    2. second requires adding 50 - 100 points to the graph. I need to ensure 25 fps (In the DSI - command mode, the 25 fps screen is relatively smooth. However, in the DSI - video mode, the 25 fps screen still flickers. I think the actual screen fps should be higher to ensure no flickering), which means adding at most 2 - 4 points each time.
    3. I did another test and upload video. Do nothing after initializing the graph
Lewis233_1-1756291535164.pngLewis233_2-1756291639863.png

 

    4. I'll think it over carefully according to your reply. Can I get your demo? 
    5. What about the graphics display performance of  STM32U5  (GPU2D + DMA2D) or the STM32F7 (DMA2D) development boards if using the DSI - video mod driver for a 480*800 - resolution screen?