1.. zephyr:board:: samd21_xpro
2
3Overview
4********
5
6The SAM D21 Xplained Pro evaluation kit is ideal for evaluation and
7prototyping with the SAM D21 Cortex®-M0+ processor-based
8microcontrollers. The kit includes Atmel's Embedded Debugger (EDBG),
9which provides a full debug interface without the need for additional
10hardware.
11
12Hardware
13********
14
15- SAMD21J18 ARM Cortex-M0+ processor at 48 MHz
16- 32.768 kHz crystal oscillator
17- 256 KiB flash memory and 32 KiB of RAM
18- One yellow user LED
19- One mechanical user push button
20- One reset button
21- On-board USB based EDBG unit with serial console
22
23Supported Features
24==================
25
26The samd21_xpro board configuration supports the following hardware
27features:
28
29.. list-table::
30    :header-rows: 1
31
32    * - Interface
33      - Controller
34      - Driver / Component
35    * - NVIC
36      - on-chip
37      - nested vector interrupt controller
38    * - Flash
39      - on-chip
40      - Can be used with LittleFS to store files
41    * - SYSTICK
42      - on-chip
43      - systick
44    * - WDT
45      - on-chip
46      - Watchdog
47    * - ADC
48      - on-chip
49      - Analog to Digital Converter
50    * - GPIO
51      - on-chip
52      - I/O ports
53    * - PWM
54      - on-chip
55      - Pulse Width Modulation
56    * - USART
57      - on-chip
58      - Serial ports
59    * - I2C
60      - on-chip
61      - I2C ports
62    * - SPI
63      - on-chip
64      - Serial Peripheral Interface ports
65    * - USB
66      - on-chip
67      - Universal Serial Bus device ports
68
69Other hardware features are not currently supported by Zephyr.
70
71The default configuration can be found in the Kconfig
72:zephyr_file:`boards/atmel/sam0/samd21_xpro/samd21_xpro_defconfig`.
73
74Pin Mapping
75===========
76
77The SAM D21 Xplained Pro evaluation kit has 3 GPIO controllers. These
78controllers are responsible for pin muxing, input/output, pull-up, etc.
79
80For more details please refer to `SAM D21 Family Datasheet`_ and the `SAM D21
81Xplained Pro Schematic`_.
82
83.. image:: img/ATSAMD21-XPRO-pinout.jpg
84     :align: center
85     :alt: SAMD21-XPRO-pinout
86
87Default Zephyr Peripheral Mapping:
88----------------------------------
89- SERCOM0 USART TX : PA10
90- SERCOM0 USART RX : PA11
91- SERCOM1 USART TX : PA16
92- SERCOM1 USART RX : PA19
93- SERCOM2 I2C SDA  : PA08
94- SERCOM2 I2C SCL  : PA09
95- SERCOM3 USART TX : PA22
96- SERCOM3 USART RX : PA23
97- SERCOM5 SPI MISO : PB16
98- SERCOM5 SPI MOSI : PB22
99- SERCOM5 SPI SCK  : PB23
100- USB DP           : PA25
101- USB DM           : PA24
102- GPIO SPI CS      : PB17
103- GPIO/PWM LED0    : PB30
104
105System Clock
106============
107
108The SAMD21 MCU is configured to use the 32.768 kHz external oscillator
109with the on-chip PLL generating the 48 MHz system clock.
110
111Serial Port
112===========
113
114The SAMD21 MCU has six SERCOM based USARTs with three configured as USARTs in
115this BSP. SERCOM3 is the default Zephyr console.
116
117- SERCOM0 9600 8n1
118- SERCOM1 115200 8n1
119- SERCOM3 115200 8n1 connected to the onboard Atmel Embedded Debugger (EDBG)
120
121PWM
122===
123
124The SAMD21 MCU has 3 TCC based PWM units with up to 4 outputs each and a period
125of 24 bits or 16 bits.  If :code:`CONFIG_PWM_SAM0_TCC` is enabled then LED0 is
126driven by TCC0 instead of by GPIO.
127
128SPI Port
129========
130
131The SAMD21 MCU has 6 SERCOM based SPIs. On the SAM D21 Xplained Pro,
132SERCOM5 is connected to an 8 megabit SPI flash.
133
134Programming and Debugging
135*************************
136
137The SAM D21 Xplained Pro comes with a Atmel Embedded Debugger (EDBG).  This
138provides a debug interface to the SAMD21 chip and is supported by
139OpenOCD.
140
141Flashing
142========
143
144#. Build the Zephyr kernel and the ``hello_world`` sample application:
145
146   .. zephyr-app-commands::
147      :zephyr-app: samples/hello_world
148      :board: samd21_xpro
149      :goals: build
150      :compact:
151
152#. Connect the SAM D21 Xplained Pro to your host computer using the USB debug
153   port.
154
155#. Run your favorite terminal program to listen for output. Under Linux the
156   terminal should be :code:`/dev/ttyACM0`. For example:
157
158   .. code-block:: console
159
160      $ minicom -D /dev/ttyACM0 -o
161
162   The -o option tells minicom not to send the modem initialization
163   string. Connection should be configured as follows:
164
165   - Speed: 115200
166   - Data: 8 bits
167   - Parity: None
168   - Stop bits: 1
169
170#. To flash an image:
171
172   .. zephyr-app-commands::
173      :zephyr-app: samples/hello_world
174      :board: samd21_xpro
175      :goals: flash
176      :compact:
177
178   You should see "Hello World! samd21_xpro" in your terminal.
179
180References
181**********
182
183.. target-notes::
184
185.. _Microchip Technology:
186    http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=ATSAMD21-XPRO
187
188.. _SAM D21 Family Datasheet:
189    http://ww1.microchip.com/downloads/en/DeviceDoc/SAM-D21-Family-Datasheet-DS40001882C.pdf
190
191.. _SAM D21 Xplained Pro Schematic:
192    http://ww1.microchip.com/downloads/en/DeviceDoc/SAMD21-Xplained-Pro_Design-Documentation.zip
193