2

I want to reduce the frequency of operation of my raspberry pi without rebooting. Is there a way to do it ??

I know I can change the frequency by changing the config.txt but it requires a reboot.

  • 1
    Why would you want to do this? – Steve Robillard Mar 16 '15 at 23:40
  • I am trying to do dynamic frequency scaling on my own , based on workload – maverick Mar 18 '15 at 0:03
7

cpufreq can do this for you.

On Raspbian: sudo apt-get install cpufrequtils

On Arch: sudo pacman -S cpufrequtils

You can then use cpufreq-info to see your settings and cpufreq-set to change them.

On my Pi B using Arch, without tweaking any config.txt clock settings at all, here are the defaults I see available:

> cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 355 us.
  hardware limits: 700 MHz - 800 MHz
  available cpufreq governors: conservative, userspace, powersave, ondemand, performance
  current policy: frequency should be within 700 MHz and 800 MHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 700 MHz.

On my Pi2 (also Arch):

> cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 900 MHz
  available frequency steps: 600 MHz, 900 MHz
  available cpufreq governors: conservative, userspace, powersave, ondemand, performance
  current policy: frequency should be within 600 MHz and 900 MHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 600 MHz.
analyzing CPU 1:
# same info repeated for other 3 cores

Example changing governor policy to force higher/lower frequencies:

> sudo cpufreq-set -g powersave
> cpufreq-info| grep "current CPU" | head -1
  current CPU frequency is 600 MHz.
> sudo cpufreq-set -g performance
> cpufreq-info| grep "current CPU" | head -1
  current CPU frequency is 900 MHz.

I set and leave mine to "ondemand".

By editing your config.txt, you should be able to set a lower minimum frequency, though that would require a reboot to take effect the first time. From then out you could use the cpufreq utils to adjust up or down (or ondemand) as you like.

  • A well-written summary. I would think this post would be of particular interest to owners of RPi 3B+ units who live in warm climates :) – Seamus May 4 '18 at 1:09
  • See the RPi overclocking docs for the entries you need to add to /boot/config.txt – Bim Mar 3 at 22:13
2

Try this (no need for cpufrequtils):

echo 700000 | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

Depends a little which Raspberry Pi you are using, but most can only step between min (600000) and max.

RPI Zero: 700000 - 1000000
RPI:      700000
RPI2:     600000 -  900000
RPI3:     600000 - 1200000
RPI3+:    600000 - 1400000
RPI4:     600000 - 1500000

What I've seen setting anything in between will limit to the minimum.

You can check min and max:

HW DEFAULT
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq

USER SET
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

This is preventing your Pi from running to hot. Of course it's slower.

0

Underclocking doesn't really help because most of the power is drawn by the LAN chip, unless, you want to slow down your pi on purpose.

I don't think it's currently possible. I think the minimum and maximum frequencies are set on boot by the GPU during the early boot stage (where start.elf reads the config.txt)

So, we just have to stick to the current situation and reboot.

Do refer here.

  • Downvote due to incorrect answer – Seamus May 4 '18 at 1:11
  • 1
    @Seamus I agree, this is incorrect. – Gene Dela Rosa Jul 8 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.