+
Skip to content

murr2k/RP2350

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RP2350 LCD & IMU Demo Collection

A comprehensive collection of demos and utilities for the Waveshare RP2350-LCD-1.28 development board, featuring a round 240x240 LCD display and QMI8658 6-axis IMU.

Author

Murray Kopit (murr2k@gmail.com)
Date: August 24, 2025
License: MIT

Hardware

This project is designed for the Waveshare RP2350-LCD-1.28 development board featuring:

  • MCU: Raspberry Pi RP2350 (Dual ARM Cortex-M33)
  • Display: 1.28" Round LCD (240×240, GC9A01A controller, SPI interface)
  • IMU: QMI8658 6-axis sensor (3-axis accelerometer + 3-axis gyroscope, I2C interface)
  • Memory: 520KB SRAM, 4MB Flash
  • Interfaces: USB Type-C, GPIO headers, JST battery connector

Features

Demos Included

  1. configurable_cube - Interactive 3D cube with runtime-adjustable IMU mapping via serial CLI
  2. madgwick_cube - 6-DOF orientation tracking using Madgwick filter
  3. intuitive_cube - Tilt-responsive cube using accelerometer only
  4. buffered_cube - Basic rotating wireframe cube demonstration
  5. rotation_test - IMU axis calibration and testing tool
  6. axis_test - Visual IMU data display
  7. gravity_locked_cube - Cube that maintains orientation relative to gravity
  8. Various test utilities - SPI test, minimal LCD test, etc.

Key Technologies

  • Madgwick Filter: Quaternion-based sensor fusion for drift-free orientation
  • Frame Buffer Rendering: Smooth graphics via buffered display updates
  • Real-time Serial CLI: Interactive parameter adjustment via USB CDC
  • Hardware Abstraction: Clean separation of drivers and application code

Development Environment Setup

Prerequisites

1. Operating System

  • Ubuntu 20.04/22.04 (native or WSL2)
  • For WSL2: Ensure WSLg is enabled for USB passthrough (optional)

2. Install Build Tools

# Update package list
sudo apt update

# Install essential build tools
sudo apt install -y \
    cmake \
    gcc-arm-none-eabi \
    libnewlib-arm-none-eabi \
    libstdc++-arm-none-eabi-newlib \
    build-essential \
    git \
    python3 \
    python3-pip

# Install additional tools
sudo apt install -y \
    minicom \
    screen

3. Install Raspberry Pi Pico SDK

# Create workspace
mkdir -p ~/pico
cd ~/pico

# Clone Pico SDK
git clone -b 2.0.0 https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
git submodule update --init

# Set environment variable (add to ~/.bashrc for persistence)
export PICO_SDK_PATH=~/pico/pico-sdk
echo 'export PICO_SDK_PATH=~/pico/pico-sdk' >> ~/.bashrc

4. Install Picotool (Optional but recommended)

cd ~/pico
git clone https://github.com/raspberrypi/picotool.git
cd picotool
mkdir build
cd build
cmake ..
make
sudo make install

Building the Project

# Clone this repository
git clone https://github.com/murr2k/RP2350.git
cd RP2350

# Create build directory
mkdir build
cd build

# Configure with CMake
cmake ..

# Build all targets
make -j$(nproc)

# Or build specific target
make configurable_cube

Build Output

Successfully built firmwares will be in the build directory as .uf2 files:

  • configurable_cube.uf2 - Main interactive demo
  • madgwick_cube.uf2 - 6-DOF tracking demo
  • rotation_test.uf2 - Axis calibration tool
  • And more...

Flashing Firmware

Method 1: UF2 Bootloader (Easiest)

  1. Hold the BOOT button on the board
  2. Connect USB cable (or press RESET while holding BOOT)
  3. Release BOOT button
  4. Board appears as USB mass storage device (RPI-RP2)
  5. Copy desired .uf2 file to the drive
  6. Board automatically reboots with new firmware

Method 2: Using Picotool

# List connected RP2350 devices
picotool info

# Flash firmware
picotool load configurable_cube.uf2
picotool reboot

