The overview, with examples running, is on the board page.
The Seeed Studio XIAO RP2040
The Pico's RP2040 on a thumbnail: fourteen pads, a USB-C socket, a red, green and blue user LED and a NeoPixel of its own.
What it is
The same RP2040 as the Raspberry Pi Pico, a Cortex-M0+, on the XIAO family's outline: 21 by 17.5 mm, with seven castellated pads down each long edge, 0.6 inch apart, so it pushes into a breadboard across the channel. The board also carries the BOOT and RESET buttons, a three-color user LED and a WS2812 NeoPixel. Mokxi runs the chip, its pads and both lights.
The pin numbers are the XIAO's
The silkscreen numbers are the XIAO family's, not the chip's. Mokxi builds
this board the way the arduino-pico core's "Seeed XIAO RP2040" does: a bare
number is a GPIO, and D0 to D10 and A0 to A3 are defined as GPIO
numbers. So write D0, not 0.
| Pad | GPIO | Also |
|---|---|---|
D0 |
26 | A0 |
D1 |
27 | A1 |
D2 |
28 | A2 |
D3 |
29 | A3 |
D4 |
6 | I2C SDA |
D5 |
7 | I2C SCL |
D6 |
0 | UART TX, see below |
D7 |
1 | UART RX, see below |
D8 |
2 | SPI SCK |
D9 |
4 | SPI MISO |
D10 |
3 | SPI MOSI |
With the USB at the top, D0 to D6 run down the left and 5V, GND,
3V3, D10, D9, D8 and D7 down the right. 5V and 3V3 are supplies
for the breadboard, at 5 V and 3.3 V.
A0 to A3 read the volts on the net, ten bits against 3.3 V unless
analogReadResolution() asks for more. Every pad can do PWM with
analogWrite(), and every pad can take attachInterrupt().
Wire uses D4 and D5. SPI uses D8, D9 and D10, with no chip
select pad of its own, so pick any free pad for CS. Both buses run in
software on those pads. Serial reaches the serial monitor, and Serial1 is
the same port. D6 and D7 are UART0's pins on the chip, but here they stay
ordinary pins. There is no Serial2 on this board.
The user LED
The user LED is three LEDs in one, each wired from 3.3 V to its pin, so each lights when its pin is LOW:
| Color | GPIO | Name |
|---|---|---|
| Red | 17 | LED_BUILTIN, PIN_LED, PIN_LED_R |
| Green | 16 | PIN_LED_G |
| Blue | 25 | PIN_LED_B |
So digitalWrite(LED_BUILTIN, LOW) turns the red one on and HIGH turns it
off. The three pins are inside the board, on no pad.
The NeoPixel
The NeoPixel is a WS2812 on GPIO 12 (PIN_NEOPIXEL), and its supply comes
from GPIO 11 (NEOPIXEL_POWER). Drive NEOPIXEL_POWER HIGH first, as Seeed's
examples do. Until then the NeoPixel stays dark however much data it is sent,
as on the real board.
It is a full WS2812 model of its own, so
Adafruit_NeoPixel works as it does on a desk:
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel pixel(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(NEOPIXEL_POWER, OUTPUT);
digitalWrite(NEOPIXEL_POWER, HIGH);
pixel.begin();
}
The board draws the NeoPixel in the color it was last sent.
What is modeled
The Pico model's chip, whole: the Cortex-M0+ core, GPIO and the pads, PWM on
every pin, the TIMER behind millis() and delay(), UART0 wired to the
serial monitor, pin interrupts, the watchdog and the ADC on GPIO 26 to 29, at
the real RP2040 addresses. The three user LEDs and the NeoPixel are on the
board.
What is not modeled
The pads on the back (the SWD pair, RUN and the battery pads) and the power LED. RESET and BOOT are buttons with no pin.
From the RP2040 itself, as on the Pico: the second core,
PIO, DMA, the chip's own I2C and SPI blocks (Wire and SPI run in software
instead), the USB controller (Serial reaches the monitor directly), the RTC
and the clock tree.
Common mistakes
digitalWrite(0, HIGH) to drive D0. Here 0 is GPIO 0, which is D6. Write
digitalWrite(D0, HIGH).
digitalWrite(LED_BUILTIN, HIGH) to light the LED. On this board HIGH is off.
Write LOW.
A NeoPixel sketch from another board that stays dark. Add
pinMode(NEOPIXEL_POWER, OUTPUT) and digitalWrite(NEOPIXEL_POWER, HIGH) to
setup().
Starter projects
XIAO RP2040 NeoPixel is the board across a breadboard, turning on the
NeoPixel's power with GPIO 11 and fading it around the color wheel on GPIO 12
with Adafruit_NeoPixel.
XIAO RP2040 blink is the board across a breadboard, blinking the red user LED on GPIO 17, which lights when the pin is LOW.