Skip to main content
Jtron.11
Senior
Sep 30, 2021 10:14 PM UTC
Solved

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

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.
Jtron.11
Jtron.11Best answer
Senior
Sep 30, 2021 11:53 PM UTC

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

3 replies

TDK
Sep 30, 2021 11:44 PM UTC

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
Sep 30, 2021 11:53 PM UTC

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

ST Technical Moderator
Oct 1, 2021 8:23 AM UTC

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