🛠 Surveiller température et bridage : le BCM2835 à l'épreuve
Objectives
Set up continuous monitoring of the SoC: temperature, actual frequency, and especially the firmware throttling register, which also signals undervoltage. The BCM2835 on the Model B+ is clocked at 700 MHz, and the firmware throttles above 85 °C or in case of insufficient power supply — learn to detect this before shutdowns occur.
Hardware
- Raspberry Pi Model B+ running Raspberry Pi OS legacy 32-bit, connected via Ethernet (network tutorial)
- High-quality 5 V power supply; optional heatsinks or ventilated case
- Test load: sysbench or a simple calculation loop
Full code
# Lecture ponctuelle
cat /sys/class/thermal/thermal_zone0/temp # milli-°C
vcgencmd measure_temp # °C format humain
vcgencmd measure_clock arm # fréquence courante (Hz)
vcgencmd get_throttled # 0x0 = rien à signaler
# Interprétation de get_throttled (masques) :
# bit0 sous-tension | bit3 bridage sous-température | bit5 bridage fréquence
# bit6 bridage sous-tension | bits 16-19 = événements passés depuis le boot
# Journal de surveillance toutes les 30 s, 24 h
timeout 86400 sh -c 'while :; do
echo "$(date -Is) $(cat /sys/class/thermal/thermal_zone0/temp) $(vcgencmd measure_clock arm | cut -d= -f2) $(vcgencmd get_throttled | cut -d= -f2)"
sleep 30
done' > /var/log/thermal.csv
# Charge de test dans un autre terminal
yes > /dev/null & # puis tuer : kill %1
Expected verification
At idle, the sensor typically stays below 50 °C and get_throttled returns 0x0. Under yes, the temperature rises towards the 85 °C threshold, and measure_clock may drop below 700 MHz with the throttling bit set. A value of 0x50000 or 0x50005 indicates undervoltage: the problem is the power supply, not cooling.
Common errors
- Believing the CPU is faulty when
get_throttledshows an undervoltage bit: change the micro-USB cable and charger first. - Reading the register only once: bits 16-19 are latched since boot, so you must monitor their evolution over time.
- Overclocking a B+ to 1 GHz like a Pi 3: the ARM1176JZF-S does not support this; gains are low, and instability is guaranteed.
- Forgetting that the 512 MB of RAM is shared with the GPU: memory throttling occurs before thermal throttling in graphics-intensive uses.
- Enclosing the board in a closed case without ventilation: the convection from the bare design no longer works.
Other tutorials for this board
- Allumer une LED depuis la GPIO 17 avec libgpiod
- Lire un bouton et afficher les appuis dans la console
- Premier script Python : faire clignoter la LED
- Variation d'intensité d'une LED avec le PWM matériel (GPIO18)
- Interroger un capteur I2C (BME280) sur le bus du 40 broches
- Mettre le B+ en réseau par Ethernet et piloter en SSH
Code examples for this board
led_blink.pyPythonbutton_led.pyPythonservo_sweep.pyPythondht_temp.pyPythonoled_i2c.pyPythonmcp3008_read.pyPython