User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

RPi GPU CPU Temperature Readings via Firmware

Thu May 12, 2016 9:10 am

I am using this code snippet from an on-line resource to get the GPU CPU temps from the RPi... works on all of my PIs and I am curious how it does this, since there does not appear to be a temperature sensor in the SoC. Somehow the firmware is determining the temps; and I am wondering how it does that... also, whether those temps are accurate (from unit to unit). Perhaps all of the disparity in the reported information from user to user has to do with the measurements (not reality).

This is the RPi_temps.sh script I am using; probably not much different from the codes you'll are using:

Code: Select all

#!/bin/bash
# Script: RPi_temps.sh
# Purpose: Display the ARM CPU and GPU  temperature of Raspberry Pi 2/3 
# Author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+
# -------------------------------------------------------
clear
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"
marcus
:ugeek:

mikerr
Posts: 2827
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: RPi GPU CPU Temperature Readings via Firmware

Thu May 12, 2016 9:21 am

MarkHaysHarris777 wrote: I am curious how it does this, since there does not appear to be a temperature sensor in the SoC.
Whatever made you think that ?
vcgencmd is querying the SoC (vcgencmd =VideoCore GENeral CoMmanD)
Last edited by mikerr on Thu May 12, 2016 9:31 am, edited 1 time in total.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: RPi GPU CPU Temperature Readings via Firmware

Thu May 12, 2016 9:31 am

mikerr wrote:
MarkHaysHarris777 wrote: I am curious how it does this, since there does not appear to be a temperature sensor in the SoC.
Whatever made you think that ?
The article where I got the code snippet speculated (perhaps it was the comments) that the SoC has no temp sensor explicitly (although every single transistor ever made is a temperature sensor) so, I am asking whether that speculation is true, and if not, what the specs are on the temperature sensor and how accurate (they) are... apparently there would need to be at least two of them? Or, is the firmware using another method of approximating the temps? Is there a BCM2837 datasheet that I can download in pdf that describes the SoC in detail?

thanks
marcus
:ugeek:

davido_
Posts: 1
Joined: Sat Jun 11, 2016 5:52 pm

Re: RPi GPU CPU Temperature Readings via Firmware

Sat Jun 11, 2016 5:54 pm

The CPU has its own built-in temperature sensor. Most general-purpose CPU's do, so that the firmware or operating system is able to handle power management, in part, based on staying within the allowed thermal envelope for the CPU.

Information to the contrary is inaccurate, or incomplete. It is true that the stock Raspberry PI does not have an external temperature sensor, but it most certainly does have one for regulating CPU speed.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: RPi GPU CPU Temperature Readings via Firmware

Sat Jun 11, 2016 7:37 pm

davido_ wrote:The CPU has its own built-in temperature sensor. Most general-purpose CPU's do, so that the firmware or operating system is able to handle power management, in part, based on staying within the allowed thermal envelope for the CPU.

Information to the contrary is inaccurate, or incomplete. It is true that the stock Raspberry PI does not have an external temperature sensor, but it most certainly does have one for regulating CPU speed.
Thank you, for the clarification... !

:)
marcus
:ugeek:

Return to “Troubleshooting”