Skip to main content
Jtron.11
Senior
September 30, 2021
Solved

Is there a way to configure the order of the auto generated code?

  • September 30, 2021
  • 3 replies
  • 1446 views

I am using STMCubeIDE version 1.7.0 and I saw the generate code for the initialization

has different orders when I configured my ADC with DMA

Sometime the code was generate with ADC init before the DMA init

 MX_ADC1_Init();

 MX_ADC3_Init();

 MX_DMA_Init();

Sometime the code was generate with DMA init before ADC init

 MX_DMA_Init();

 MX_ADC1_Init();

 MX_ADC3_Init();

Is there a rule for the auto generated code orders?

This topic has been closed for replies.
Best answer by Jtron.11

Thank you TDK. Seem like not me struggling with ADC DMA not working because this not in the right sequence order.

3 replies

TDK
Super User
September 30, 2021

It’s in there somewhere. Possibly in code generation tab somewhere. I can’t check right now.

edit: in advanced settings somewhere.

https://community.st.com/s/question/0D53W00000GZpgtSAD/cubemx-adc-and-dma-initialized-in-the-wrong-order

"If you feel a post has answered your question, please click ""Accept as Solution""."
Jtron.11
Jtron.11AuthorBest answer
Senior
September 30, 2021

Thank you TDK. Seem like not me struggling with ADC DMA not working because this not in the right sequence order.

Technical Moderator
October 1, 2021

Hello @Jtron.1​ ,

I confirm this issue in CubeMX v6.3.0, that the DMA Init function is called after the peripheral initialization.

So, when DMA is used, the MX_DMA_Init() shall be called BEFORE any other peripheral initialization.

Our CubeMx team is working to resolve this issue in the coming releases.

(Internal ticket 112040 : This is an internal tracking number and is not accessible or usable by customers.)

Thanks for your contribution

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks