While monitoring CPU temperature from /sys/class/thermal/thermal_zone0/temp, I noticed that the minimal step is exactly 0.538°C. This is the same on both Pi 3 B and Pi 3 B+, and I suppose that it applies to Pi 3 A+. Why is it this value?
- 315
- 1
- 13
2 Answers
I'm going to go off-script a bit, and supply an incomplete answer. I am doing this in the hope that it will help "smoke out" a bit of knowledge on the proprietary CPU used in the Raspberry Pi, namely the range and resolution of the built-in temperature sensor. I've searched in vain for these two values for the past 30 minutes; if they're "published", they seem to be well-hidden (either that, or my Google searches are lame :)
The OP's question can be answered with a formula for quantization error:
Q = R/2N
Where:
Q = quantum, or step size
R = sensor range (max temp - min temp)
N = # bits used to represent the temperature reading
Consider for example a temp sensor with a range of 180 degF, where the temp readings are encoded as an 8-bit value:
Q = 180/28 = 0.703 degF
Which simply says that as the real (analog) temperature changes, the digital representation of that temperature will "jump" in increments of 0.703 degF.
If we know the R and N values for the RPi's internal CPU temp sensor, the Q value will be 0.538 degC.
- 21,900
- 3
- 33
- 70
-
You're seeking something that's proprietary to Broadcom and unlikely to be published anywhere. – Dougie Mar 15 '19 at 17:48
-
@Dougie: I figured as much. But hackers are resourceful people, and if they come by the information honestly, then that's all well and good, and as it should be. – Seamus Mar 15 '19 at 19:51
The measuring range should extend over the full operating temperature range of the chip, and an 8 bit DAC presents minimal difficulty in fabrication, so is likely to be an 8 bit number. 0.528 * 256 = 135.168 deg. There will be a fair bit of tolerance on individual chips, if it was nominally 0.546875 (7.5% error, quite typical of untrimmed silicon) it would correspond to a range of 140 deg C, or -40 (typical lower limit for commercial semiconductors) to + 100 deg C, a reasonably safe maximum.
So I would suggest that it is the value of 1 LSB of an 8 bit uncalibrated DAC crudely measuring a typical working temperature range for the silicon.
- 21
- 2
/sys/class/thermal/thermal_zone0/tempto deg C? Are you sure the number is not 0.538?? If so, please edit your question. – Seamus Mar 15 '19 at 14:43538(or,0.538 degC). I was asking you to confirm the value posted in your question is really.528and not.538. – Seamus Mar 15 '19 at 16:46