1.. _arduino_zero:
2
3Arduino/Genuino Zero
4####################
5
6Overview
7********
8
9The Arduino Zero is a maker-friendly development board with
10Atmel’s Embedded Debugger (EDBG), which provides a full
11debug interface without the need for additional hardware.
12
13.. image:: img/arduino_zero.jpg
14     :align: center
15     :alt: Arduino Zero
16
17Hardware
18********
19
20- ATSAMD21G18A ARM Cortex-M0+ processor at 48 MHz
21- 32.768 kHz crystal oscillator
22- 256 KiB flash memory and 32 KiB of RAM
23- 3 user LEDs
24- One reset button
25- On-board USB based EDBG unit with serial console
26- Native USB port
27
28Supported Features
29==================
30
31The arduino_zero board configuration supports the following hardware
32features:
33
34+-----------+------------+------------------------------------------+
35| Interface | Controller | Driver/Component                         |
36+===========+============+==========================================+
37| NVIC      | on-chip    | nested vector interrupt controller       |
38+-----------+------------+------------------------------------------+
39| Flash     | on-chip    | Can be used with LittleFS to store files |
40+-----------+------------+------------------------------------------+
41| SYSTICK   | on-chip    | systick                                  |
42+-----------+------------+------------------------------------------+
43| WDT       | on-chip    | Watchdog                                 |
44+-----------+------------+------------------------------------------+
45| GPIO      | on-chip    | I/O ports                                |
46+-----------+------------+------------------------------------------+
47| PWM       | on-chip    | Pulse Width Modulation                   |
48+-----------+------------+------------------------------------------+
49| USART     | on-chip    | Serial ports                             |
50+-----------+------------+------------------------------------------+
51| SPI       | on-chip    | Serial Peripheral Interface ports        |
52+-----------+------------+------------------------------------------+
53| USB       | on-chip    | USB device                               |
54+-----------+------------+------------------------------------------+
55| DAC       | on-chip    | Digital to analogue converter            |
56+-----------+------------+------------------------------------------+
57
58Other hardware features are not currently supported by Zephyr.
59
60The default configuration can be found in the Kconfig
61:zephyr_file:`boards/arduino/zero/arduino_zero_defconfig`.
62
63Connections and IOs
64===================
65
66The `Arduino store`_ has detailed information about board
67connections. Download the `Arduino Zero Schematic`_ for more detail.
68
69System Clock
70============
71
72The SAMD21 MCU is configured to use the 32.768 kHz external oscillator
73with the on-chip PLL generating the 48 MHz system clock.  The internal
74APB and GCLK unit are set up in the same way as the upstream Arduino
75libraries.
76
77Serial Port
78===========
79
80The SAMD21 MCU has 6 SERCOM based USARTs. One of the USARTs
81(SERCOM5) is connected to the onboard Atmel Embedded Debugger (EDBG).
82SERCOM0 is available on the D0/D1 pins.
83
84PWM
85===
86
87The SAMD21 MCU has 3 TCC based PWM units with up to 4 outputs each and a period
88of 24 bits or 16 bits.  If :code:`CONFIG_PWM_SAM0_TCC` is enabled then LED0 is
89driven by TCC2 instead of by GPIO.
90
91SPI Port
92========
93
94The SAMD21 MCU has 6 SERCOM based SPIs.  On the Arduino Zero, SERCOM4
95is available on the 6 pin connector at the edge of the board.
96
97USB Device Port
98===============
99
100The SAMD21 MCU has a USB device port that can be used to communicate
101with a host PC.  See the :zephyr:code-sample-category:`usb` sample applications for
102more, such as the :zephyr:code-sample:`usb-cdc-acm` sample which sets up a virtual
103serial port that echos characters back to the host PC.
104
105DAC
106===
107
108The SAMD21 MCU has a single channel DAC with 10 bits of resolution. On the
109Arduino Zero, the DAC is available on pin A0.
110
111Programming and Debugging
112*************************
113
114The Arduino Zero comes with a Atmel Embedded Debugger (EDBG).  This
115provides a debug interface to the SAMD21 chip and is supported by
116OpenOCD.
117
118Flashing
119========
120
121#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample application:
122
123   .. zephyr-app-commands::
124      :zephyr-app: samples/hello_world
125      :board: arduino_zero
126      :goals: build
127      :compact:
128
129#. Connect the Arduino Zero to your host computer using the USB debug
130   port.
131
132#. Run your favorite terminal program to listen for output. Under Linux the
133   terminal should be :code:`/dev/ttyACM0`. For example:
134
135   .. code-block:: console
136
137      $ minicom -D /dev/ttyACM0 -o
138
139   The -o option tells minicom not to send the modem initialization
140   string. Connection should be configured as follows:
141
142   - Speed: 115200
143   - Data: 8 bits
144   - Parity: None
145   - Stop bits: 1
146
147#. To flash an image:
148
149   .. zephyr-app-commands::
150      :zephyr-app: samples/hello_world
151      :board: arduino_zero
152      :goals: flash
153      :compact:
154
155   You should see "Hello World! arduino_zero" in your terminal.
156
157References
158**********
159
160.. target-notes::
161
162.. _Arduino Store:
163    https://store.arduino.cc/genuino-zero
164
165.. _Arduino Zero Schematic:
166    https://www.arduino.cc/en/uploads/Main/Zero_V1.0.pdf
167