1.. _arduino_mkrzero:
2
3Arduino MKR Zero
4####################
5
6Overview
7********
8
9The Arduino MKR Zero built with smaller MKR form factor and powered by Atmel's SAMD21 MCU.
10This board come with microSD card holder that allows you to play with music files with no extra hardware.
11
12.. image:: img/arduino_mkrzero.jpg
13     :align: center
14     :alt: Arduino MKR Zero
15
16Hardware
17********
18
19- ATSAMD21G18A ARM Cortex-M0+ processor at 48 MHz
20- 32.768 kHz crystal oscillator
21- 256 KiB flash memory and 32 KiB of RAM
22- One user LEDs
23- One reset button
24- microSD card slot
25- ATECC508A secure element
26
27Supported Features
28==================
29
30The arduino_mkrzero board configuration supports the following hardware
31features:
32
33+-----------+------------+------------------------------------------+
34| Interface | Controller | Driver/Component                         |
35+===========+============+==========================================+
36| ADC       | on-chip    | Analog to digital converter              |
37+-----------+------------+------------------------------------------+
38| COUNTER   | on-chip    | Pulse counter                            |
39+-----------+------------+------------------------------------------+
40| DMA       | on-chip    | Direct memory access unit                |
41+-----------+------------+------------------------------------------+
42| Flash     | on-chip    | Can be used with LittleFS to store files |
43+-----------+------------+------------------------------------------+
44| GPIO      | on-chip    | I/O ports                                |
45+-----------+------------+------------------------------------------+
46| HWINFO    | on-chip    | Hardware info and serial number          |
47+-----------+------------+------------------------------------------+
48| NVIC      | on-chip    | nested vector interrupt controller       |
49+-----------+------------+------------------------------------------+
50| PWM       | on-chip    | Pulse Width Modulation                   |
51+-----------+------------+------------------------------------------+
52| SPI       | on-chip    | Serial Peripheral Interface ports        |
53+-----------+------------+------------------------------------------+
54| I2C       | on-chip    | Inter-Integrated Circuit ports           |
55+-----------+------------+------------------------------------------+
56| SYSTICK   | on-chip    | systick                                  |
57+-----------+------------+------------------------------------------+
58| USART     | on-chip    | Serial ports                             |
59+-----------+------------+------------------------------------------+
60| USB       | on-chip    | USB device                               |
61+-----------+------------+------------------------------------------+
62| WDT       | on-chip    | Watchdog                                 |
63+-----------+------------+------------------------------------------+
64
65
66Other hardware features are not currently supported by Zephyr.
67
68The default configuration can be found in the Kconfig
69:zephyr_file:`boards/arduino/mkrzero/arduino_mkrzero_defconfig`.
70
71Connections and IOs
72===================
73
74The `Arduino store`_ has detailed information about board
75connections. Download the `Arduino MKR Zero Schematic`_ for more detail.
76
77System Clock
78============
79
80The SAMD21 MCU is configured to use the 32.768 kHz external oscillator
81with the on-chip PLL generating the 48 MHz system clock.  The internal
82APB and GCLK unit are set up in the same way as the upstream Arduino
83libraries.
84
85Serial Port
86===========
87
88The SAMD21 MCU has 6 SERCOM based USARTs. SERCOM5 is available on pins 13(PA23) and 14(PA22).
89
90PWM
91===
92
93The SAMD21 MCU has 3 TCC based PWM units with up to 4 outputs each and a period
94of 24 bits or 16 bits.
95
96SPI Port
97========
98
99The SAMD21 MCU has 6 SERCOM based SPIs.  On the Arduino MKR Zero, SERCOM1
100is available on pin 8, 9, and 10.
101SERCOM2 connect to microSD card slot as SPI interface.
102
103I2C Port
104========
105
106The SAMD21 MCU has 6 SERCOM based I2Cs. SERCOM0 is available on pin 11(PA08) and 12(PA09).
107This I2C bus also available as ESLOV(JST SH 5pin) socket.
108ATECC508A secure element is connect to this I2C bus.
109
110USB Device Port
111===============
112
113The SAMD21 MCU has a USB device port that can be used to communicate
114with a host PC.  See the :zephyr:code-sample-category:`usb` sample applications for
115more, such as the :zephyr:code-sample:`usb-cdc-acm` sample which sets up a virtual
116serial port that echos characters back to the host PC.
117
118DAC
119===
120
121The SAMD21 MCU has a single channel DAC with 10 bits of resolution. On the
122Arduino MKR Zero, the DAC is available on pin A0.
123
124Programming and Debugging
125*************************
126
127The Arduino MKR Zero ships the BOSSA compatible bootloader.  The
128bootloader can be entered by quickly tapping the reset button twice.
129
130Flashing
131========
132
133#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample application:
134
135   .. zephyr-app-commands::
136      :zephyr-app: samples/hello_world
137      :board: arduino_mkrzero
138      :goals: build
139      :compact:
140
141#. Connect the MKR Zero to your host computer using USB
142
143#. Connect a 3.3 V USB to serial adapter to the board and to the
144   host.  See the `Serial Port`_ section above for the board's pin
145   connections.
146
147#. Run your favorite terminal program to listen for output. Under Linux the
148   terminal should be :code:`/dev/ttyACM0`. For example:
149
150   .. code-block:: console
151
152      $ minicom -D /dev/ttyACM0 -o
153
154   The -o option tells minicom not to send the modem initialization
155   string. Connection should be configured as follows:
156
157   - Speed: 115200
158   - Data: 8 bits
159   - Parity: None
160   - Stop bits: 1
161
162#. Tap the reset button twice quickly to enter bootloader mode
163
164#. Flash the image:
165
166   .. zephyr-app-commands::
167      :zephyr-app: samples/hello_world
168      :board: arduino_mkrzero
169      :goals: flash
170      :compact:
171
172   You should see "Hello World! arduino_mkrzero" in your terminal.
173
174References
175**********
176
177.. target-notes::
178
179.. _Arduino Store:
180    https://store.arduino.cc/collections/boards/products/arduino-mkr-zero-i2s-bus-sd-for-sound-music-digital-audio-data
181
182.. _Arduino MKR Zero Schematic:
183    https://www.arduino.cc/en/uploads/Main/ArduinoMKRZero-schematic.pdf
184