🛠 Surveiller température et fréquence CPU, piloter le ventilateur PWM
Objectives
Instrument the ROCK 3B (4× Cortex-A55 up to 2.0 GHz, RK3568 at 22 nm): read thermal zone temperatures, observe the actual frequency under load, and understand the 2-pin 1.25 mm fan connector (5 V PWM). Official temperature references: Community edition 0–60 °C, Industrial edition (RK3568J) −40–85 °C. >
Hardware
- Radxa ROCK 3B running Radxa OS, PD 12 V / 2 A power supply (a poor power supply simulates thermal throttling)
- Adhesive heatsink and/or 5 V fan on the 2-pin 1.25 mm connector
sudo apt install stress-ng bc
Full code
# 1. Zones thermiques et températures (milli-°C)
paste <(for z in /sys/class/thermal/thermal_zone*/type; do cat $z; done) \
<(for z in /sys/class/thermal/thermal_zone*/temp; do echo "scale=1;$(cat $z)/1000"|bc; done)
# 2. Fréquence réelle des cœurs sous charge
(stress-ng --cpu 4 --timeout 60s &) ; sleep 5
while sleep 2; do grep -H . /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq; done
# 3. Politiques et seuils thermiques
grep . /sys/class/thermal/thermal_zone*/policy 2>/dev/null
sudo dmesg | grep -i -e thermal -e throttle
# 4. Ventilateur 2 broches : sous Radxa OS, vérifier rsetup (fan/thermal) ou
# le contrôle PWM manuel du bus correspondant (pwmchip) — >
# l'exposition exacte du connecteur fan varie entre images constructeur.
ls /sys/class/pwm/
Expected verification
Under stress-ng --cpu 4, scaling_cur_freq rises towards 2.0 GHz and then stabilizes; without a heatsink, the frequency drops and dmesg may display throttling messages. With a heatsink/fan, the temperature caps lower and the frequency holds longer. Raw temp values are in milli-degrees (53000 = 53 °C).
Common errors
- Forgetting the division by 1000 on
/sys/class/thermal/thermal_zone*/tempand panicking at "53000 °C". - Sampling the frequency only once: it is an instantaneous value, so you must loop during the load.
- Blaming thermal issues when the power supply is too weak: re-test with the recommended 12 V / 2 A PD power supply.
- Reversing the polarity of the 1.25 mm fan or drawing more current than the 5 V connector can provide.
- Exceeding the Community edition range (max 60 °C ambient) in a closed cabinet: this is the use case for the Industrial edition rated at 85 °C.
Other tutorials for this board
- Faire clignoter une LED via le GPIO avec libgpiod
- Lire un bouton poussoir en Python avec python3-libgpiod
- Premier réseau : Ethernet double gigabit, Wi-Fi optionnel et SSH
- Installer et booter le système sur un SSD NVMe (M.2 M-Key)
- Interroger un capteur I2C sur le connecteur 40 broches
- Routeur / passerelle réseau double Gigabit avec OpenWrt et PoE
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash