TarjeiB
Posts: 157
Joined: Thu Jul 12, 2012 3:33 pm

Re: Overclocking

Fri Sep 07, 2012 3:53 pm

dom wrote:No, I don't think SDRAM overclock has changed. How does boot fail - does it do a reboot loop? Stuck at coloured square? Hangs during linux messages?
Does boot_delay=1 affect it?
Hey, what do you know - boot_delay=1 did fix it! It hung at the colour screen.
Did the firmware get "faster" resulting in a boot delay needed for my SD card?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Fri Sep 07, 2012 4:27 pm

TarjeiB wrote:
dom wrote:No, I don't think SDRAM overclock has changed. How does boot fail - does it do a reboot loop? Stuck at coloured square? Hangs during linux messages?
Does boot_delay=1 affect it?
Hey, what do you know - boot_delay=1 did fix it! It hung at the colour screen.
Did the firmware get "faster" resulting in a boot delay needed for my SD card?
This boot hanging seems to come and go. Seems more likely when overclocked. One possibility is the current surge when powering everything up (esp. overclocked) causes a problem.
But I'm just guessing really.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Sat Sep 08, 2012 1:57 pm

I've added a sanity checking gencmd in latest firmware:
/opt/vc/bin/vcgencmd measure_clock <clock>
clock can be one of arm, core, h264, isp, v3d, uart, pwm, emmc, pixel, vec, hdmi, dpi.
E.g.

Code: Select all

pi@raspberrypi ~ $ /opt/vc/bin/vcgencmd measure_clock arm
frequency(45)=1000000000
pi@raspberrypi ~ $ /opt/vc/bin/vcgencmd measure_clock core
frequency(1)=250000000

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: Overclocking

Sun Sep 09, 2012 10:09 pm

dom wrote:I've added a sanity checking gencmd in latest firmware:
/opt/vc/bin/vcgencmd measure_clock <clock>
clock can be one of arm, core, h264, isp, v3d, uart, pwm, emmc, pixel, vec, hdmi, dpi.
I think this needs some <clock> keyword checking as at the moment using wrong ones yields this:

Code: Select all

pi@raspberrypi:/opt/vc/bin/ > ./vcgencmd measure_clock pandaboard
frequency(0)=900000000
:roll:
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

lapoltba
Posts: 50
Joined: Wed Aug 29, 2012 11:06 am

Re: Overclocking

Sun Sep 09, 2012 10:12 pm

now you're just TRYING to break it.... :D

Thank you Dom, this is very helpful.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Mon Sep 10, 2012 12:43 am

The latest kernel has a cpufreq kernel driver that is enabled by default. It has no effect if you have no overclock settings.
But when you do, the arm frequency will vary with processor load. The "ondemand" governor is the default but it can be changed.

This is quite a good description of what a cpufreq driver does:
http://www.pantz.org/software/cpufreq/u ... linux.html

If you do have e.g:

Code: Select all

arm_freq=1000
over_voltage=6
core_freq=400
gpu_freq=300
sdram_freq=500
when cpufreq pushes the arm freq above stock (700), the other "turbo" settings will kick in.
When the arm returns to idle, the "turbo" settings will be disabled.
This should mean less heat and less risk of reducing the chip's life, with most of the performance benefits of the overclock.

If you don't like the new behaviour, you can disable it with:

Code: Select all

force_turbo=1
You can also reduce the stock settings with:

Code: Select all

arm_freq_min
gpu_freq_min
core_freq_min
sdram_freq_min
over_voltage_min
if you would like to underclock.

Latest firmware also has:

Code: Select all

/opt/vc/bin/vcgencmd measure_temp
temp=48.7'C
We believe up to 85'C should be okay.

Please have a play, and report back how it works.

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: Overclocking

Mon Sep 10, 2012 6:38 am

dom wrote:If you don't like the new behaviour, you can disable it with:

Code: Select all

force_turbo=1
shouldn't his be 0 or renamed accordingly to, say, notforce_turbo=1. it's not that descriptive right now :geek:
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

ohrensessel
Posts: 1
Joined: Mon Sep 10, 2012 8:33 am

Re: Overclocking

Mon Sep 10, 2012 8:37 am

Hi,

is there a possibility to stop the cpufreq driver from generating messages when a frequency change occurs?

To monitor the temperature of my pi I wrote a small script that converts the output of vcgencmd measure_temp to the format of lm_sensors, so that it can be used by the munin sensors_ plugin.

Code: Select all

#!/bin/bash
temp=`/opt/vc/bin/vcgencmd measure_temp | cut -d"=" -f 2 | cut -d"'" -f 1`
echo -e "CPU Temp:    "$temp" C  (high = +75.0 C, hyst = +65.0 C)  sensor = thermistor"
don't blame me if this can be done better. just wanted a quick and dirty method :)

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Mon Sep 10, 2012 8:52 am

