Repository navigation
Reference Design SparkFun XRP
Overview · What you need · Firmware · Hardware · Wiring · Setup · Status
SparkFun XRP Controller. Photo: SparkFun Electronics, from SparkFun_XRP_Controller, CC BY-SA 4.0.
| Config | xrp_config.yaml |
| Drivetrain | 2WD differential (the kit's own chassis); 4WD skid steer or mecanum with ports 3 and 4 |
| MCU | RP2350B on the XRP Controller (48 GPIO, 16 MB flash, 8 MB PSRAM) |
| Firmware image |
pico2-jazzy / pico2-lyrical (the Pico 2 W release) plus the XRP env block |
| micro-ROS link | USB serial (/dev/ttyACM0) |
| LiDAR | LD19 on the robot computer's USB (/dev/ttyUSB0, 230400 baud) |
| Status | ⬜ flashed on a real XRP Controller: topics and the LSM6DSOX check pass; motors not yet driven |
SparkFun's XRP Controller on the XRP kit's 2WD chassis, with the kit's two encoder gearmotors
and its 4 × AA pack. It is a complete commercial robot, so it carries the kit's own wheels, motors
and weight rather than the shared default chassis. Its Nav2 speed limits are the ones
drivetrain_report.py derives for those motors.
| Part | Notes |
|---|---|
| SparkFun XRP kit (the "Beta" or the current RP2350B kit) | Controller, chassis, two encoder gearmotors, wheels, battery holder |
| 4 × AA batteries | Into the kit's holder and barrel jack |
| LD19 LiDAR + its USB adapter | Into the robot computer, mounted on the kit's top plate |
| Robot computer | A Raspberry Pi 5 or any arm64/x86 computer running the cockpit (Installation & Docker). On the small XRP chassis it usually rides on a deck above the kit |
| USB-C cable | XRP Controller to the robot computer |
The XRP has no image of its own. It runs the RP2350 release, pico2-jazzy or
pico2-lyrical, the same image as a Pico 2 and a Pico 2 W. That image numbers all 48 GPIO of
the RP2350B, and the cockpit writes the XRP's own wiring into its env block when it flashes:
| Env key | XRP value | What it does |
|---|---|---|
cyw43_pins |
26,29,28,27 |
The RM2 radio's REG_ON, DATA, CLOCK and CS, set before the radio starts |
i2c_sda / i2c_scl
|
38 / 39 | The IMU's bus: an I2C1 pair, so the firmware runs Wire on I2C1 |
battery_pin |
46 | The VIN divider, on ADC6 |
Applying the design does the rest: the cockpit downloads pico2-<distro>, flashes it with picotool,
and writes this env.
| Component | Specification | Notes |
|---|---|---|
| MCU | RP2350B (dual Cortex-M33, 150 MHz) | 48 GPIO; 16 MB flash, 8 MB PSRAM |
| Radio | Raspberry Pi RM2 (CYW43439) on GP26–29 | Off: an RP2 runs micro-ROS over USB serial, and Wi-Fi (with syslog and OTA) belongs to the ESP32's Wi-Fi transport. Pins from cyw43_pins
|
| Motor drivers | On-board TI DRV8411A | Two PWM inputs per motor, no enable (pwm: -1) |
| Encoders | Kit gearmotors | 585 counts per wheel revolution |
| IMU | ST LSM6DSOX (6-axis) | I2C1; 0x6B with the ADR jumper (JP4) closed as shipped, 0x6A open |
| Battery sense | VIN → 100 kΩ (R22) / 33 kΩ (R23) → GP46 | ADC6; 13.3 V full scale |
| USB | SparkFun firmware 1b4f:0046; Pico 2 W image 2e8a:f00f; BOOTSEL 2e8a:000f
|
Detected by the cockpit as an RP2350 |
| Setting | Value |
|---|---|
| Base | 2WD differential |
| Wheel diameter / track | 60 mm / 155 mm |
| Motor | 140 rpm at 4.5 V, 0.75 A stall |
| Robot mass | 0.8 kg |
Path speed (desired_linear_vel) |
0.16 m/s |
| Velocity smoother ceiling | 0.19 m/s, 1.32 rad/s |
| Function | GPIO | Notes |
|---|---|---|
| Motor 1 (left) IN A / IN B | 35 / 34 | DRV8411A, port L; forward drives IN1 (GP34) |
| Motor 2 (right) IN A / IN B | 32 / 33 | DRV8411A, port R; forward drives IN2 (GP33) |
| Encoder 1 (left) A / B | 30 / 31 |
invert: true: the left encoder is mounted mirrored |
| Encoder 2 (right) A / B | 24 / 25 | |
| Motor 3 (rear-left) IN A / IN B | 21 / 20 | Port 3 (IN1 GP20, IN2 GP21), wired mirrored like port L; -1 on the 2WD kit |
| Motor 4 (rear-right) IN A / IN B | 10 / 11 | Port 4 (IN1 GP10, IN2 GP11), like port R; -1 on the 2WD kit |
| Encoder 3 (rear-left) A / B | 22 / 23 |
invert: true if mounted mirrored like the left; -1 on the 2WD kit |
| Encoder 4 (rear-right) A / B | 2 / 3 |
-1 on the 2WD kit |
| Motor current sense (ADC) | 40 / 43 / 41 / 42 | Ports L / R / 3 / 4; not used by the base |
| I2C1 SDA / SCL | 38 / 39 | On-board LSM6DSOX and the Qwiic port J13 |
| Battery sense (ADC) | 46 | 100k / 33k divider |
| Sonar trigger / echo | 0 / 1 | The kit's HC-SR04 header; also a Nav2 collision-monitor source |
| Status LED | 64 | On the RM2 radio |
| Wi-Fi radio | 26–29 | Reserved; the pin check rejects them |
Everything is on the controller: plug the left motor's 6-pin cable into Motor L and the right one into Motor R, and the battery into the barrel jack.
For a 4WD skid steer or mecanum chassis, set the drivetrain on the Base tab and fill in
the motor 3 and 4 rows above. Plug the rear-left motor into port 3 and the rear-right into port 4,
following the wheel order. Every encoder pair has
B = A + 1, which the RP2350's PIO quadrature reader needs. Set the rear motors' inversion from
the tool's motor (its DIR WRONG flag), not from this table.
Note
The pin map agrees across SparkFun's KiCad PCB, the pico-sdk board header, MicroPython's
SPARKFUN_XRP_CONTROLLER pins, arduino-pico's sparkfun_xrp_controller variant and XRPLib. The
motor and encoder directions are confirmed by the drive suite the first time a kit is flashed; the
4WD rows have not run on hardware.
- Install the cockpit on the robot computer: Installation & Docker.
-
Plug in the XRP Controller by USB-C, battery off. Out of the box it runs SparkFun's MicroPython
firmware (
1b4f:0046); the cockpit still recognises the RP2350. - Name your robot and apply the kit. Type a name for your robot in the header's Robot field and press Enter, then pick SparkFun XRP Kit -- XRP Controller (RP2350B + RM2), 2WD, LSM6DSOX under Reference Designs on MCU & Sim (tab 1). A kit brings its own motors, wheels and chassis with the board; if yours differ, change them on Base (tab 2) and Drive & Motors (tab 3). Your robot is real from then on: no simulated devices, and every change you make is saved to it as you go.
-
Flash: press Flash MCU on Hardware Tests (tab 6, Firmware image). The first flash
installs
pico2-<distro>and the XRP env; then Enter tool and Sensors: the tool lists the LSM6DSOX on I2C1. If the flasher reports that the board did not enter BOOTSEL (SparkFun's MicroPython does not answer the usual 1200-baud reset), either runimport machine; machine.bootloader()in its REPL, or hold BOOT, tap RESET and release; then flash again. Once our firmware is on it, later flashes need neither. -
Motors: turn the battery switch on, lift the robot, run
motorsin the tool. The left wheel (MOTOR 1) then the right must go forward inFWDwith a positive RPM. -
Battery:
sensorsprintsBAT:from the VIN divider; compare it with a multimeter. - LiDAR: mount the LD19 on the top plate with its zero facing forward, enter its position on Base (tab 2), and check it on LiDAR / Scan (tab 7).
- First drive: (the design made the robot real: the header's badge reads 🔧 Real) leave the tool with Back to robot (base) so the board runs the robot firmware, start Bringup (tab 8) and drive gently with Teleop (tab 9). The kit is slow by design: 0.19 m/s at most.
- Speed check: run the speed check against the LiDAR and put its ratios into the config before the first Nav2 goal.
- SLAM and Nav2: on Operations (tab 11) press ▶ Start 1-Click Pipeline (the robot runs real).
Flashed on a real XRP Controller: the Pico 2 W release image with the XRP env publishes /odom at
about 49 Hz and /imu/data at 50 Hz, and the tool's sensors finds the LSM6DSOX and reads gravity.
The image, the env block and the pin map are checked against SparkFun's sources, and the Pico 2 W
image passes the bench matrix in simulation mode. Not yet run: the motors, the LiDAR and a Nav2 goal.
All reference designs · Pin Matrix & Wiring · Building a Real Robot