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