Using the Configurable Cube Demo

Serial Connection

Windows

  1. Use PuTTY, TeraTerm, or Arduino Serial Monitor
  2. Find COM port in Device Manager
  3. Connect at 115200 baud, 8N1

Linux/WSL

# Find device (usually /dev/ttyACM0 or /dev/ttyUSB0)
ls /dev/tty*

# Connect with minicom
minicom -D /dev/ttyACM0 -b 115200

# Or use screen
screen /dev/ttyACM0 115200

CLI Commands

Press 'm' in the terminal to see the menu:

Axis Controls:

  • 1-6: Toggle axis inversions (1=AX 2=AY 3=AZ 4=GX 5=GY 6=GZ)
  • q/w: Swap accelerometer axes
  • a/s: Swap accelerometer axes
  • z/x: Swap accelerometer axes

Display Controls:

  • d: Toggle sensor data display
  • c: Toggle cube display
  • e: Toggle axes display
  • p: Pause/unpause

Filter Controls:

  • +/-: Increase/decrease Madgwick beta (convergence rate)
  • r: Reset orientation to identity quaternion
  • b: Recalibrate gyroscope bias

Information:

  • v: View current sensor values
  • m: Show menu
  • i: Show current configuration

Project Structure

RP2350/
├── CMakeLists.txt          # Main CMake configuration
├── README.md               # This file
├── LICENSE                 # MIT License
├── build/                  # Build output directory (generated)
│   └── *.uf2              # Firmware files
├── src/                    # Source code
│   ├── configurable_cube.c # Main interactive demo
│   ├── madgwick_cube.c     # Madgwick filter implementation
│   ├── rotation_test.c     # Axis testing utility
│   └── ...                 # Other demos
├── lib/                    # Waveshare libraries
│   ├── Config/             # Board configuration
│   └── LCD/                # Display driver
├── include/                # Header files
└── drivers/                # Additional drivers (unused)

Technical Details

Display Communication

  • Interface: SPI (10MHz)
  • Chip Select: Must be held LOW continuously after reset
  • Frame Buffer: 240×240×2 bytes (115.2KB)
  • Color Format: RGB565 (16-bit)

IMU Configuration

  • I2C Address: 0x6B
  • Accelerometer: ±2g range, 16384 LSB/g
  • Gyroscope: ±256 dps range, 128 LSB/dps
  • Sample Rate: 100-250 Hz

Madgwick Filter Parameters

  • Beta: 0.1 (default) - Higher values trust accelerometer more
  • Sample Rate: 100 Hz
  • Quaternion Output: Unit quaternion representing orientation

Troubleshooting

Black Screen

  • Ensure CS pin is held LOW after LCD reset
  • Check SPI connections and clock speed
  • Verify backlight PWM is set

IMU Not Responding

  • Check I2C pull-up resistors (internal pull-ups enabled)
  • Verify QMI8658 WHO_AM_I returns 0x05
  • Try I2C address 0x6A if 0x6B fails

Incorrect Axis Mapping

  1. Flash rotation_test.uf2
  2. Observe which axes respond to rotation
  3. Use configurable_cube.uf2 to find correct mapping
  4. Note configuration and update source code

USB Serial Not Working

  • Ensure pico_enable_stdio_usb(target 1) in CMakeLists.txt
  • Wait 2-3 seconds after reset for USB enumeration
  • Check device manager/dmesg for CDC device

Dependencies

References

Contributing

Issues and pull requests are welcome! Please ensure any new demos:

  1. Follow the existing code structure
  2. Include appropriate error handling
  3. Document any new CLI commands
  4. Test on actual hardware

License

MIT License - See LICENSE file for details

Acknowledgments

  • Sebastian Madgwick for the IMU filter algorithm
  • Waveshare for hardware documentation and base drivers
  • Raspberry Pi Foundation for the Pico SDK

Created by Murray Kopit, August 24, 2025

About

Demos and utilities for Waveshare RP2350-LCD-1.28 with round LCD and 6-axis IMU

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载