PlatformIO firmware for a CH32V203F8U6 module that reads a PMW3901 optical-flow sensor and a VL53L1X rangefinder, then publishes INAV/ArduPilot-compatible MSPv2 sensor frames over UART.
| Function | CH32V203F8U6 Pin |
|---|---|
| PMW3901 SPI1 SCK | PA5 |
| PMW3901 SPI1 MISO | PA6 |
| PMW3901 SPI1 MOSI | PA7 |
| PMW3901 CS | PA4 |
| PMW3901 RESET | PB0 |
| PMW3901 MOTION | PA8 |
| VL53L1X SCL | PA0 |
| VL53L1X SDA | PA1 |
| VL53L1X XSHUT | PA2 |
| VL53L1X IRQ | PA3 |
| FC MSP UART TX | PA9 |
| FC MSP UART RX | PA10 |
| WCH-Link SWDIO/SWCLK | PA13/PA14 |
.venv-pio/bin/pio run -e flyingrc_ch32v203f8u6This workspace path contains spaces, which exposes a linker-map quoting bug in
the current Community-PIO-CH32V platform. platformio.ini therefore builds in
/tmp/flyingrc_opticflow_pio; scripts/fix_link_map.py forces a safe map
filename and mirrors the main artifacts back into the project after a successful
build.
Main artifacts are mirrored here by pio run:
.pio/build/flyingrc_ch32v203f8u6/firmware.elf
.pio/build/flyingrc_ch32v203f8u6/firmware.bin
MSP2_SENSOR_OPTIC_FLOW(0x1F02):quality,motionX,motionYMSP2_SENSOR_RANGEFINDER(0x1F01):quality,distanceMm
Default rates are configured in include/board_config.h: optical flow at
100 Hz and rangefinder at 20 Hz.