🛠 Noyau mainline avec Armbian : vérifier le device tree, ajouter un overlay, lire le SARADC
Objectives
The device tree rk3566-radxa-zero-3w.dts entered the mainline kernel via commit 1a5c8d307c83 (Jonas Karlman, merged on May 27, 2024, first release: Linux 6.10), with eMMC/SD/HDMI/USB support; an MMC alias fix (060c1950) followed in June 2024. Armbian ships this mainline kernel for the board. This tutorial covers: switching to Armbian, verifying that you are indeed using the mainline descriptor, mastering the Armbian overlay mechanism, and reading the analog input SARADC_IN5 (3.3 V max) exposed by the rockchip-saradc IIO driver.
Hardware
- 1 Radxa ZERO 3W + microSD card
- Armbian image for radxa-zero3 (armbian.com/boards/radxa-zero3 — default credentials root/1234 according to the Radxa page)
- For the SARADC: a variable voltage source 0–3.3 V (e.g., a 10 kΩ potentiometer wired between 3V3 and GND, with the wiper connected to the SARADC_IN5 pin) — never exceed 3.3 V
1) Verify the mainline board description
cat /proc/device-tree/compatible # -> radxa,zero-3w rockchip,rk3566
uname -a # noyau mainline Armbian (>= 6.10)
ls /boot/dtb/rockchip/ | grep zero3 # le DTB embarqué
2) Armbian Overlays
ls /boot/dtb/rockchip/overlay/ # liste les overlays livrés avec VOTRE release
sudo nano /boot/armbianEnv.txt # ajoutez : overlays=pwm1i2pwm (exemple)
sudo reboot
# Overlay maison :\ncat > my.dts << 'EOF'
/dts-v1/; /plugin/;
/ {
fragment@0 {
target-path = "/";
__overlay__ {
vcc_cam: vcc-cam {
compatible = "regulator-fixed";
regulator-name = "vcc-cam";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
};
};
};
EOF
dtc -@ -I dts -O dtb -o my.dtbo my.dts # puis déclarez-le dans armbianEnv.txt
3) SARADC via IIO
ls /sys/bus/iio/devices/iio:device*/ # l'un a name = rockchip-saradc
cat /sys/bus/iio/devices/iio:device0/in_voltage5_raw # code brut du canal 5
cat /sys/bus/iio/devices/iio:device0/in_voltage_scale # LSB -> mV
awk 'NR==FNR{r=$1;next}{printf "%.3f V\n", r*$1/1e9}' \
/sys/bus/iio/devices/iio:device0/in_voltage5_raw \
/sys/bus/iio/devices/iio:device0/in_voltage_scale
Expected Verification
compatible correctly returns radxa,zero-3w rockchip,rk3566; after adding an overlay, ls /proc/device-tree/ or ls /sys/firmware/devicetree/base/ shows the added node; when turning the potentiometer, in_voltage5_raw follows and the awk calculation displays 0.000 to 3.300 V.
Common Errors
- Confusing BSP (6.1/5.10 Radxa) and mainline (Armbian): overlays are managed via rsetup on Radxa OS, and via armbianEnv.txt on Armbian — do not mix the mechanisms.
- Modifying armbianEnv.txt without saving the original: a malformed
overlays=line can prevent devices from booting. - Sending > 3.3 V to SARADC_IN5: absolute maximum is 3.3 V, the input is not 5 V tolerant.
- Reading the wrong channel: the IIO channel is not necessarily the pin number — identify
rockchip-saradcand test channel by channel. - Expecting a DAC: no digital-to-analog converter is documented on the connector — analog reading only.
- Forgetting the MMC alias fix commit on an old mainline kernel (pure 6.10): SD/eMMC may be swapped; use a release ≥ 6.11 or an up-to-date Armbian. >
Other tutorials for this board
- Premiers pas avec la Radxa ZERO 3W : flasher Radxa OS et démarrer
- Wi-Fi 6 et Bluetooth 5.4 : se connecter, choisir l'antenne, connaître sa révision
- GPIO avec libgpiod : faire clignoter une LED et lire un bouton
- Installer le système sur l'eMMC : rkdeveloptool, MaskROM et gain de fiabilité
- Caméra MIPI CSI : brancher une Raspberry Pi Camera (OV5647/IMX219) sur la ZERO 3W
- NPU 0,8 TOPS : inférence RKNN (YOLO, Whisper) sur la ZERO 3W
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash