Skip to content

Commit 42fc3b0

Browse files
committed
add board adafruit_trrs_trinkey
1 parent 61a8648 commit 42fc3b0

11 files changed

+370
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2018 Google LLC.
2+
# Copyright (c) 2024 Gerson Fernando Budke <[email protected]>
3+
# Copyright (c) 2025 Perry Naseck, MIT Media Lab <[email protected]>
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_ADAFRUIT_TRRS_TRINKEY
7+
select SOC_SAMD21E18A
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Adafruit TRRS Trinkey board configuration
2+
3+
# Copyright (c) 2022 Embla Flatlandsmo <[email protected]>
4+
# Copyright (c) 2025 Perry Naseck, MIT Media Lab <[email protected]>
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
if BOARD_ADAFRUIT_TRRS_TRINKEY
8+
9+
source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"
10+
11+
endif # BOARD_ADAFRUIT_TRRS_TRINKEY
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2022 Gerson Fernando Budke <[email protected]>
3+
* Copyright (c) 2025 Perry Naseck, MIT Media Lab <[email protected]>
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/pinctrl/samd21-da1eXabcd-pinctrl.h>
8+
9+
&pinctrl {
10+
sercom2_i2c_default: sercom2_i2c_default {
11+
group1 {
12+
pinmux = <PA8D_SERCOM2_PAD0>,
13+
<PA9D_SERCOM2_PAD1>;
14+
};
15+
};
16+
17+
usb_dc_default: usb_dc_default {
18+
group1 {
19+
pinmux = <PA25G_USB_DP>,
20+
<PA24G_USB_DM>;
21+
};
22+
};
23+
};
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2018 Google LLC.
3+
* Copyright (c) 2025 Perry Naseck, MIT Media Lab <[email protected]>
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/dts-v1/;
9+
#include <atmel/samd21.dtsi>
10+
#include <atmel/samx2xx18.dtsi>
11+
#include <freq.h>
12+
#include "adafruit_trrs_trinkey-pinctrl.dtsi"
13+
14+
/ {
15+
model = "Adafruit TRRS Trinkey";
16+
compatible = "adafruit,trrs-trinkey", "atmel,samd21e18a", "atmel,samd21";
17+
18+
chosen {
19+
zephyr,sram = &sram0;
20+
zephyr,flash = &flash0;
21+
zephyr,code-partition = &code_partition;
22+
};
23+
24+
/* These aliases are provided for compatibility with samples */
25+
aliases {
26+
i2c-0 = &sercom2;
27+
watchdog0 = &wdog;
28+
};
29+
30+
stemma_connector: stemma_connector {
31+
compatible = "stemma-qt-connector";
32+
#gpio-cells = <2>;
33+
gpio-map-mask = <0xffffffff 0xffffffc0>;
34+
gpio-map-pass-thru = <0 0x3f>;
35+
gpio-map = <0 0 &porta 9 0>, /* SCL */
36+
<1 0 &porta 8 0>; /* SDA */
37+
};
38+
};
39+
40+
&cpu0 {
41+
clock-frequency = <DT_FREQ_M(48)>;
42+
};
43+
44+
zephyr_i2c: &sercom2 {
45+
status = "okay";
46+
compatible = "atmel,sam0-i2c";
47+
clock-frequency = <I2C_BITRATE_FAST>;
48+
#address-cells = <1>;
49+
#size-cells = <0>;
50+
51+
pinctrl-0 = <&sercom2_i2c_default>;
52+
pinctrl-names = "default";
53+
};
54+
55+
&flash0 {
56+
partitions {
57+
compatible = "fixed-partitions";
58+
#address-cells = <1>;
59+
#size-cells = <1>;
60+
61+
boot_partition: partition@0 {
62+
label = "uf2";
63+
reg = <0x00000000 DT_SIZE_K(8)>;
64+
read-only;
65+
};
66+
67+
code_partition: partition@2000 {
68+
label = "code";
69+
reg = <0x2000 DT_SIZE_K(232)>;
70+
read-only;
71+
};
72+
73+
/*
74+
* The final 16 KiB is reserved for the application.
75+
* Storage partition will be used by FCB/LittleFS/NVS
76+
* if enabled.
77+
*/
78+
storage_partition: partition@3c000 {
79+
label = "storage";
80+
reg = <0x0003c000 DT_SIZE_K(16)>;
81+
};
82+
};
83+
};
84+
85+
&wdog {
86+
status = "okay";
87+
};
88+
89+
zephyr_udc0: &usb0 {
90+
status = "okay";
91+
92+
pinctrl-0 = <&usb_dc_default>;
93+
pinctrl-names = "default";
94+
};
95+
96+
#include <../boards/common/usb/cdc_acm_serial.dtsi>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
identifier: adafruit_trrs_trinkey
2+
name: Adafruit TRRS Trinkey
3+
type: mcu
4+
arch: arm
5+
ram: 32
6+
flash: 256
7+
toolchain:
8+
- zephyr
9+
- gnuarmemb
10+
supported:
11+
- adc
12+
- counter
13+
- dma
14+
- gpio
15+
- hwinfo
16+
- pwm
17+
- spi
18+
- uart
19+
- usb_device
20+
- watchdog
21+
- zephyr_i2c
22+
vendor: adafruit
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2024 Gerson Fernando Budke <[email protected]>
2+
# Copyright (c) 2025 Perry Naseck, MIT Media Lab <[email protected]>
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
CONFIG_SOC_ATMEL_SAMD_OSC8M=y
6+
CONFIG_SOC_ATMEL_SAMD_OSC8M_AS_MAIN=y
7+
8+
CONFIG_BOOTLOADER_BOSSA=y
9+
CONFIG_BOOTLOADER_BOSSA_ADAFRUIT_UF2=y
10+
CONFIG_BUILD_OUTPUT_UF2=y
11+
CONFIG_BUILD_OUTPUT_HEX=y
12+
13+
CONFIG_CONSOLE=y
14+
CONFIG_SERIAL=y
15+
CONFIG_UART_CONSOLE=y
16+
CONFIG_UART_INTERRUPT_DRIVEN=y
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2025 Perry Naseck, MIT Media Lab <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
board_runner_args(jlink
5+
"--device=ATSAMD21E18A"
6+
"--speed=4000"
7+
)
8+
board_runner_args(openocd
9+
"--cmd-pre-init=transport select swd"
10+
"--cmd-pre-init=source [find target/at91samdXX.cfg]"
11+
)
12+
board_runner_args(pyocd
13+
"--target=ATSAMD21E18A"
14+
"--frequency=400000"
15+
)
16+
board_runner_args(uf2
17+
"--board-id=SAMD21E18A-TRRSTrinkey-v0"
18+
)
19+
20+
include(${ZEPHYR_BASE}/boards/common/bossac.board.cmake)
21+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
22+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
23+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
24+
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: adafruit_trrs_trinkey
3+
full_name: TRRS Trinkey
4+
vendor: adafruit
5+
socs:
6+
- name: samd21e18a
173 KB
Loading
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
.. zephyr:board:: adafruit_trrs_trinkey
2+
3+
Overview
4+
********
5+
6+
The Adafruit TRRS Trinkey is a small ARM development board with an onboard TRRS
7+
jack, RGB LED, USB port, and STEMMA QT port.
8+
9+
Hardware
10+
********
11+
12+
- ATSAMD21E18A ARM Cortex-M0+ processor at 48 MHz
13+
- 256 KiB flash memory and 32 KiB of RAM
14+
- Internal trimmed 8 MHz oscillator
15+
- TRRS jack
16+
- STEMMA QT I2C Port
17+
- An RGB NeoPixel LED
18+
- Native USB port
19+
- One reset button
20+
21+
Supported Features
22+
==================
23+
24+
.. zephyr:board-supported-hw::
25+
26+
Connections and IOs
27+
===================
28+
29+
The `Adafruit TRRS Trinkey Learn site`_ has detailed information about
30+
the board including `pinouts`_ and the `schematic`_.
31+
32+
System Clock
33+
============
34+
35+
The SAMD21 MCU is configured to use the 8 MHz internal oscillator
36+
with the on-chip PLL generating the 48 MHz system clock. The internal
37+
APB and GCLK unit are set up in the same way as the upstream Arduino
38+
libraries.
39+
40+
TRRS Jack
41+
=========
42+
43+
The TRRS jack is connected to the following pins of the SAMD21 MCU:
44+
45+
.. list-table::
46+
:header-rows: 1
47+
48+
* - Pin
49+
- Function
50+
51+
* - PA02 (AIN0)
52+
- Tip
53+
54+
* - PA03 (AIN1)
55+
- Tip Switch
56+
57+
* - PA04 (AIN4)
58+
- Ring 2
59+
60+
* - PA05 (AIN5)
61+
- Sleeve
62+
63+
* - PA06 (AIN6)
64+
- Ring 1
65+
66+
* - PA07 (AIN7)
67+
- Ring Switch
68+
69+
USB Serial Port
70+
===============
71+
72+
Since the TRRS Trinkey has a native USB port, and lacks dedicated UART pins,
73+
the USB CDC ACM serial port is used for console I/O.
74+
75+
STEMMA QT I2C Port
76+
==================
77+
78+
The SAMD21E MCU has 5 SERCOM-based I2C peripherals. On the TRRS Trinkey,
79+
SERCOM2 is used to drive the STEMMA QT I2C port.
80+
81+
RGB NeoPixel LED
82+
==================
83+
84+
The board has one NeoPixel WS2812B RGB LED connected to pin PA01. Unfortunately
85+
no Zephyr driver currently exists for this configuration of MCU and pin.
86+
87+
USB Device Port
88+
===============
89+
90+
The SAMD21 MCU has a USB device port that can be used to communicate
91+
with a host PC. See the :zephyr:code-sample-category:`usb` sample applications for
92+
more. Since the TRRS Trinkey doesn't have UART pins, the USB CDC ACM serial is
93+
enabled by default for console I/O.
94+
95+
Programming and Debugging
96+
*************************
97+
98+
.. zephyr:board-supported-runners::
99+
100+
The TRRS Trinkey ships the BOSSA compatible UF2 bootloader. The
101+
bootloader can be entered by quickly tapping the reset button twice.
102+
103+
Flashing
104+
========
105+
106+
#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample application:
107+
108+
.. zephyr-app-commands::
109+
:zephyr-app: samples/hello_world
110+
:board: adafruit_trrs_trinkey
111+
:goals: build
112+
:compact:
113+
114+
#. Connect the TRRS Trinkey to your host computer using USB
115+
116+
#. Run your favorite terminal program to listen for output. Under Linux the
117+
terminal should be :code:`/dev/ttyACM0`. For example:
118+
119+
.. code-block:: console
120+
121+
$ minicom -D /dev/ttyACM0 -o
122+
123+
The -o option tells minicom not to send the modem initialization
124+
string. Connection should be configured as follows:
125+
126+
- Speed: 115200
127+
- Data: 8 bits
128+
- Parity: None
129+
- Stop bits: 1
130+
131+
#. Tap the reset button twice quickly to enter bootloader mode
132+
133+
#. Flash the image:
134+
135+
.. zephyr-app-commands::
136+
:zephyr-app: samples/hello_world
137+
:board: adafruit_trrs_trinkey
138+
:goals: flash
139+
:compact:
140+
141+
You should see "Hello World! adafruit_trrs_trinkey/samd21e18a" in your terminal.
142+
143+
References
144+
**********
145+
146+
.. target-notes::
147+
148+
.. _Adafruit TRRS Trinkey Learn site:
149+
https://learn.adafruit.com/adafruit-trrs-trinkey
150+
151+
.. _pinouts:
152+
https://github.com/adafruit/Adafruit-TRRS-Trinkey-PCB/blob/main/Adafruit%20TRRS%20Trinkey%20PrettyPins.pdf
153+
154+
.. _schematic:
155+
https://learn.adafruit.com/assets/130062

0 commit comments

Comments
 (0)