Unexpected result trying to set CPU frequency

This is to report an unexpected result when trying to use cpufreq.set_frequency() on two different H7 boards.I want to set the CPU frequency as low as possible to reduce power consumption. I tried this:

cpufreq.set_frequency(50)

which worked fine on some boards. But when I got a new batch this instruction throws an error (unsupported frequency or similar). Looks like the new boards support 60MHz but not 50MHz. The documentation for cpufreq.get_supported_frequencies() says this:

“Returns the supported CPU frequencies… [60/50, 120/100, 240/200, 480/400] on the OpenMV Cam H7 Rev V/XY silicon in MHz.”

If I look at the chips I see the older chip has “Y” and the new chips say “V”. I ended up doing dealing with the issue like this:

    print("Setting CPU frequency to the lowest of these:")
    supported_frequencies = cpufreq.get_supported_frequencies()
    for freq in supported_frequencies:
        print(str(freq) + "MHz")

    # Set the lowest supported value
    cpufreq.set_frequency(supported_frequencies[0])

New chips give this output:
60MHz
120MHz
240MHz
480MHz

old chips say this:
50MHz
100MHz
200MHz
400MHz

It might be useful to expand the documentation in this area…

In both cases I am using the “latest” firmware (“MicroPython: v1.13-r22 OpenMV: v3.8.0 HAL: v1.9.0 BOARD: OPENMV4-STM32H743”)

@Kwabena we shouldn’t mention specific frequencies in the docs as it depends on the chip and board.

I’ll update the docs on that. To be clear. We were just running all chips at 480 MHz but a few couldn’t do this and crashed so we had to change the frequency.