Licaon_Kter wrote:
dom wrote:If you don't like the new behaviour, you can disable it with:

Code: Select all

force_turbo=1
shouldn't his be 0 or renamed accordingly to, say, notforce_turbo=1. it's not that descriptive right now :geek:
I mean disable the change in behaviour - i.e. make it behave like it used to do.
force_turbo=1 means turbo mode is forced on, rather than automatically enabled by cpufreq driver.

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: Overclocking

Mon Sep 10, 2012 9:45 am

dom wrote: Latest firmware also has:

Code: Select all

/opt/vc/bin/vcgencmd measure_temp
temp=48.7'C
We believe up to 85'C should be okay.

Please have a play, and report back how it works.
I upgraded the firmware from version 335712 to version 335792, and it now indeed recognizes that command:

Code: Select all

pi@raspbian-armhf-SJ ~ $ /opt/vc/bin/vcgencmd measure_temp
temp=41.2'C
pi@raspbian-armhf-SJ ~ $
That's cool! ;)

BTW: How can I find all the commands supported by vcgencmd? There is no man-page, no "... --help" or "... -?", and "strings /opt/vc/bin/vcgencmd" does not reveal any known commands.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Mon Sep 10, 2012 10:01 am

Sander wrote:BTW: How can I find all the commands supported by vcgencmd? There is no man-page, no "... --help" or "... -?", and "strings /opt/vc/bin/vcgencmd" does not reveal any known commands.

Code: Select all

/opt/vc/bin/vcgencmd commands
Generally all the commands should be considered debugging commands. They shouldn't normally be needed by applications. If commands prove useful there is probably a better way of implementing them.
For example, w're hoping to produce a hwmon kernel driver that reports the temperature in a more standard way.

User avatar
hojnikb
Posts: 128
Joined: Mon Jun 04, 2012 3:59 pm
Location: @Home

Re: Overclocking

Mon Sep 10, 2012 11:55 am

Now that we have cpufreq driver, could the pi be overclocked on-the-fly ?

Also is there a command, that show current voltage ?
I've looked around but i've only found pm_get_status, which shows only stock voltage ...
+°´°+,¸¸,+°´°~ Everyone should have a taste of UK Raspberry Pie =D ~°´°+,¸¸,+°´°+
Rasberry Pi, SoC @ 1225Mhz :o, 256MB Ram @ 550Mhz, 16GB SD-Card, Raspbian

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Mon Sep 10, 2012 12:05 pm

hojnikb wrote:Now that we have cpufreq driver, could the pi be overclocked on-the-fly ?
Well, yes, this is exactly what this does.
hojnikb wrote:Also is there a command, that show current voltage ?
No, I could add it, but it will be:

Code: Select all

/opt/vc/bin/vcgencmd measure_clock arm
over_voltage_min when <=700MHz and over_voltage when >700MHz (which are 0 or 1.2V when not defined).

wpns
Posts: 128
Joined: Sat Sep 01, 2012 2:50 pm

Re: Overclocking

Mon Sep 10, 2012 12:34 pm

[quote="Sander"]
I upgraded the firmware from version 335712 to version 335792, and it now indeed recognizes that command:

[code]pi@raspbian-armhf-SJ ~ $ /opt/vc/bin/vcgencmd measure_temp
temp=41.2'C
pi@raspbian-armhf-SJ ~ $[/code]

This doesn't seem to be working for me, I've done the:
sudo apt-get update
sudo apt-get upgrade
sudo reboot
cycle, and even power-cycled it, but I'm still at firmware version 333347 (release)

Do I need to add the untested repo in order to get the measure_temp command?

Thanks!

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: Overclocking

Mon Sep 10, 2012 12:36 pm

yeah, either untested repo or use rpi-update
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: Overclocking

Mon Sep 10, 2012 12:42 pm

wpns wrote: Do I need to add the untested repo in order to get the measure_temp command?

Thanks!
I used "sudo rpi-update" to update to the newest firmware (and kernel).

First install rpi-update; see https://github.com/Hexxeh/rpi-update how to ...

Joshyu
Posts: 5
Joined: Fri May 25, 2012 9:03 am

Re: Overclocking

Mon Sep 10, 2012 2:39 pm

Latest firmware also has:

Code: Select all

/opt/vc/bin/vcgencmd measure_temp
temp=48.7'C
We believe up to 85'C should be okay.
Does anybody know how to use this line in a python script?
I would like to insert the temperature reading into a variable so I can display it on my 16x2 LCD display.

So far I've tried it with:

