kxmx Posted November 4, 2015 Posted November 4, 2015 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+
zador.blood.stained Posted November 4, 2015 Posted November 4, 2015 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.
kxmx Posted November 5, 2015 Author Posted November 5, 2015 Thanks for reply, cpu is actually slightly hotter, but let me ask. Where on board (BPi-M1+) is the pmu sensor?
zador.blood.stained Posted November 5, 2015 Posted November 5, 2015 Sensor is internal, so for your board it is located somewhere here :
tkaiser Posted November 5, 2015 Posted November 5, 2015 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)
zador.blood.stained Posted November 5, 2015 Posted November 5, 2015 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. */
tkaiser Posted November 5, 2015 Posted November 5, 2015 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)
zador.blood.stained Posted November 5, 2015 Posted November 5, 2015 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 Well, it can be disabled and dealt with via IRQ, but I don't see any register that would allow changing the threshold.
odoll Posted April 28, 2017 Posted April 28, 2017 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
tkaiser Posted April 28, 2017 Posted April 28, 2017 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.
Recommended Posts