2021-07-29 04:34 PM
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)
Solved! Go to Solution.
2021-07-30 12:09 AM
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:
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
2021-07-30 12:09 AM
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:
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
2021-08-04 10:20 AM
@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?
2021-08-04 12:36 PM
Cube may be more better, but ST guys freeze its ability to basic!
2021-08-11 02:01 PM
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
2022-02-11 05:16 AM
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