1.. zephyr:board:: saml21_xpro
2
3Overview
4********
5
6The SAM L21 Xplained Pro evaluation kit is ideal for evaluation and
7prototyping with the SAM L21 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- SAML21J18 ARM Cortex-M0+ processor at 48 MHz
16- 32.768 kHz crystal oscillator
17- 256 KiB flash memory, 32 KiB of SRAM, 8KB Low Power SRAM
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 saml21_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    * - GPIO
48      - on-chip
49      - I/O ports
50    * - PWM
51      - on-chip
52      - Pulse Width Modulation
53    * - USART
54      - on-chip
55      - Serial ports
56    * - I2C
57      - on-chip
58      - I2C ports
59    * - SPI
60      - on-chip
61      - Serial Peripheral Interface ports
62    * - TRNG
63      - on-chip
64      - True Random Number Generator
65
66Other hardware features are not currently supported by Zephyr.
67
68The default configuration can be found in the Kconfig
69:zephyr_file:`boards/atmel/sam0/saml21_xpro/saml21_xpro_defconfig`.
70
71Pin Mapping
72===========
73
74The SAM L21 Xplained Pro evaluation kit has 2 GPIO controllers. These
75controllers are responsible for pin muxing, input/output, pull-up, etc.
76
77For more details please refer to `SAM L21 Family Datasheet`_ and the `SAM L21
78Xplained Pro Schematic`_.
79
80.. image:: img/atsaml21-xpro-pinout.jpg
81     :align: center
82     :alt: SAML21-XPRO-pinout
83
84Default Zephyr Peripheral Mapping:
85----------------------------------
86- SERCOM0 SPI MISO : PA04
87- SERCOM0 SPI MOSI : PA06
88- SERCOM0 SPI SCK  : PA07
89- SERCOM1 USART TX : PA18
90- SERCOM1 USART RX : PA19
91- SERCOM2 I2C SDA  : PA08
92- SERCOM2 I2C SCL  : PA09
93- SERCOM3 USART TX : PA22
94- SERCOM3 USART RX : PA23
95- SERCOM4 USART TX : PB08
96- SERCOM4 USART RX : PB09
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    : PB10
104
105System Clock
106============
107
108The SAML21 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 SAML21 MCU has six SERCOM based USARTs with two configured as USARTs in
115this BSP. SERCOM3 is the default Zephyr console.
116
117- SERCOM1 115200 8n1 - connected to EXT2 and EXT3
118- SERCOM3 115200 8n1 - connected to the onboard Atmel Embedded Debugger (EDBG)
119- SERCOM4 115200 8n1 - connected to EXT1
120
121PWM
122===
123
124The SAML21 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 SAML21 MCU has 6 SERCOM based SPIs, with two configured as SPI in this BSP.
132
133- SERCOM0 - connected to EXT1
134- SERCOM5 - connected to EXT2 and EXT3
135
136Programming and Debugging
137*************************
138
139The SAM L21 Xplained Pro comes with a Atmel Embedded Debugger (EDBG).  This
140provides a debug interface to the SAML21 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: saml21_xpro
151      :goals: build
152      :compact:
153
154#. Connect the SAM L21 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      $ picocom -b 115200 /dev/ttyACM0
163
164   - Speed: 115200
165   - Data: 8 bits
166   - Parity: None
167   - Stop bits: 1
168
169#. To flash an image:
170
171   .. zephyr-app-commands::
172      :zephyr-app: samples/hello_world
173      :board: saml21_xpro
174      :goals: flash
175      :compact:
176
177   You should see "Hello World! saml21_xpro" in your terminal.
178
179References
180**********
181
182.. target-notes::
183
184.. _Microchip website:
185    https://www.microchip.com/en-us/development-tool/atsaml21-xpro-b
186
187.. _SAM L21 Family Datasheet:
188    https://ww1.microchip.com/downloads/en/DeviceDoc/SAM_L21_Family_DataSheet_DS60001477C.pdf
189
190.. _SAM L21 Xplained Pro Schematic:
191    https://ww1.microchip.com/downloads/en/DeviceDoc/SAML21-Xplained-Pro_Design-Documentation.zip
192