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