Sparkfun SAMD21 Dev Breakout

Overview

The SparkFun SAMD21 dev breakout board is an arduino form factor development board. Designed to be a more powerful arduino. It shares the arduino form factor and gpio footprint. Based on the ATSAMD21G18 MCU, it runs a 32-Bit Arm Cortex-M0+ at up to 48MHz. More information can be found on the SAMD21 dev breakout specification website [1].

Hardware

  • ATSAMD21G18 32-bit/48MHz ARM Cortex-M0+

  • 256KB Flash Memory

  • 32KB SRAM

  • 32KB of EEPROM (emulated in Flash)

  • 30 GPIO Count with Arduino R3 footprint

  • 6x Configurable SERCOM ports

    • USART with full-duplex and single-wire half-duplex configuration

    • I2C up to 3.4 MHz

    • SPI

    • LIN client

  • One 12-bit, 350ksps Analog-to-Digital Converter (ADC) with up to 20 channels

    • Differential and single-ended input

    • 1/2x to 16x programmable gain stage

    • Automatic offset and gain error compensation

    • Oversampling and decimation in hardware to support 13-bit, 14-bit, 15-bit, or 16-bit resolution

  • One two-channel Inter-IC Sound (I2S) interface

  • 32-bit Real Time Counter (RTC) with clock/calendar function

  • Watchdog Timer (WDT)

  • CRC-32 generator

  • One full-speed (12 Mbps) Universal Serial Bus (USB) 2.0 interface

    • Embedded host and device function

    • Eight endpoint

Supported Features

The sparkfun_samd21_breakout board supports the hardware features listed below.

on-chip / on-board
Feature integrated in the SoC / present on the board.
2 / 2
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files.
vnd,foo
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.

sparkfun_samd21_breakout/samd21g18a target

Type

Location

Description

Compatible

CPU

on-chip

ARM Cortex-M0+ CPU1

arm,cortex-m0+

ADC

on-chip

Atmel SAM0 family ADC1

atmel,sam0-adc

ARM architecture

on-chip

Atmel SAM0 multi-protocol (UART, SPI, I2C) SERCOM unit3

atmel,sam0-sercom

on-chip

For locating the Device ID (serial number) on Atmel SAM0 devices1

atmel,sam0-id

Clock control

on-chip

Atmel SAM0 Main Clock Controller (MCLK)1

atmel,sam0-mclk

on-chip

Atmel SAMD0 Generic Clock Controller (GCLK)1

atmel,sam0-gclk

Counter

on-chip

Atmel SAM0 basic timer counter (TC) operating in 32-bit wide mode2

atmel,sam0-tc32

DAC

on-chip

Atmel SAM0 family DAC1

atmel,sam0-dac

DMA

on-chip

Atmel SAM0 DMA controller1

atmel,sam0-dmac

Flash controller

on-chip

Atmel SAM0 NVMC (Non-Volatile Memory Controller)1

atmel,sam0-nvmctrl

GPIO & Headers

on-chip

SAM0 GPIO PORT node2

atmel,sam0-gpio

I2C

on-chip

Atmel SAM0 series SERCOM I2C1

atmel,sam0-i2c

Interrupt controller

on-chip

ARMv6-M NVIC (Nested Vectored Interrupt Controller) controller1

arm,v6m-nvic

on-chip

Atmel SAM0 series External Interrupt Controller1

atmel,sam0-eic

LED

on-board

Group of GPIO-controlled LEDs1

gpio-leds

MTD

on-chip

Flash node1

soc-nv-flash

on-board

Fixed partitions of a flash (or other non-volatile storage) memory1

fixed-partitions

Pin control

on-chip

Atmel SAM0 PINMUX2

atmel,sam0-pinmux

on-chip

Atmel SAM0 Pinctrl Container1

atmel,sam0-pinctrl

RTC

on-chip

Atmel SAM0 RTC1

atmel,sam0-rtc

Serial controller

on-chip

Atmel SAM0 SERCOM UART driver1

atmel,sam0-uart

SPI

on-chip

Atmel SAM0 SERCOM SPI controller1

atmel,sam0-spi

SRAM

on-chip

Generic on-chip SRAM1

mmio-sram

Timer

on-chip

ARMv6-M System Tick1

arm,armv6m-systick

USB

on-chip

Atmel SAM0 USB in device mode1

atmel,sam0-usb

Watchdog

on-chip

Atmel SAM0 watchdog1

atmel,sam0-watchdog

Connections and IOs

LED

  • Led0 (blue) = D13

Serial IO

  • sparkfun_spi = sercom4

  • sparkfun_i2c = sercom3

  • sparkfun_serial = sercom0

  • sparkfun_dac = dac0

  • sparkfun_adc = adc

Programming and Debugging

The sparkfun_samd21_breakout board supports the runners and associated west commands listed below.

flash debug attach rtt debugserver
blackmagicprobe
bossac ✅ (default)
openocd ✅ (default)

Applications for the sparkfun_samd21_breakout/samd21g18a board target can be built, flashed, and debugged in the usual way. See Building an Application and Run an Application for more details on building and running.

Flashing

To enter flash mode, connect the board via the micro USB to the host, press the reset button twice. The onboard blue led should slowly fade, indicating flash mode.

Flashing Application

This board utilizes the UF2 bootloader, which flashes firmware via uploaded a file to board via mass-storage device. See uf2-samdx1 bootloader info [3].

Flashing Bootloader

If flashing the bootloader you can use a Jeff Probe/Black Magic Debugger to connect via SWD. Note this can also be used to recover a bricked board. Bootloader source code repo is available at: uf2-samdx1 bootloader repo [2].

Build bootloader for sparkfun samd21 dev board:

git clone https://github.com/adafruit/uf2-samdx1
cd uf2-samdx1
make BOARD=sparkfun-samd21-dev

Place commands to flash bootloader into a gdb_init file:

target extended-remote /dev/ttyACM<num> # check in dmesg
monitor swdp_scan # make sure this works too, cable could be upside down
attach 1
load

Connect the debug probe and run:

# Run gdb with your gdb_init script:
arm-none-eabi-gdb bootloader-sparkfun-samd21-dev-<bootloader-version>.elf -x gdb_init

Debugging

Using the Jeff Probe/Black Magic Debugger, you can connect SWD and run gdb through the serial connection. See above for example instructions for flashing the bootloader. Otherwise, use west to debug.

Debug with west:

west debug -r blackmagicprobe

References