Setting CPU Frequency (CB for Banana Pi image)

24 25819
Post Last Edited by tony_zhang at 2014-5-4 12:45

Post Last Edited by tony_zhang at 2014-5-1 15:37

Banana Pi  CPU frequency can be adjusted in real time, , the following file save as shell file, or placed in / etc / rc.local before the exit 0 can be executed. Specific CPU frequency maximum and minimum values ​​can be set based on usage .
  1. #!/bin/sh
  2.   echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  3.   echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  4.   echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  5.   echo 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
  6.   echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
Copy the Code
After testing, Banana Pi  dual-core A20 can also be overclocked to 1.2GHz.
it is not stable @1.2GHZ on my board.

I have a little heatsink ( see here ) on the A20 and
tested 1.2 Ghz with "stress --cpu 2" for 4 hours, no problems.

I don't like overclocking, like factory clock, more stable, more life.

My board is stable only on 1008 Mhz - all, that higher leads to x-server crash, then hang...
It is necessary to measure real core voltages on 1,2G to make final conclusion and maybe add some voltage in  dvfs_table section. Maybe then I'll get it stable. For now 1008 is enough.

What´s the lowest usable frequency ? it your settings above, min is 60 Mhz...

what are theese settings exactly for?

many thanks! br hk2k2

What´s the lowest usable frequency ? it your settings above, min is 60 Mhz...

what are thee ...
hk2k2 Posted at 2014-7-24 17:46

This explains a few things. I've noticed a few reviews that show how slow the board is in single threaded benchmarks. Eg: slower than the rpi but in multi-threaded tests the bpi somehow becomes over four times faster.
The default governor is "fantasy" with a range of 336-912mhz with lagged scaling. Which is what those two settings are used for (up_threshold and sampling rate).

Back to those reviews with single threaded benchmarks...Now we can see that in single threaded benchmarks with the default governor those boards are never ramping up and so are running on a single thread at ~336mhz. When allowed to use both threads they ramp up to using both cores at 912mhz.

With the settings in the OP a single core will now ramp up because one maxed core will go over the threshold and run at 1ghz and you will get single-threaded benchmark results in line with what you would expect. You'll also now be getting the advertised dual 1ghz instead of 912mhz.

Some more detail here: http://linux-sunxi.org/Cpufreq

Post Last Edited by thatsbanana at 2014-8-7 15:13

Post Last Edited by thatsbanana at 2014-8-7 15:12

Post Last Edited by thatsbanana at 2014-8-7 15:12

This didn't work for me because I got a 'permission denied' every time (logged in as admin).

However I changed the lines and then it did work. Any reason why it didn't work initially?
  1. #!/bin/sh
  2. echo ondemand | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  3. echo 1000000 | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  4. echo 600000 | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  5. echo 25 | sudo tee /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
  6. echo 10 | sudo tee /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
Copy the Code
I did some over clocking from 0.9 to 1.3 GHz with a passive cooler attached!

I've done some testing with overclocking and want to share  the results.

First thing you should add a passive cooler to the Banana anyway, even if you don't overclock because the A20 does get very hot (can't touch with fingers for more than a few seconds) and maybe for that reason the Banana comes with max 912 MHz underclocked in the Lubuntu images.

You could buy coolers from ebay but I had a larger cooler from an older motherboard lying around with square dimensions of 3.5 x 3.5 x 2 cm. It does cover the A20 and both Ram modules. I used thermal paste and two elastic bands for attachment, your mileage may very (and the white box is now my case, see pics).

To see current information about your CPU start the console (LXTerminal) and type:
  1. cpufreq-info
Copy the Code
Under current policy it will tell you governor, min, max and actual CPU frequency, default is 60-912 MHz. With passive cooling you could bring that up to 400-1200 MHz or maybe more.

To test the CPU-speed install and run sysbench in the console:
  1. sudo apt-get install sysbench
  2. sysbench --test=cpu --cpu-max-prime=5000 run --num-threads=2
Copy the Code
It will tell you an overall time (less is better). My results were
0.9 GHz: 61s (default)
1.2 GhZ: 47s
1.3 GHz: 43s
1.4 GHz: crash
So 30% faster from default to 1.2 GHz overclock.

Next, how to download more RAM.

What about temperatures?

I get 35°C in an idle desktop and up to 50°C in 100% CPU use after 1 hour (both with cooler attached).

Can someone give me his CPU temperatures idle and busy?
(in Lubuntu start->system tools->system profiler and benchmark->sensors)

You have to log in before you can reply Login | Sign Up

Points Rules