Skip to main content
Senior
March 16, 2025
Solved

Incorrect DSIHOST / LTDC Initialization sequence by Cube MX...?? Is there a workaround?

  • March 16, 2025
  • 2 replies
  • 596 views

Hi,

in this touchGFX documentation page ( MIPI-DSI Video Mode | TouchGFX Documentation ) under the "DSIHOST / LTDC Initialization sequence" section it says:

"The call to MX_DSIHOST_DSI_Init() must be done before MX_LTDC_Init(). This should be handled by STM32CubeMX. If this is not correct, take care to fix the order in a user code section."

 

But this is the CubeMX generated code where it calls MX_LTDC_Init() before MX_DSIHOST_DSI_Init():

 

 

 /* Initialize all configured peripherals */
 MX_GPIO_Init();
 MX_LTDC_Init();
 MX_RTC_Init();
 MX_OCTOSPI1_Init();
 MX_ADC1_Init();
 MX_TIM1_Init();
 MX_TIM8_Init();
 MX_UART5_Init();
 MX_ICACHE_Init();
 MX_DSIHOST_DSI_Init();
 MX_CRC_Init();
 MX_I2C4_Init();
 /* USER CODE BEGIN 2 */

 /* USER CODE END 2 */

 

 

It looks like MX is generating it incorrectly... And swapping those lines every single time you change something in MX would be an insanely annoying thing to have to do (not to mention all sorts of other potential issues).

Is there a workaround or solution (other than to manually swapping the two functions every time)?

Thank you :)

 

 

Best answer by TDK

In Project Manager -> Advanced settings you can change the order of initialization.

TDK_0-1742163063347.png

 

2 replies

TDK
TDKBest answer
Super User
March 16, 2025

In Project Manager -> Advanced settings you can change the order of initialization.

TDK_0-1742163063347.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
RickoAuthor
Senior
March 16, 2025

Thank you @TDK 

Are there any other Initialisation functions that need to be in a specific order?

If so, how or where can I find which ones?

Thank you

TDK
Super User
March 16, 2025

MX_DMA_Init needs called before other initializers which use DMA. That's the only one I know about.

"If you feel a post has answered your question, please click ""Accept as Solution""."
RickoAuthor
Senior
March 17, 2025

Thank you @TDK