How to change CPU clock?


I’m using PYNQ(3.0.0) on a custom ZYNQ7035 board. I set PSclock to 666.66MHz in the bitstream , but when I read CPU clock by Clocks class, it returns 1GHz.

And all fclk settings can not work correctly, for example, I set 18MHz to fclk1, but get 12MHz instead.

Is there any method to change the CPU clock?


Good question, for base ARM core set in ZYNQ Vivado block design.
For device tree align with the ARM core setting accordingly.


Thanks for your kind reply, I’ll try it, and one more further question:

I set 1Ghz in device tree, and actually give 666.66MHz to PS, I set fclk to 18MHz, it returns 12MHz (near 2/3), but when I change 666.66 to 800MHz, and set fclk to 18MHz, it still retuns 12MHz.

could you please explain why this happens?


Do a simply block modification and see what is the different.
This should be trivial and only the bin need to be regenerate.


There are multiple clocks used inside a Zynq devices and a lot of flexibility for how you can set these.
Fundamentally there is an external clock that other clocks are derived from in some way. The speed of this external clock will determine some of the internal frequencies you can select (that can be generated).

For example, when you request 18MHz by setting fclk, it may not be possible to generate this frequency. In this case, PYNQ will set the clock to the nearest frequency, 12MHz in your case.

If you are not sure what settings are valid, if you check the block diagram in Vivado and try changing some of the values for clocks you should start to see differences between the request clock and the actual clock.

For example; some made up numbers: notice the difference between Requested, and Actual.

Also note the “Input Frequency” at the top - this is the external input.