Skip to main content
EPala.2
Associate III
September 29, 2023
Solved

CubeMX Generating Startup Functions in Incorrect Order

  • September 29, 2023
  • 2 replies
  • 1295 views

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

 

This topic has been closed for replies.
Best answer by Imen.D

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

2 replies

Issamos
Lead III
September 29, 2023

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.DBest answer
Technical Moderator
September 29, 2023

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"".ThanksImen"