00 - Pico Expansion Board Peripheral Examples Overview
This chapter presents application examples for the various peripheral features of the Pico-G1 expansion board. These examples demonstrate how to use the hardware modules on the expansion board, including display devices, sensors, actuators, and other common peripherals. Each example provides complete hardware wiring instructions, software implementation code, and detailed deployment and running guides, helping developers quickly master peripheral programming skills.
1 Expansion Board Overview
The Pico-G1 expansion board provides the development board with a rich set of peripheral interfaces, including but not limited to:
- Display devices: OLED screen (I2C), TFT screen (SPI)
- Sensors: MPU6050 gyroscope, MQ gas sensor, SHT20 temperature/humidity sensor, ultrasonic ranging module, SPO2 blood-oxygen sensor
- Actuators: buzzer, motor, servo
- Others: GPS module, ADC acquisition
These peripherals cover the most commonly used functional modules in embedded system development, making them ideal for learning embedded programming and IoT application development.
2 Application Example List
| No. | Application | Description | Bus | Link |
|---|---|---|---|---|
| 1 | OLED display | SSD1306 128×64 OLED text display | I2C | Details |
| 2 | TFT display | ST7789 240×240 TFT color display | SPI | Details |
| 3 | MPU6050 gyroscope | Six-axis motion sensor data acquisition and display | I2C | Details |
| 4 | ADC acquisition | Analog signal acquisition and display | ADC | Details |
| 5 | Buzzer | Passive buzzer frequency control | GPIO | Details |
| 6 | MQ gas sensor | Air quality monitoring | ADC | Details |
| 7 | GPS positioning | GPS data parsing and location display | UART | Details |
| 8 | SHT20 temperature/humidity | Ambient temperature and humidity monitoring | I2C | Details |
| 9 | Ultrasonic ranging | Distance measurement with RGB parking-sensor display | GPIO | Details |
| 10 | SPO2 blood oxygen | Heart rate and blood-oxygen monitoring | I2C | Details |
| 11 | Motor control | DC motor PWM speed control | GPIO | Details |
| 12 | Servo control | Precise servo angle control | GPIO | Details |
3 Hardware Platform Features
3.1 Main Chip
- Chip model: GK7602V11A (internal SDK codename
xm7206v11a, architecturexmorca) - CPU architecture: ARM Cortex-A7
- Operating system: Linux (supports standard device nodes such as
/dev/gpiochip,/dev/i2c-*,/dev/spidev.*)
3.2 GPIO Features
- Supports the standard GPIO character device interface
- Supports direct access to IOCFG registers via
/dev/memfor pin-mux configuration - Provides digital control for the buzzer, motor, servo, etc.
3.3 Communication Interfaces
- I2C: supports I2C0, I2C2, I2C3 (corresponding to
/dev/i2c-0,/dev/i2c-2,/dev/i2c-3) - SPI: supports multiple SPI controllers (corresponding to
/dev/spidev.*.*) - UART: supports multiple serial controllers (corresponding to
/dev/ttyS*) - ADC: supports analog signal acquisition (12-bit resolution)
4 Development Environment Preparation
4.1 Prerequisites
- SDK environment: set up the cross-compilation environment as described in Development Environment Setup
- Hardware connection: make sure the expansion board is properly connected to the Pico-G1 development board
- Serial connection: access the on-board Linux system via serial or SSH
4.2 Toolchain Setup
# Set the cross-compilation toolchain path
export PATH=$PATH:<SDK>/tools/linux/toolchains/arm-gcc12.2.0-linux-uclibceabi/bin
# Verify the toolchain
arm-linux-gcc --version4.3 Common Build Workflow
All examples share a unified Makefile structure:
# Enter the example directory
cd <SDK>/source/app/<example-name>
# Build
make
# Clean
make clean
# Deploy to the board
scp <executable> root@<board-IP>:/usr/bin/
# Run
ssh root@<board-IP} '/usr/bin/<executable>'5 Code Architecture Design
5.1 HAL Layer Encapsulation
Each example adopts the hardware abstraction layer (HAL) design pattern, encapsulating low-level hardware operations in separate HAL modules:
gpio_hal.c/h: GPIO character device operation encapsulationi2c_hal.c/h: I2C device read/write encapsulationspi_hal.c/h: SPI device read/write encapsulationuart_hal.c/h: UART serial communication encapsulation
This design keeps the application code clean and makes it easy to port to other platforms.
5.2 Driver Layer Implementation
For specific peripheral chips, independent driver modules are provided:
ssd1306.c/h: OLED screen driverst7789.c/h: TFT screen drivermpu6050.c/h: MPU6050 sensor driversht20.c/h: SHT20 temperature/humidity sensor driver- etc...
5.3 Application Layer Code
The main.c file of each example demonstrates the complete application flow, including:
- Hardware initialization
- Pin-mux configuration (if needed)
- Peripheral initialization
- Main loop processing
- Resource cleanup
6 Recommended Learning Path
6.1 Beginner Path
It is recommended to learn in the following order, from simple to complex:
- Buzzer → learn basic GPIO control
- OLED display → learn I2C communication and display drivers
- MPU6050 → learn I2C sensor data reading
- TFT display → learn high-speed SPI communication
6.2 Advanced Path
Once you have mastered the basics, you can move on to more complex applications:
- GPS positioning → learn UART serial communication and NMEA protocol parsing
- Ultrasonic ranging → learn GPIO timing control
- Motor control → learn PWM output and actuator control
- Servo control → learn precise PWM control
- Integrated applications → combine multiple sensors and actuators into a complete system
7 Debugging Tips
7.1 Hardware Debugging
- Device node check:
ls -l /dev/i2c-*,ls -l /dev/spidev.*.*, etc. - Pin-mux verification: check the pin configuration via boot logs or
/dev/memtools - I2C device probing: use
i2cdetector on-board tools to probe slave device addresses
7.2 Software Debugging
- Log output: add
printfdebug messages - Return value check: check the return value of every system call
- Step-by-step testing: test the hardware connection first, then the driver functions, and finally the application logic
8 FAQ
| Problem | Possible cause | Solution |
|---|---|---|
| Device node does not exist | Kernel driver not loaded or device tree misconfigured | Check the kernel config and device tree DTS |
| I2C/SPI communication failure | Pin-mux error or wiring problem | Verify the hardware connection with i2cdetect and similar tools |
| Program unresponsive | Deadlock or infinite loop | Add debug messages and check the loop logic |
| Build error | Wrong toolchain path or missing headers | Reset PATH and check SDK integrity |
9 References
9.1 Related Documents
- Quick Start Guide
- GPIO Interface in Detail
- I2C Interface in Detail
- SPI Interface in Detail
- UART Interface in Detail
9.2 Code Location
All example code lives in the SDK's source/app/ directory:
<SDK>/source/app/
├── 01_oled_display/ # OLED display
├── 02_TFT_display/ # TFT display
├── 03_mpu6050_display/ # MPU6050 gyroscope
├── 04_adc_display/ # ADC acquisition
├── 05_buzzer/ # Buzzer
├── 06_MQ_Sensor/ # MQ gas sensor
├── 07_gps_display/ # GPS positioning
├── 08_sht20_display/ # SHT20 temperature/humidity
├── 09_sonic_display/ # Ultrasonic ranging
├── 10_spo2_sensor/ # SPO2 blood oxygen
├── 11_motor/ # Motor control
└── 12_servo_ctrl/ # Servo control10 Next Steps
Pick an example that interests you and start learning! We recommend starting with the buzzer or OLED display — these examples are relatively simple and will help you get familiar with the whole development workflow.
Tip: each example comes with a complete README covering hardware wiring, build & deployment, and run parameters in detail. When you hit a problem, first check the README.md in the corresponding directory.
