F7 consumption optimization

Discussion related to "under the hood" OpenMV topics.
User avatar
chrisPyres66
Posts: 90
Joined: Mon Jul 16, 2018 9:22 am
Location: France

F7 consumption optimization

Postby chrisPyres66 » Wed Nov 28, 2018 6:22 am

Hello,

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

Code: Select all

    #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 ?

Thanks,
User avatar
iabdalkader
Posts: 844
Joined: Sun May 24, 2015 3:53 pm

Re: F7 consumption optimization

Postby iabdalkader » Wed Nov 28, 2018 7:16 am

chrisPyres66 wrote:
Wed Nov 28, 2018 6:22 am
Hello,

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

Code: Select all

    #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 ?

Thanks,
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.
User avatar
chrisPyres66
Posts: 90
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: F7 consumption optimization

Postby chrisPyres66 » Wed Nov 28, 2018 11:00 am

Thanks for answer,

Yes i tried the cpufreq module like :

Code: Select all

import cpufreq
#cpufreq.set_frequency(cpufreq.CPUFREQ_120MHZ)
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) ?

Thanks,
Attachments
Pb_Snapshot.PNG
ClockV1.7z
(2.72 KiB) Downloaded 48 times
User avatar
kwagyeman
Posts: 3055
Joined: Sun May 24, 2015 2:10 pm

Re: F7 consumption optimization

Postby kwagyeman » Wed Nov 28, 2018 11:33 am

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.
Nyamekye,
User avatar
chrisPyres66
Posts: 90
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: F7 consumption optimization

Postby chrisPyres66 » Tue Dec 04, 2018 2:53 am

Hi,

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 ?

Thanks,
Attachments
Parameter_CLOCK.PNG
User avatar
kwagyeman
Posts: 3055
Joined: Sun May 24, 2015 2:10 pm

Re: F7 consumption optimization

Postby kwagyeman » Tue Dec 04, 2018 12:45 pm

Ibrahim can answer this.
Nyamekye,
User avatar
iabdalkader
Posts: 844
Joined: Sun May 24, 2015 3:53 pm

Re: F7 consumption optimization

Postby iabdalkader » Tue Dec 04, 2018 2:48 pm

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.

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests