Page 1 of 4

lm_sensors on Fit-PC2

Posted: Sun Jun 14, 2009 2:27 pm
by pto
I am struggling with one important thing on the Fit-PC2 - lm_sensors. I want to measure and track (e.g. with hobbit) the CPU temperature.

It seems that sensors-detect (on Ubuntu 8.04) detects lm92 due to Maxim chips - and also ds1621 due to "`Dallas Semiconductor DS1621", but lm92 nor the ds1621 is not available as a loadable module on the Compulab Ubuntu 8.04 recovery image. Is this a
glitch or am I missing something?

Re: lm_sensors on Fit-PC2

Posted: Tue Jun 16, 2009 8:46 am
by Denis
The only thermal sensors in fit-PC2 are built-in in CPU thermal sensors, installing lm-sensors is useless.

In general you can monitor CPU temperature via /proc/acpi/thermal_zone/TZ00/temperature, but on fit-PC2 it shows 0. We are working on this.

At the current moment you can measure CPU temperature using attached script, that reads special registers in PCI space. Run it as root.

Script shows reliable temperature above 50 C, under 50 C it shows 50 C by default.

Code: Select all

#!/bin/bash

if [[ $EUID -ne 0 ]]; then
  echo "You must be a root user" 2>&1
  exit 1
fi

PCI_DEV_ADDR=00:0.0
REG_MCR=D0
REG_MDR=D4

B0_INIT=FFFFFFFF
B0_EXIT=00000000


function init_thermal {
        setpci -s $PCI_DEV_ADDR $REG_MDR.l=$B0_INIT
        setpci -s $PCI_DEV_ADDR $REG_MCR.l=E004B000
}
function exit_thermal {
        setpci -s $PCI_DEV_ADDR $REG_MDR.l=$B0_EXIT
        setpci -s $PCI_DEV_ADDR $REG_MCR.l=E004B000
}

# sch_read_reg: $1 - port, $2 - register
function sch_read_reg {

        setpci -s $PCI_DEV_ADDR $REG_MCR.l=D0"$1""$2"00
        for i in `seq 6 9`; do
                R1=`lspci -s $PCI_DEV_ADDR -xxx | grep "d0:" | cut -d " " -f $i`
                R2=$R1" "$R2
        done
        echo $R2
}

function convert_to_celsius {
        R1=0x$1
        let R2=$R1

        C1=$((1680*$R2*$R2/1000000))
        C2=$((82652*$R2/100000))
        C3=$(($C1 - $C2 + 127 ))
        echo $C3
}

# main:
init_thermal

unconverted=`sch_read_reg "04" "B1" | cut -d " " -f 4`
sensor0_celsius=`convert_to_celsius $unconverted`

unconverted=`sch_read_reg "04" "B1" | cut -d " " -f 3`
sensor1_celsius=`convert_to_celsius $unconverted`

surface_celsius=$((($sensor0_celsius + sensor1_celsius)/2 - 7 ))

echo "CPU core: $sensor0_celsius-$sensor1_celsius C, CPU surface: $surface_celsius C."

exit_thermal

Re: lm_sensors on Fit-PC2

Posted: Tue Jun 16, 2009 9:18 am
by Timon_and_Pumba
I recommend adding a check for root capabilities.
If accidentally this script is run as non-root, it gives errors, but shows a temperature of 127 degrees C as well.

Code: Select all

if [[ $EUID -ne 0 ]]; then
  echo "You must be a root user" 2>&1
  exit 1
fi
Yeah, my first post with my just received Fit-PC2!

Re: lm_sensors on Fit-PC2

Posted: Wed Oct 21, 2009 10:47 pm
by lucian
thx that worked.

is here an easy way to include that script to gkrellm ?

Re: lm_sensors on Fit-PC2

Posted: Mon Nov 09, 2009 5:03 am
by gjrussell
Thanks for Denis's script. Its 37 degrees in the shade outside and pretty
hot inside where my fitpc2 is. The script shows 64C and 57C. At what
temperature should I get worried?

Re: lm_sensors on Fit-PC2

Posted: Mon Nov 09, 2009 9:42 am
by irads
You are fine up to 90C CPU, but HDD does not like it over 60C.

Re: lm_sensors on Fit-PC2

Posted: Mon Nov 09, 2009 9:56 am
by gjrussell
Thanks for that ... the specs say operating temperature 0-45C, I'm presuming
this is the ambient room temp?

Also, am I right in presuming the second figure of 55C (Thermal Sensor 1) being
picked up by Denis's script is the HDD?

I've put an old CPU Al heat sink on the top of the fit-pc2, seems to be
working ... lots of fins to dissipate heat.

Many thanks.

Re: lm_sensors on Fit-PC2

Posted: Mon Nov 09, 2009 12:11 pm
by Denis
Also, am I right in presuming the second figure of 55C (Thermal Sensor 1) being
picked up by Denis's script is the HDD?
No, both sensors are built in CPU. You can take average of them as CPU temperature. The sensors are independent and placed in different parts of CPU - which makes a small difference in temperature which they show.

Re: lm_sensors on Fit-PC2

Posted: Mon Nov 09, 2009 11:59 pm
by gjrussell
Okay, then how do I find the HDD temperature?
smartctl --all /dev/sda

Re: lm_sensors on Fit-PC2

Posted: Tue Nov 10, 2009 9:17 am
by Denis

Code: Select all

sudo hddtemp /dev/sda