🛠 GPIO du CM4 : comprendre les banks 1,8 V / 3,3 V avant de câbler

Raspberry Pi Compute Module 4 (CM4, 2020) — Board Sheet · debutant · Schéma : IMG-compute-module-4-debutant-2-gpio-1v8-vgpio-vref-cm4.svg — CM4 sur IO Board, broche GPIO17 reliée via une résistance 330 Ω à une LED puis au GND ; un sélecteur de tension met le bank soit sur CM5_3.3V soit sur CM5_1.8V (VGPIO_VREF).

Objectives

Turn on an LED using gpiozero while understanding the GPIO peculiarity of the CM4: its 28 GPIO signals support 1.8 V or 3.3 V signaling per bank, with the VGPIO_VREF pin of each bank connected to the chosen rail — unlike the Pi 4B, which is fixed at 3.3 V. You will verify the actual voltage of the bank before wiring a module, and you will learn that the default drive strength is 4 mA (configurable 1–8 mA) with internal pull-ups of approximately 47 kΩ.

Hardware

Complete Code

# Installer les outils et repérer la config des broches
sudo apt update && sudo apt install -y pinctrl gpiod-tools
pinctrl -p | grep -E '^(17|22|27)'      # fonction et pull de chaque broche
gpioget gpiochip0 17                     # état logique lu sur GPIO17
#!/usr/bin/env python3
# blink_cm4.py — 10 clignotements sur GPIO17 (bank 0 de l'IO Board en 3,3 V)
# AVANT de câbler : vérifier la tension du bank (VGPIO_VREF) sur sa carte porteuse !
from gpiozero import LED
from time import sleep

led = LED(17)
for _ in range(10):
    led.on;  sleep(0.25)
    led.off; sleep(0.25)
print("OK — GPIO17 piloté")

Expected Verification

The LED blinks 10 times at 2 Hz. pinctrl -p shows gpio17 as gpio output during execution, and the script terminates without raising an exception. On a custom carrier board, measuring with a multimeter between the bank's VGPIO_VREF pin and GND should yield 3.3 V (or 1.8 V if the 1.8 V rail is selected).

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials