🛠 Mastering I/O: GPIO, Sensors, and Displays on CM3588
Objectives
This tutorial aims to exploit the advanced I/O capabilities of the CM3588 module. You will learn to manipulate the 81 available GPIOs, configure MIPI CSI interfaces for cameras, and manage HDMI 2.1 or MIPI DSI video output. The focus is on Device Tree configuration and using Linux command-line tools for precise control.
Required Hardware
- CM3588 Module (Standard or Plus version)
- Compatible Baseboard (e.g., CM3588 Baseboard)
- 5-20VDC Power Supply (max 20W)
- GPIO Connection Cables (Dupont)
- I2C Sensor (e.g., BME680) or MIPI CSI Camera Module
- HDMI Display or MIPI DSI Panel
- PC with SSH access and Device Tree compiler (dtc)
Steps
Log in via SSH. Ensure GPIO control tools are installed: ``bash sudo apt update && sudo apt install gpiod libgpiod-tools ` Identify available pins via the configuration file: `bash cat /sys/kernel/debug/gpio ``
- Environment Preparation
The CM3588 exposes its GPIOs via the pinctrl controller. To control a specific pin (e.g., GPIO1_A0), use gpioset or gpioget. Example to set an output high: ``bash # Identify the corresponding GPIO in the system gpiodetect # Activate the pin (number to adapt according to baseboard schematic) gpioset gpiochip0 10=1 `` For programmatic use in C, use the libgpiod library.
- GPIO Configuration
Enable the I2C interface in the Device Tree. Check bus presence: ``bash ls /dev/i2c-* i2cdetect -y 1 ` If the sensor appears, install specific drivers. For a temperature sensor, read registers via i2cget: `bash i2cget -y 1 0x76 0xd0 ``
- Interfacing with an I2C Sensor
The RK3588 supports 8K@60Hz. Check screen detection: ``bash xrandr --listmonitors ` To force a specific resolution, edit the graphics server configuration file or use xrandr: `bash xrandr --output HDMI-1 --mode 3840x2160 --rate 60 ` For MIPI DSI screens, configuration is done exclusively via the Device Tree (dsi` node), defining timings and native panel resolution.
- HDMI 2.1 Display Management
Connect the camera. Check image sensor detection: ``bash dmesg | grep -i csi ` Use v4l2-ctl to test the video stream: `bash v4l2-ctl --list-devices v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=NV12 ``
- MIPI CSI Camera
Verification
For GPIOs, use a multimeter to confirm voltage levels (0V/3.3V). For I2C, ensure readings are consistent with sensor specifications. For display, check for absence of visual artifacts and stability of the 8K signal if applicable. For the camera, capture an image with ffmpeg:
ffmpeg -f v4l2 -video_size 1920x1080 -i /dev/video0 -frames:v 1 test.jpg
Further Reading
Explore DMA usage for transferring sensor data without overloading the CPU. Study Device Tree overlays to dynamically load configurations without recompiling the kernel. Finally, optimize energy consumption by putting unused interfaces to sleep via the Linux kernel's power management framework.