Code: Select all

import os
variable = os.system("/opt/vc/bin/vcgencmd measure_temp")
 
and with several lines of subprocesses from the many hits I got on google, but with the os.system it just won't save it to a variable and the subprocess keeps spewing out errors.

Any help would be appreciated.

User avatar
Mortimer
Posts: 938
Joined: Sun Jun 10, 2012 3:57 pm

Re: Overclocking

Mon Sep 10, 2012 2:51 pm

Try:

Code: Select all

proc=subprocess.Popen('/opt/vc/bin/vcgencmd measure_temp', shell=True, stdout=subprocess.PIPE,)
inputFile = proc.communicate()[0]
inputFile will contain the piped STDOUT output of the shell command.

You would then need to write your code to extract the temperature value from the first (and hopefully only) line of inputFile.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: Overclocking

Mon Sep 10, 2012 2:54 pm

Split on '=' and take the right part. Then split on "\'" and take the left part:

Code: Select all

import os
#variable = os.system("/opt/vc/bin/vcgencmd measure_temp")
#variable = os.system('echo temp=48.7C')

variable = 'temp=48.7\'C'
print variable
print variable.split('=')[1].split("'")[0]
Output is

Code: Select all

sander@R540:~$ python blap.py 
temp=48.7'C
48.7
sander@R540:~$ 
Sorry, no Raspi at hand ... some os.popen(cmd).readline().strip() is probably needed

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.

Re: Overclocking

Mon Sep 10, 2012 4:11 pm

Can you use these settings in combination with the overclock settings. Say to run arm_freq at 900 but have it drop back to an under clock?
arm_freq_min
gpu_freq_min
core_freq_min
sdram_freq_min
over_voltage_min

Example:
arm_freq=900
arm_freq_min=600

Basically setting the range for operation between?
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Mon Sep 10, 2012 4:20 pm

Lob0426 wrote:Can you use these settings in combination with the overclock settings. Say to run arm_freq at 900 but have it drop back to an under clock?
arm_freq_min
gpu_freq_min
core_freq_min
sdram_freq_min
over_voltage_min

Example:
arm_freq=900
arm_freq_min=600

Basically setting the range for operation between?
Yes, the *_min settings are used when arm is idle. The non-min setting are used when arm is busy.
So you can overclock+overvoltage when busy, and underclock+undervoltage when idle.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.

Re: Overclocking

Mon Sep 10, 2012 4:44 pm

Thank you @dom.
I will update my RasPi server and set it to underclock when not being used. It can then regulate itself when it needs too. Right now it is running at 850. It is not using much power considering it runs just fine, headless, off of a 500ma wall wart :lol:
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: Overclocking

Mon Sep 10, 2012 5:12 pm

Joshyu wrote: Does anybody know how to use this line in a python script?
Tested code:

Code: Select all

import os

cmd = '/opt/vc/bin/vcgencmd measure_temp'
line = os.popen(cmd).readline().strip()

if "error" in line:
	print "Error ... is your firmware uptodate? Run rpi-update"
else:
	# line now contains something like: temp=41.2'C
	# to get the temperature, split on =, and then on '

	temp = line.split('=')[1].split("'")[0]
	print temp

Result:

Code: Select all

pi@raspberrypi ~ $ python tempie.py 
41.2
pi@raspberrypi ~ $ 
Does this help?

User avatar
hojnikb
Posts: 128
Joined: Mon Jun 04, 2012 3:59 pm
Location: @Home

Re: Overclocking

Mon Sep 10, 2012 8:00 pm

So if im gettings this right, raspberry Pi with this driver gets downclocked to stock (thats 700mhz) and overclocked to user defined freq (eg. 900mhz)
But what about the voltage ? Does it drops to stock when stock freq. is in place or is SoC getting always the same user defined voltage ?
+°´°+,¸¸,+°´°~ Everyone should have a taste of UK Raspberry Pie =D ~°´°+,¸¸,+°´°+
Rasberry Pi, SoC @ 1225Mhz :o, 256MB Ram @ 550Mhz, 16GB SD-Card, Raspbian

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Overclocking

Mon Sep 10, 2012 8:04 pm

hojnikb wrote:So if im gettings this right, raspberry Pi with this driver gets downclocked to stock (thats 700mhz) and overclocked to user defined freq (eg. 900mhz)
But what about the voltage ? Does it drops to stock when stock freq. is in place or is SoC getting always the same user defined voltage ?
Yes, when arm is idle, the voltages and frequencies are set to minimum.
minimum is by default stock (i.e. 700MHz arm, 250MHz core, 400MHz sdram, 1.2V), but that can be reduced though arm_freq_min etc.

Return to “Advanced users”