2022-06-10 07:48 AM
I chose STM32H753IIT6 MCU for my project.
I had set the clock prescaler of ADC to "Asynchronous clock mode divided by 1", and the ADC clock source is PLL2P, 36MHz.
The code was generated successfully. However, I found that the sampling rate is half of the theoretical value.
I migrate the same code to one STM32H743 developing board, all settings are the same with the STM32H753 project. Everything works properly.
Then I set the frequency of PLL2P to 72MHz, CubeMX set the prscaler to "Asynchronous clock mode divided by 2" automatically. I changed it back to "ADC_CLOCK_ASYNC_DIV1" manually in my code. ADC still works fine and the sampling rate is correct then.
Is this a bug?
My CubeMX version: 6.4
HAL version: 1.9.1
Solved! Go to Solution.
2022-06-10 09:22 AM
Probably. the MX program seems to have a lot of bugs of that type. They are working on it. I ran into it twice this week.
My recommendation is when you run into this, fix it where they give you a chance to add your own code at the end of the ADC initialization in main and make a comment that it is a fix for the MX program bug, so you will remember it in 6 months when they fix the MX program.
2022-06-10 09:22 AM
Probably. the MX program seems to have a lot of bugs of that type. They are working on it. I ran into it twice this week.
My recommendation is when you run into this, fix it where they give you a chance to add your own code at the end of the ADC initialization in main and make a comment that it is a fix for the MX program bug, so you will remember it in 6 months when they fix the MX program.
2022-06-10 09:56 AM
Thanks for your recommendation.
2022-06-16 06:52 AM
Hi @HCui ,
This looks like a know issue reported in STM32H755ZI-Q CubeMX Does not generate ADC clocks.
This is recognized for STM32CubeMX 6.5, but here you said that you are using STM32CubeMX 6.4.
-Amel
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.
2022-06-16 07:23 AM
Thanks for your reply.
Yes, the confugration was done in CubeMX 6.4. The ADC does not work in CubeMX 6.5, so I downgraded to 6.4.
In my case, The ADC clock was generated but the frequency is the half of it shoud be.
I did an experiment to verify my suspicions. I configued the ADC source clock to 72MHz in CubeMX, which is the twice of the max frequency, but modifed the clock prescaler to "DIV1" in my code. But the ADC still wroks properly and I got the sampling rate I wanted.
2024-04-09 11:05 AM
So is this still broken in 6.10?
I can set the Clock Prescaler to several values in Cube_MX, but no code ends up on the MX_ADC_Init to set the prescaler. I can see that the typedef struct ADC_InitTypeDef for hadc[x] contains uint32_t ClockPrescaler; as well as other values which are being set. Are we supposed to add the prescaler selection manually in the user code area?