cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX Generating Startup Functions in Incorrect Order

EPala.2
Associate III

Hi, I ran into a bug a while back where some ADC reads I had set up weren't working. In the course of debugging I found that the ADCs only worked after I changed the order in which some automatically generated startup functions were called in order to initialize the DMA controller before the ADCs. However, whenever I make changes to my .ioc and generate code it regenerates these startup functions in the wrong order. 

Why is this happening and how do I fix it?

This is the incorrect order they are generated in:

EPala2_0-1696005779814.png

This is the order I have to change it to for the ADCs to work:

EPala2_1-1696005806071.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @EPala.2 ,

Which CubeMx version are you using?

When DMA is used, the MX_DMA_Init shall always be called before any peripheral initialization. This issue is already fixed in CubeMx.

So, make sure to use latest release of CubeMx. Then, please keep me informed about your update.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

2 REPLIES 2
Issamos
Lead II

Hello @EPala.2 

I've tried to reproduce this problem with a few boards but I can't. Can you tell me wish board are you using?

Best regards.

II 

 

Imen.D
ST Employee

Hello @EPala.2 ,

Which CubeMx version are you using?

When DMA is used, the MX_DMA_Init shall always be called before any peripheral initialization. This issue is already fixed in CubeMx.

So, make sure to use latest release of CubeMx. Then, please keep me informed about your update.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen