cancel
Showing results for 
Search instead for 
Did you mean: 

How to set DIVN2 and DIVP2 of PLL2 in code

KSOdin2
Associate III

I have set the clock for the ADC to 51.2MHz by PLL2P with the DIV set as seen below. Without reprogramming the STM32H7A3 I would like to change DIVN2 to x16 and DIVP2 to /32 to give me 4MHz clock to the ADC, but I can not seem to find where these are set in the code.

I Have checked the auto-generated code within main.c and there are no options for x32 and /5. Are DIVN2 and DIVP2 set outside of main.c, and if so where?

Also is there anything else I need to know/do when changing the clock division via the code?

Thank you for any help

0693W00000NqiT8QAJ.pngCurrent clock configuration that is uploaded to the microcontroller, but DIVN2 and DIVP2 will needed to be changed.

11 REPLIES 11

Thank you Jiangfan.

Just to let you know it is not added to a generated project by default and I had to copy it from the repository. If I regenerate the project with the STM32CubeIDE it does remove these files. I'm not sure if that is what is meant to happen

Thank you for your help and links!

Thank you!