Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/sparkfun/micromod/doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _boardname_linkname:
.. _sparkfun_micromod:

SparkFun MicroMod board Processor
#################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright The Zephyr Project Contributors
# SPDX-License-Identifier: Apache-2.0

config BOARD_SPARKFUN_SAMD21_BREAKOUT
select SOC_SAMD21G18A
6 changes: 6 additions & 0 deletions boards/sparkfun/samd21_dev_breakout/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/bossac.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
6 changes: 6 additions & 0 deletions boards/sparkfun/samd21_dev_breakout/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: sparkfun_samd21_breakout
full_name: Sparkfun SAMD21 Dev Breakout
vendor: sparkfun
socs:
- name: samd21g18a
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
139 changes: 139 additions & 0 deletions boards/sparkfun/samd21_dev_breakout/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
.. zephyr:board:: sparkfun_samd21_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`_.

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
==================

.. zephyr::board-supported-hw::

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
*************************

.. zephyr:board-supported-runners::

Applications for the ``sparkfun_samd21_breakout/samd21g18a`` board target can be
built, flashed, and debugged in the usual way. See
:ref:`build_an_application` and :ref:`application_run` 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`_.


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`_.

Build bootloader for sparkfun samd21 dev board:

.. code-block:: console

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:

.. code-block:: console

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:

.. code-block:: console

# 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:

.. code-block:: console

west debug -r blackmagicprobe


References
**********

.. target-notes::


.. _SAMD21 dev breakout specification website: https://www.sparkfun.com/sparkfun-samd21-dev-breakout.html
.. _uf2-samdx1 bootloader repo: https://github.com/adafruit/uf2-samdx1
.. _uf2-samdx1 bootloader info: https://learn.sparkfun.com/tutorials/arm-programming/bootloaders
7 changes: 7 additions & 0 deletions boards/sparkfun/samd21_dev_breakout/pre_dt_board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright The Zephyr Project Contributors
# SPDX-License-Identifier: Apache-2.0

# Suppress "unique_unit_address_if_enabled" to handle the following overlaps:
# - /soc/pinmux@41004400 & /soc/gpio@41004400
# - /soc/pinmux@41004480 & /soc/gpio@41004480
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright The Zephyr Project Contributors
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/pinctrl/samd21-da1gXabcd-pinctrl.h>

&pinctrl {
dac_default: dac_default {
group1 {
pinmux = <PA2B_DAC_VOUT>;
};
};

sercom3_i2c_default: sercom3_i2c_default {
group1 {
pinmux = <PA22C_SERCOM3_PAD0>,
<PA23C_SERCOM3_PAD1>;
};
};

sercom4_spi_default: sercom4_spi_default {
group1 {
pinmux = <PA12D_SERCOM4_PAD0>,
<PB10D_SERCOM4_PAD2>,
<PB11D_SERCOM4_PAD3>;
};
};

sercom0_uart_default: sercom0_uart_default {
group1 {
pinmux = <PA11C_SERCOM0_PAD3>,
<PA10C_SERCOM0_PAD2>;
};
};

usb_dc_default: usb_dc_default {
group1 {
pinmux = <PA25G_USB_DP>,
<PA24G_USB_DM>;
};
};
};
131 changes: 131 additions & 0 deletions boards/sparkfun/samd21_dev_breakout/sparkfun_samd21_breakout.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* Copyright The Zephyr Project Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <atmel/samd21.dtsi>
#include <atmel/samx2xx18.dtsi>
#include "sparkfun_samd21_breakout-pinctrl.dtsi"
#include "sparkfun_samd21_breakout_connector.dtsi"

/ {
model = "Sparkfun SAMD21 Dev Breakout";
compatible = "sparkfun,samd21";

chosen {
zephyr,console = &sercom0;
zephyr,shell-uart = &sercom0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,i2c = &sercom3;
zephyr,code-partition = &code_partition;
};

leds {
compatible = "gpio-leds";

led: led_0 {
gpios = <&porta 17 GPIO_ACTIVE_HIGH>; // d13
label = "LED";
};

rx_led: led_1 {
gpios = <&portb 3 GPIO_ACTIVE_LOW>;
label = "RX_LED";
};

tx_led: led_2 {
gpios = <&porta 27 GPIO_ACTIVE_LOW>;
label = "TX_LED";
};
};

/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led;
led1 = &rx_led;
led2 = &tx_led;
};
};

&cpu0 {
clock-frequency = <48000000>;
};

&sercom0 {
status = "okay";
compatible = "atmel,sam0-uart";
current-speed = <115200>;
rxpo = <1>;
txpo = <0>;

pinctrl-0 = <&sercom0_uart_default>;
pinctrl-names = "default";
};

&sercom4 {
status = "okay";
compatible = "atmel,sam0-spi";
dipo = <1>;
dopo = <1>;
#address-cells = <1>;
#size-cells = <0>;

pinctrl-0 = <&sercom4_spi_default>;
pinctrl-names = "default";
};

&sercom3 {
status = "okay";
compatible = "atmel,sam0-i2c";
clock-frequency = <I2C_BITRATE_FAST>;
#address-cells = <1>;
#size-cells = <0>;

pinctrl-0 = <&sercom3_i2c_default>;
pinctrl-names = "default";
};

zephyr_udc0: &usb0 {
status = "okay";

pinctrl-0 = <&usb_dc_default>;
pinctrl-names = "default";
};

&dac0 {
status = "okay";

pinctrl-0 = <&dac_default>;
pinctrl-names = "default";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "uf2";
reg = <0x00000000 DT_SIZE_K(8)>;
read-only;
};

code_partition: partition@2000 {
label = "code";
reg = <0x2000 DT_SIZE_K(256-8-16)>;
read-only;
};

/*
* The final 16 KiB is reserved for the application.
* Storage partition may be used by FCB or LittleFS.
*/
storage_partition: partition@3c000 {
label = "storage";
reg = <0x0003c000 DT_SIZE_K(16)>;
};
};
};
20 changes: 20 additions & 0 deletions boards/sparkfun/samd21_dev_breakout/sparkfun_samd21_breakout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
identifier: sparkfun_samd21_breakout
name: Sparkfun SAMD21 Dev Breakout
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
flash: 256
ram: 32
supported:
- dma
- dac
- gpio
- hwinfo
- i2c
- spi
- uart
- usb_device
- watchdog
vendor: sparkfun
Loading