Board

Seeed XIAO SAMD21 simulator, all eleven pads analog

The XIAO SAMD21 is the smallest board here: 21 by 17.8 mm, an ATSAMD21G18A at 48 MHz, and eleven castellated pads of which every single one is an analog input. Serial is the chip’s own USB; Serial1 is a real USART on D6 and D7.

Start building free
  • 8peripheral areas modeled
  • 4projects ready to run
  • Real timeon your own machine
Seeed XIAO SAMD21: blinklive0.000 s 0.00x
Click to open it in the editor
The board is running real firmware right now. Click it to open the circuit in the editor.
The model

What is modeled

Taken from the board's own contract document and put in plain words, with what is missing beside it.

Modeled

Core
Cortex-M0+ (ARMv6-M) at 48 MHz, with the datasheet cycle count of every instruction
PORT
Both groups, with DIR, OUT, IN, PINCFG, PMUX and WRCONFIG, including the rule that OUT picks an input’s pull direction
SysTick
A one-millisecond reload under millis(), and a delay() that parks the core in WFI between ticks
SERCOM
USART mode on all six, shifting real 8N1 frames a bit at a time; SERCOM4 on D6 and D7 is Serial1
TCC and TC
TCC0-2 and TC3-7 as far as PWM, so analogWrite works on ten of the eleven pads at 732 Hz
ADC
Twelve bits against the 3.3 V rail on all twenty channels, so every pad reads a voltage
EIC
Sixteen external interrupt lines with edge and level sensing, which is what attachInterrupt uses
USB
A byte pipe at the real endpoint registers and the real descriptor table: enough for a serial port, and nothing above it

Not modeled

  • The USB stack. No enumeration, no descriptors, no SETUP. `while (!Serial)` returns at once here and waits on a desk, and Keyboard and Mouse are not available at all.
  • The clock tree. The core runs at 48 MHz from the first instruction; GCLK, PM and SYSCTRL exist so a real startup runs to the end, and nothing is gated on them.
  • SPI and I2C on the SERCOMs, so no Wire and no SPI. The DAC, the analog comparators, the touch controller and I2S are absent too.
  • DMA, the event system, the NVM controller, the watchdog and the RTC. Their blocks read zero rather than faulting.
  • Two things the contract marks believed rather than verified: the TC block’s register offsets, and the peripheral multiplexing table that says which timer each pad can reach. Section 7 names both.
Start here

Open one and press Run

Each of these opens in the editor exactly as it is drawn here.

Projects

Every built-in project on the XIAO SAMD21

Each has its own page with the circuit running, the code and a parts list.

Libraries

Arduino libraries that compile as they are

Paste a tutorial that includes one of these and it builds. For any other library, the build names the Mokxi header that does the same job.

Servo.h
attach, write, writeMicroseconds, read, detach, on any pin
Wire.h
I2C as a master; Wire.begin() puts it on D4 (SDA) and D5 (SCL)
SPI.h
transfer and transactions, on the board’s usual SPI pins
EEPROM.h
read, write, update, get, put and EEPROM[i], kept in 4 KB of RAM, which a reset clears: this board has no EEPROM to write
LiquidCrystal_I2C.h
the 16x2 LCD behind its I2C backpack
Adafruit_GFX.h and Adafruit_SSD1306.h
the 128x64 I2C OLED: text, pixels, lines, rectangles, circles, triangles and bitmaps
DHT.h
the DHT11 and DHT22: temperature, humidity and the heat index, as floats you can print
OneWire.h and DallasTemperature.h
DS18B20 thermometers, any number on one pin, found by the 1-Wire search

And 14 more, 22 in all: Adafruit_BME280.h, Adafruit_BMP280.h and SparkFunBME280.h; RTClib.h; Adafruit_SHT31.h; Adafruit_PCF8591.h; Adafruit_ADXL345_U.h; LedControl.h; Adafruit_LEDBackpack.h; Adafruit_TCS34725.h; Adafruit_SGP30.h; Adafruit_INA219.h; Adafruit_ADS1X15.h; Adafruit_MCP23X17.h; Bounce2.h; HX711.h.

Questions

Is it free?

Yes. Every board and every part is on the free plan, with no account needed.

Is every pad really an analog input?

Yes. A0 to A10 are the same pads as D0 to D10 and the silkscreen prints both, so analogRead(A3) and analogRead(3) are the same pin.

Why does analogWrite do nothing on D0?

Because D0 is PA02, the DAC’s pin, and it reaches no timer at all. That is the chip, not the model: the runtime drives the pad on or off at the halfway mark rather than pretending to fade.

Can it act as a keyboard?

Not here. Keyboard and Mouse need the USB stack above the byte pipe, and the model says plainly that it does not have one.

Will my firmware run on a real XIAO?

The core, the PORT, the SERCOMs, the ADC and the EIC will. Two things are believed rather than verified (the TC register offsets and the pad multiplexing table), and section 7 of the contract is the short list to check. You will also need to relink at 0x2000 to go in over the UF2 bootloader.

Try it on your own firmware

What you build here runs on the board on your desk, unchanged. Nothing to install and no account needed.