[NUCLEO_H743ZI] changing CPU frequency does not work as expected
With the latest release 1.9.4 tested but also in 1.9.3 (just to be sure) I use machine.freq() to set the CPU frequency to a low frequency. Setting it to something other than 400MHz (machine.freq(200000000)) the REPL interface via the ST-LINK (real UART, no USB) will not work (garbled, not responsive).
Using REPL via USB will still work. However something like setting the frequency to 10_000_000 (10MHz) of the CPU will give no reply on the UART (expected), but the USB is dead also. After a while RED/BLUE led turn on (Fault) and the USB REPL was just able to say some last words "
can'can'can't change freq". After this only the RED led is on.
This could be considered a feature as the clock for USB is derived from another PLL and the clock for the used UART probably uses the same as for the CPU (need to check) and changes accordingly.
It makes it a bit hard to throttle the CPU speed as other peripherals will also suffer from the change.
ports/stm32: Can't change CPU frequency on NUCLEO_F401RE board
Trying to change the frequency using the latest master causes a FATAL ERROR.
I tested using pyb and machine modules and tried various frequencies like 42 MHz and 64 MHz).
All attempts result in this:
MicroPython v1.10-290-g8402c26cf-dirty on 2019-05-01; NUCLEO-F401RE with STM32F401xE
Type "help()" for more information.
>>> machine.freq(42000000)
FATAL ERROR:
can't change freq
Originally brought up in the forum: https://forum.micropython.org/viewtopic.php?f=12&t=6365&p=36215