1/* 2 * Copyright (c) 2019 Benjamin Valentin 3 * Copyright (c) 2019-2025 Gerson Fernando Budke <nandojve@gmail.com> 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8/dts-v1/; 9#include <atmel/samr21.dtsi> 10#include <atmel/samx2xx18.dtsi> 11#include "samr21_xpro-pinctrl.dtsi" 12#include <zephyr/dt-bindings/input/input-event-codes.h> 13 14/ { 15 model = "SAM R21 Xplained Pro"; 16 compatible = "samr21,xpro", "atmel,samr21g18a", "atmel,samr21"; 17 18 chosen { 19 zephyr,console = &sercom0; 20 zephyr,shell-uart = &sercom0; 21 zephyr,sram = &sram0; 22 zephyr,flash = &flash0; 23 zephyr,ieee802154 = &ieee802154; 24 }; 25 26 /* These aliases are provided for compatibility with samples */ 27 aliases { 28 led0 = &led0; 29 pwm-led0 = &pwm_led0; 30 sw0 = &user_button; 31 i2c-0 = &sercom1; 32 }; 33 34 leds { 35 compatible = "gpio-leds"; 36 led0: led_0 { 37 gpios = <&porta 19 GPIO_ACTIVE_LOW>; 38 label = "Yellow LED"; 39 }; 40 }; 41 42 pwmleds { 43 compatible = "pwm-leds"; 44 pwm_led0: pwm_led_0 { 45 pwms = <&tcc0 3 PWM_MSEC(20)>; 46 }; 47 }; 48 49 buttons { 50 compatible = "gpio-keys"; 51 user_button: button_0 { 52 gpios = <&porta 28 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; 53 label = "SW0"; 54 zephyr,code = <INPUT_KEY_0>; 55 }; 56 }; 57 58 ext1_header: xplained-pro-connector1 { 59 compatible = "atmel-xplained-pro-header"; 60 #gpio-cells = <2>; 61 gpio-map-mask = <0xffffffff 0xffffffc0>; 62 gpio-map-pass-thru = <0 0x3f>; /* Shared */ 63 gpio-map = <0 0 &porta 6 0>, /* ADC6 */ 64 <1 0 &porta 7 0>, /* ADC7 */ 65 <2 0 &porta 13 0>, /* GPIO */ 66 <3 0 &porta 28 0>, /* GPIO */ 67 <4 0 &porta 18 0>, /* PWM_T0_W2 */ 68 <5 0 &porta 19 0>, /* PWM_T0_W3 */ 69 <6 0 &porta 22 0>, /* GPIO */ 70 <7 0 &porta 23 0>, /* GPIO */ 71 <8 0 &porta 16 0>, /* TWD1 EXT2 */ 72 <9 0 &porta 17 0>, /* TWCK1 EXT2 */ 73 <10 0 &porta 5 0>, /* RXD0 */ 74 <11 0 &porta 4 0>, /* TXD0 */ 75 <12 0 &portb 3 0>, /* SPI5(SS) */ 76 <13 0 &portb 22 0>, /* SPI5(MOSI) EXTx */ 77 <14 0 &portb 2 0>, /* SPI5(MISO) EXTx */ 78 <15 0 &portb 23 0>; /* SPI5(SCK) EXTx */ 79 }; 80 81 ext2_header: xplained-pro-connector2 { 82 compatible = "atmel-xplained-pro-header"; 83 #gpio-cells = <2>; 84 gpio-map-mask = <0xffffffff 0xffffffc0>; 85 gpio-map-pass-thru = <0 0x3f>; /* Shared */ 86 gpio-map = /*<0 0 - - 0>, - */ 87 /*<1 0 - - 0>, - */ 88 <2 0 &porta 15 0>, /* GPIO */ 89 /*<3 0 - - 0>, - */ 90 /*<4 0 - - 0>, - */ 91 /*<5 0 - - 0>, - */ 92 /*<6 0 - - 0>, - */ 93 <7 0 &porta 8 0>, /* GPIO */ 94 <8 0 &porta 16 0>, /* TWD1 EXT1 */ 95 <9 0 &porta 17 0>, /* TWCK1 EXT1 */ 96 /*<11 0 - - 0>, - */ 97 /*<12 0 - - 0>, - */ 98 <12 0 &porta 14 0>, /* GPIO */ 99 <13 0 &portb 22 0>, /* SPI5(MOSI) EXTx */ 100 <14 0 &portb 2 0>, /* SPI5(MISO) EXTx */ 101 <15 0 &portb 23 0>; /* SPI5(SCK) EXTx */ 102 }; 103}; 104 105&cpu0 { 106 clock-frequency = <48000000>; 107}; 108 109&adc { 110 status = "okay"; 111 pinctrl-0 = <&adc_default>; 112 pinctrl-names = "default"; 113}; 114 115&tcc0 { 116 status = "okay"; 117 compatible = "atmel,sam0-tcc-pwm"; 118 prescaler = <4>; 119 #pwm-cells = <2>; 120 121 pinctrl-0 = <&pwm_default>; 122 pinctrl-names = "default"; 123}; 124 125&rtc { 126 status = "okay"; 127 counter-mode = "clock"; 128 prescaler = <1024>; 129}; 130 131&sercom0 { 132 status = "okay"; 133 compatible = "atmel,sam0-uart"; 134 current-speed = <115200>; 135 rxpo = <1>; 136 txpo = <0>; 137 138 pinctrl-0 = <&sercom0_uart_default>; 139 pinctrl-names = "default"; 140}; 141 142&sercom1 { 143 status = "okay"; 144 compatible = "atmel,sam0-i2c"; 145 clock-frequency = <I2C_BITRATE_FAST>; 146 #address-cells = <1>; 147 #size-cells = <0>; 148 149 pinctrl-0 = <&sercom1_i2c_default>; 150 pinctrl-names = "default"; 151}; 152 153&sercom4 { 154 status = "okay"; 155 compatible = "atmel,sam0-spi"; 156 /* 157 * CS-PB31; MOSI-PB30; MISO-PC19; SCLK-PC18 158 * PAD[1]; PAD[2]; PAD[0]; PAD[3] 159 */ 160 dipo = <0>; 161 dopo = <1>; 162 #address-cells = <1>; 163 #size-cells = <0>; 164 165 pinctrl-0 = <&sercom4_spi_default>; 166 pinctrl-names = "default"; 167 168 cs-gpios = <&portb 31 GPIO_ACTIVE_LOW>; 169 170 ieee802154: rf2xx@0 { 171 compatible = "atmel,rf2xx"; 172 reg = <0x0>; 173 spi-max-frequency = <6000000>; 174 irq-gpios = <&portb 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; 175 reset-gpios = <&portb 15 GPIO_ACTIVE_LOW>; 176 slptr-gpios = <&porta 20 GPIO_ACTIVE_HIGH>; 177 dig2-gpios = <&portb 17 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; 178 status = "okay"; 179 tx-pwr-min = [01 11]; /* -17.0 dBm */ 180 tx-pwr-max = [00 04]; /* 4.0 dBm */ 181 tx-pwr-table = [00 01 03 04 05 05 06 06 182 07 07 07 08 08 09 09 0a 183 0a 0a 0b 0b 0b 0b 0c 0c 184 0c 0c 0d 0d 0d 0d 0d 0d 185 0d 0d 0e 0e 0e 0e 0e 0e 186 0e 0e 0e 0e 0e 0e 0f 0f]; 187 }; 188}; 189 190&sercom5 { 191 status = "okay"; 192 compatible = "atmel,sam0-spi"; 193 dipo = <0>; 194 dopo = <2>; 195 #address-cells = <1>; 196 #size-cells = <0>; 197 198 pinctrl-0 = <&sercom5_spi_default>; 199 pinctrl-names = "default"; 200}; 201 202zephyr_udc0: &usb0 { 203 status = "okay"; 204 205 pinctrl-0 = <&usb_dc_default>; 206 pinctrl-names = "default"; 207}; 208 209ext1_spi: &sercom5 { 210}; 211 212ext1_i2c: &sercom1 { 213}; 214 215ext1_serial: &sercom0 { 216}; 217 218ext2_spi: &sercom5 { 219}; 220 221ext2_i2c: &sercom1 { 222}; 223 224&flash0 { 225 partitions { 226 compatible = "fixed-partitions"; 227 #address-cells = <1>; 228 #size-cells = <1>; 229 230 /* 231 * The final 16 KiB is reserved for the application. 232 * Storage partition will be used by FCB/LittleFS/NVS 233 * if enabled. 234 */ 235 storage_partition: partition@3c000 { 236 label = "storage"; 237 reg = <0x0003c000 0x00004000>; 238 }; 239 }; 240}; 241