🛠 Surveiller température et fréquence CPU sous contrainte

Orange Pi 3B (Rockchip RK3566) · avance · Schéma : IMG-orangepi-3b-avance-2-opi3b-thermique.svg — Orange Pi 3B avec dissipateur et ventilateur 2 broches, courbes de température et fréquence des Cortex-A55

Objectives

Instrument the Orange Pi 3B (4× Cortex-A55 up to 1.8 GHz, RK3566 in 22 nm): read thermal zone temperatures, observe the actual frequency of each core, trigger an alert threshold, and test passive cooling vs. a fan on the 2-pin connector.

Hardware

Complete Code

# 1. Températures (degrés milli-C) et politiques thermiques
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 par cœur pendant une charge
sudo apt install stress-ng
(trap 'kill %1' INT; stress-ng --cpu 4 --timeout 60s) &
while sleep 2; do grep -H . /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq; done

# 3. Alerte simple toutes les 10 s
while sleep 10; do
  t=$(($(cat /sys/class/thermal/thermal_zone0/temp)/1000))
  [ $t -gt 75 ] && logger -p user.warning "CPU trop chaud : ${t}°C"
done
# 4. Compteur de passages en limitation thermique (throttle)
grep . /sys/class/thermal/thermal_zone*/policy 2>/dev/null
sudo dmesg | grep -i -e thermal -e throttle

Expected Verification

Under stress-ng --cpu 4, scaling_cur_freq climbs toward 1.8 GHz and then stabilizes; without a heatsink, the frequency drops back down and dmesg may display thermal messages. With a heatsink/fan, the temperature caps out lower and the frequency holds longer.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials