-
Notifications
You must be signed in to change notification settings - Fork 8.1k
boards: Add sparkfun samd21 dev breakout board #95971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
henrikbrixandersen
merged 1 commit into
zephyrproject-rtos:main
from
ricfehr3:add_sparkfun_samd21
Oct 17, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
boards/sparkfun/samd21_dev_breakout/Kconfig.sparkfun_samd21_breakout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Binary file added
BIN
+40 KB
boards/sparkfun/samd21_dev_breakout/doc/img/sparkfun_samd21_breakout.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ricfehr3 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ************************* | ||
|
|
||
ricfehr3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .. 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. | ||
ricfehr3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") |
43 changes: 43 additions & 0 deletions
43
boards/sparkfun/samd21_dev_breakout/sparkfun_samd21_breakout-pinctrl.dtsi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
131
boards/sparkfun/samd21_dev_breakout/sparkfun_samd21_breakout.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { | ||
ricfehr3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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
20
boards/sparkfun/samd21_dev_breakout/sparkfun_samd21_breakout.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.