Closed giuliomoro closed 3 years ago
Hi @giuliomoro,
Thank you for this report. The point you reported is actually related to the CubeMX generation problem and not to the firmware published in this repository. Unfortunately, we don't treat aspect related to CubeMX tool in our GitHub repositories. They are rather treated at the STM32CubeMX dedicated page of the ST Community .
Since this issue is not directly related to the STM32Cube firmware but rather to our ecosystem, please allow me then to close this thread. Thank you for your comprehension.
With regards,
ST Internal Reference: 111780
Caution The Issues are strictly limited for the reporting of problem encountered with the software provided in this project. For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the ST Community/STM32 MCUs forum.
Describe the set-up
The board (either ST RPN reference or your custom board). STM32G491KEU6 on a custom board.
IDE or at least the compiler and its version. STM32Cube v1.7.0
Describe the bug CubeMx sometimes generates the function calls to
MX_DAC1_Init()
,MX_DMA_Init()
in an order such that the DMA doesn't work. I experimentally found thatMX_DAC1_Init()
followed byMX_DMA_Init()
doesn't work, whereas when they are called the other way around, it works.How To Reproduce
I use CubeMx to set DAC1_CH1 triggered by TIM6 and serviced by DMA1 channel 1.
The CubeMx code generator.
Servicing the DAC via DMA.
This archive STM32G4Cube-bug-report.zip contains two
.ioc
files and the twomain.c
files they generate. Both.ioc
files set DAC1_CH1 triggered by TIM6 and serviced by DMA1 channel 1. However, they generate different code. The salient difference between the two.ioc
files is the order at these lines:As a result, they generate the following
main()
functions (from the respectivemain.c
files:main-Working.c:
main-NotWorking.c:
(note the how
MX_DMA_Init()
andMX_DAC1_Init()
are swapped in the two cases). Now, with the minimal example code that follows (borrowed from here):the Working example generates a tone, while the NotWorking example doesn't
Additional context
I am not 100% the execution order of the two
_Init()
functions is supposed to matter. If it is supposed to matter, document it and fix the code generator. If it is not supposed to matter, fix the_Init()
functions.