🛠 GPIO du CM5 côté RP1 : force de conduite, budget 50 mA et broches pièges

Raspberry Pi Compute Module 5 (compute-module-5) · intermediaire · Schéma : IMG-compute-module-5-intermediaire-1-rp1-gpio-drive-50ma.svg — CM5 ouvert en vue schématique montrant la puce RP1 à côté du BCM2712 ; les GPIO0–27 sortent de RP1 vers les connecteurs ; un multimètre mesure le courant total de la nappe avec la limite 50 mA annotée ; les broches GPIO0/1 (bus ID) et GPIO29 (Fan_Tacho) sont marquées d'un point d'attention.

Objectives

On the CM5, the GPIO is no longer wired to the SoC but to RP1, Raspberry Pi's I/O chip ("an entire extra chip on the board compared to the CM4"), exactly as on the Pi 5. Practical consequences: the gpiochip0 controller is named rp1, the drive strength is configurable at 2/4/8/12 mA, internal pull-ups are ~55 kΩ, and above all, the cumulative GPIO current must not exceed 50 mA across all 28 pins. This tutorial inventories the controller, blinks an LED, reads a button input, and calibrates your driving choices.

Hardware

Complete code

# 1) Prouver que le GPIO vient de RP1
sudo pinctrl -p | head -8            # gpiochip0 : « rp1 »
gpioinfo gpiochip0 | sed -n '1,14p'

# 2) Blink + bouton (gpiozero fonctionne inchangé, comme sur Pi 5)
cat > /tmp/rp1_demo.py <<'EOF'
from gpiozero import LED, Button
from signal import pause
led = LED(17)          # LED + 470 ohm vers GND
btn = Button(4)        # bouton vers GND, pull-up interne ~55 kohm
btn.when_pressed = led.on
btn.when_released = led.off
pause
EOF
python3 /tmp/rp1_demo.py

Expected verification

pinctrl -p identifies gpiochip0 = rp1 (on CM4 it was the BCM2711 SoC); the LED lights up during the press; gpioget gpiochip0 4 is 1 at rest (internal pull-up). Budget calculation: one LED at 5 mA × 8 pins = 40 mA, we are close to the 50 mA ceiling — the datasheet also imposes VOL ≤ 0.4 V at the current of the selected setting.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials