cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube code generator bug for STM32G030J6

Ahmad M.Nejad
Associate III

The generated code has wrong order for MX_DMA_Init() that doesn't work:

 MX_GPIO_Init();

 MX_ADC1_Init();

 MX_DMA_Init();

...

Correct code is:

 MX_GPIO_Init();

 MX_DMA_Init();

 MX_ADC1_Init();

...

note: STM32CubeIDE Version: 1.7.0 Build: 10852_20210715_0634 (UTC)

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

STM32CubeMX does not (yet) know where the function calls should best be placed.

You can manually reorder the generated function calls within STM32CubeIDE (embedded STM32CubeMX) as well as in the standalone STM32CubeMX:

  • on the top select tab Project Manager
  • on the left select Advanced Settings
  • select the function call to be moved, e.g. MX_ADC1_Init();
  • click on the tiny, tiny move button above the blue header of the table (top right) to move it to the desired position

If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
Peter BENSCH
ST Employee

STM32CubeMX does not (yet) know where the function calls should best be placed.

You can manually reorder the generated function calls within STM32CubeIDE (embedded STM32CubeMX) as well as in the standalone STM32CubeMX:

  • on the top select tab Project Manager
  • on the left select Advanced Settings
  • select the function call to be moved, e.g. MX_ADC1_Init();
  • click on the tiny, tiny move button above the blue header of the table (top right) to move it to the desired position

If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
haleecaero.1
Associate II

@Peter BENSCH​ if STM32CubeMx doesn't know about that, how is the user supposed to know? Just trial and error until it works, or is there some documentation?

Cube may be more better, but ST guys freeze its ability to basic!

MichaelSweden
Associate III

Thanks for this info. However I notice this by my self, while comparing with my old application for F401. I now tested to create a new project in STM32CubeMX 6.3.0 (with STM32Cube_FW_F4_V1.26.2) for an F401 device and still the order of MX_ADC1_Init() and MX_DMA_Init() is correct. So why is it wrong order in generated code for a G0B1 device?

By the way, I think this is wrong in description of "in case of usage of DMA" in file stm32g0xx_hal_adc.c start at row 115:

         (++) Insert the ADC interruption handler function HAL_ADC_IRQHandler()
              into the function of corresponding DMA interruption vector
              DMAx_Channelx_IRQHandler().

I believe it should be:

         (++) Insert the DMA interruption handler function HAL_DMA_IRQHandler()
              into the function of corresponding DMA interruption vector
              DMAx_Channelx_IRQHandler().

//Michael

This answer is just unacceptable. This issue has made projects frustrating and unprofitable for us. If MXCube doesn't do the right order then it should have a disclaimer to make you aware of this fact.

Kevin