Jump to content

difference between methods of temperature measurement


kxmx

Recommended Posts

Hello, what is the difference between 

/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input

this return 37800

 

and

/sys/devices/platform/a20-tp-hwmon/temp1_input

this return 46500

 

what value is correct?

 

there are writing

http://bananapi.com/index.php/forum/beginners/141-how-to-read-cpu-temperature

 

You can find the CPU temperature data at
"/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input"
 
but bash.bashrc.custum use value from
/sys/devices/platform/a20-tp-hwmon/temp1_input
 
thanks
hw: Banana Pi BPi-M1+
 
Link to comment
Share on other sites

I²C device 0x34 is an AXP209 PMU: https://linux-sunxi.org/AXP209

/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input is not CPU Temperature, but PMU temperature: http://www.cubieforums.com/index.php/topic,2293.msg14566.html#msg14566

a20-tp-hwmon, however, is a kernel module that gets temperature of the CPU itself.

As far as I read linked topic, this should be correct for current kernel.

Link to comment
Share on other sites

As far as I read linked topic, this should be correct for current kernel.

 

You should be aware that while there is a thermal sensor inside the A20 SoC it's known to be not that accurate. In mainline kernel which exposes the A20's thermal sensor also using sysfs at a 'standard location' things went somewhat wrong: https://groups.google.com/d/msg/linux-sunxi/duvqtZbfqoI/15K45TKj7iwJ

 

Simple conclusion: You should better not trust in the values kernel modules try to extract from the thermal sensor inside the A20's touchpad controller. Better rely on the PMU's temperature. This is more important since it scales also linearly with load but will also increase/decrease based on the amount of power the 'whole system' needs (bus powered USB peripherals for example will use extra power which increase the PMU's temperature)

Link to comment
Share on other sites

Thanks for the note. BTW, by "current" kernel here I was referencing current legacy 3.4.10x.

Small correcton: using PMU temperature sensor should be better unless you are using battery (not the case for Banana Pi, it doesn't have battery connector as far as I see).

 

Edit: comments from sun4i-ts.c in mainline:

/*
 * The A10 temperature sensor has quite a wide spread, these
 * parameters are based on the averaging of the calibration
 * results of 4 completely different boards, with a spread of
 * temp_step from 0.096 - 0.170 and temp_offset from 176 - 331.
 */

Edit 2: this is very strange

in sun4i-a10.dtsi:

rtp:
...
compatible = "allwinner,sun4i-a10-ts";

in sun7i-a20.dtsi:

rtp:
...
compatible = "allwinner,sun5i-a13-ts";

which leads to using another constants, with even better comment:

/*
 * The user manuals do not contain the formula for calculating
 * the temperature. The formula used here is from the AXP209,
 * which is designed by X-Powers, an affiliate of Allwinner:
 *
 *     temperature (C) = (value * 0.1) - 144.7
 *
 * Allwinner does not have any documentation whatsoever for
 * this hardware. Moreover, it is claimed that the sensor
 * is inaccurate and cannot work properly.
 */
Link to comment
Share on other sites

All Banana Pi models have at least solder pads to connect a battery (this is one of the many advantages of using a tablet SoC/PMU -- running on LiPo battery and also charging are supported 'by design'). And yes, I also quoted these comments from the driver's sources many times in the past. The funny thing is: the very same people that've written these comments also use the values they extract to implement thermal throttling in mainline kernel.

 

BTW: And to raise confusion again: the A13 SoC's name sounds like A10's sibling but it's sun5i and behaves like the A20 regarding SoC temp. To sum it up: Forget about SoC temp on these older SoCs and use the PMU's instead (at least the AXP209 contains overheat protection and shuts the board down immediately when an internal treshold is reached -- don't know how to influence this)

Link to comment
Share on other sites

BTW: after switching my Cubietruck from Jessie legacy (3.9.X?) over to mainline kernel 4.9.12 I noticed that the line

 

TEMP=$(cat /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input)

in .bashrc through an error message, because of the invalid path.

 

With a little search I replaced it by

 

TEMP=$(cat /sys/devices/platform/soc@01c00000/1c25000.rtp/hwmon/hwmon0/temp1_input)

However with the last kernel update to 4.10.12 the path became invalid again, and after another search I/noob decided to replace it with

TEMP=$(cat /sys/devices/platform/soc@01c00000/1c2ac00.i2c/i2c-0/0-0034/pmu/temp)

now

Link to comment
Share on other sites

2 hours ago, odoll said:

However with the last kernel update to 4.10.12 the path became invalid again

There's a persistent path existing as well: https://github.com/armbian/build/blob/f1ecde50b1aaee107a6126798dab7298bba1f77f/scripts/armhwinfo#L50

 

And then this is still PMIC, in case you want to measure the SoC instead just look a few lines below the reference.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines