F7 consumption optimization


I try to optimize the consumption, and i would like to start the camera at 120Mhz.

Before compiling, i changed in /openmv/src/cmsis/src/st/system_stm32fxxx.c

    #elif defined (STM32F765xx) // 120MHz/48Mhz in place of 216MHz/48MHz : 
    flash_latency = FLASH_LATENCY_3;    // FLASH_LATENCY_7;
    RCC_OscInitStruct.PLL.PLLM = 12;
    RCC_OscInitStruct.PLL.PLLN = 240; 	// 432;
    RCC_OscInitStruct.PLL.PLLQ = 5; 		// 9;
    RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
    RCC_OscInitStruct.PLL.PLLR = 2;

but when i snapshot, the pixels are mixed in the images.
Do i forget something ?


Hi, please use CubeMX to check your PLL settings (note the external clock is 12MHz). Also there’s a cpufreq module that can scale the frequency from Python, but it’s not tested thoroughly.

Thanks for answer,

Yes i tried the cpufreq module like :

import cpufreq

and i seemed to work.

I used the cubemx with the value from py_cpufreq.c like in the previous post.
I joined :

  • the cubemx file where there is only a difference for I2C1 (30Mhz in place of 54Mhz) : is it important ?
    the image i get (the top third is ok)

Did i forget something in the plls (USB, DCMI, TIM1, SD) ?

ClockV1.7z (2.72 KB)

Hi, the cpufreq module should not be used. That only worked on the M4. I think I removed in from the docs but it’s still in the code base.


Yes cpufreq module is in the source code, and it still seems worked…

As adviced, I used cubeMX for clock and i could define OMV_XCLK_FREQUENCY to define the good acquisition period for the sensor.
Unfortunately, i am still a bit lost between all the clock and voltage parameters to optimize the consumption.

I dont know when the micropython parameters acts.
I join a image with the different parameters i found and if someone can explain me how it works ?


Ibrahim can answer this.

MicroPython’s PLL settings are not used and system_stm32.c is not used either. We use our own system file and PLL dividers, you can find out which files are used from the Makefile(s). Note you need to make sure the sensor frequency is 9MHz (or change the sensor’s PLL settings to match XCLK). I tried cpufreq.CPUFREQ_168MHZ it seems to work. It’s really hard to find settings that works with everything (sensor, uart, USB etc…) I’d use CubeMX to verify all the frequencies.