The overview, with examples running, is on the board page and The XIAO SAMD21 model (every register).
The Seeed XIAO SAMD21
A board the size of a thumbnail: eleven pads, all of them analog inputs, with Serial on the chip's own USB.
What it is
The Seeed Studio XIAO SAMD21, an ATSAMD21G18A running on our own Cortex-M core in its ARMv6-M profile, the same core the Raspberry Pi Pico uses, at 48 MHz rather than 125. Firmware is a Thumb ELF talking to the real SAM D21 addresses.
The board is 21 by 17.8 mm and its two rows of seven pads are 0.6 inch apart, so it straddles a breadboard's center channel with a row free on each side.
The pins
Fourteen castellated pads, seven down each edge, with the USB-C socket at the top.
Left column: D0, D1, D2, D3, D4, D5, D6.
Right column: 5V, GND, 3V3, D10, D9, D8, D7.
Every one of the eleven I/O pads is an analog input, and A0 to A10 are
the same pads as D0 to D10; the silkscreen prints both. analogRead(A3)
and analogRead(3) are the same pin.
This is a 3.3 volt board and its pins are not 5 V tolerant. 3V3 supplies
3.3 V and 5V supplies 5 V from the USB socket.
Three LEDs are on the board and on no pad: the user LED, RX and TX. All
three are active low, so digitalWrite(LED_BUILTIN, LOW) lights the user one.
LED_BUILTIN is 13.
Three things the pinout does to you
These are the hardware, not the model, and each one catches somebody:
D0has no PWM. It is the DAC's pin and reaches no timer at all, soanalogWrite(0, x)drives it on or off at the halfway mark. Use any other pad for a fade.D4has no external interrupt. It is the chip's NMI pin, soattachInterrupt(4, ...)does nothing. AndD5andD7share one interrupt line, so only one of the two can carry a handler at a time.- Some PWM pads share a duty.
D1andD4are one compare channel, and so areD9andD5,D10andD2, andD8andD3. Writing one moves both.
Serial is the USB, and Serial1 is not
Serial is the chip's own USB device. It is what the serial monitor is
connected to, and it has no baud rate of its own: the number you pass would
reach the host as a request the host is free to ignore.
There is no USB stack under it. Mokxi models the device controller as a byte
pipe at the real endpoint registers and nothing above that: no enumeration, no
descriptors, no SETUP packets. On a real XIAO while (!Serial) {} waits for the
host to notice the board; here it returns at once. And Keyboard and Mouse, which
are the other half of what a native-USB board is for, are not available.
Serial1 is a different thing: a real USART on D6 (TX) and D7 (RX),
shifting real 8N1 frames one bit at a time. Put a jumper from D6 to D7 and a
sketch hears its own echo; set the two ends to different baud rates and the text
garbles, exactly as it does on a desk.
What is modeled
The PORT, SysTick, enough of GCLK, PM and SYSCTRL to let an Arduino-style startup run to the end, the six SERCOMs as USARTs, TCC0-2 and TC3-7 as far as PWM, the SAR ADC on all twenty channels, the EIC, and the USB as that byte pipe.
That is the set pinMode, digitalWrite, digitalRead, analogRead,
analogWrite, millis, micros, delay, attachInterrupt, Serial and
Serial1 need, at their real addresses.
What is not
The clock tree (the core simply runs at 48 MHz from the first instruction),
SPI and I2C on the SERCOMs (so no Wire and no SPI), the DAC, the
analog comparators, the touch controller, I2S, DMA, the event system, the
NVM controller, the watchdog, the RTC, and the whole of USB above a byte
pipe.
Blocks the chip has and the model does not are mapped and read zero rather than faulting, so a startup that pokes one does not crash the board.
The full list, and a plain account of which register offsets this model can state from the datasheet and which are its own reading, is in the XIAO SAMD21 model. Section 7 is the one to read before taking a build from here to real silicon.
Stock Arduino libraries
A tutorial that includes Servo.h, Wire.h, SPI.h, EEPROM.h,
LiquidCrystal_I2C.h, Adafruit_GFX.h with Adafruit_SSD1306.h and DHT.h
compiles here as it stands. Each is Mokxi's own header under the upstream name,
written on the drivers for the parts in the bin, and none of it is the upstream
library's code.
Wire.begin()puts the I2C bus onD4(SDA) andD5(SCL).EEPROM.hworks, but this board's model has no EEPROM or writable flash, so the bytes live in 4 KB of RAM: they read back within a Run and are gone at a reset.Adafruit_NeoPixel.hstops with a message: a WS2812 bit is too short to make by hand on this board, and only the ESP32-C3 and ESP32-C6 drive the strip.
The code editor and compiling lists what each one covers and how it differs from the upstream library.
The examples
Blink, Button, Serial and Analog.
Elsewhere
- The board page: /boards/xiao-samd21
- The contract document: the XIAO SAMD21 model
- The other board on the same core: the Raspberry Pi Pico