[feature request] being able to change UART(0) speed without recompiling.
Description
As a followup to https://github.com/micropython/micropython/issues/6862
I propose to find a way to change URAT(0) speed globally or momentarily.
Globally: a simple entry in a configuration file would be nice.
Programmatically:
something like:
micropython. repl_stop()
Then:
uart = machine.UART(0,921600)
uart.write("Hello 921600 World!")
micropython. repl_restart()
Code Size
Probably small.
Implementation
I hope the MicroPython maintainers or community will implement this feature
Code of Conduct
Yes, I agree
[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.