1.. _seeeduino_xiao:
2
3Seeeduino XIAO
4##############
5
6Overview
7********
8
9The Seeeduino XIAO is a tiny (20 mm x 17.5 mm) ARM development
10board with onboard LEDs, USB port, and range of I/O broken out
11onto 14 pins.
12
13.. image:: img/seeeduino_xiao.jpg
14     :align: center
15     :alt: Seeeduino XIAO
16
17Hardware
18********
19
20- ATSAMD21G18A ARM Cortex-M0+ processor at 48 MHz
21- 256 KiB flash memory and 32 KiB of RAM
22- Three user LEDs
23- Native USB port
24
25Supported Features
26==================
27
28The seeeduino_xiao board configuration supports the following hardware
29features:
30
31+-----------+------------+------------------------------------------+
32| Interface | Controller | Driver/Component                         |
33+===========+============+==========================================+
34| DMA       | on-chip    | Direct memory access                     |
35+-----------+------------+------------------------------------------+
36| DAC       | on-chip    | Digital to analogue converter            |
37+-----------+------------+------------------------------------------+
38| Flash     | on-chip    | Can be used with LittleFS to store files |
39+-----------+------------+------------------------------------------+
40| GPIO      | on-chip    | I/O ports                                |
41+-----------+------------+------------------------------------------+
42| HWINFO    | on-chip    | Hardware info                            |
43+-----------+------------+------------------------------------------+
44| NVIC      | on-chip    | nested vector interrupt controller       |
45+-----------+------------+------------------------------------------+
46| SPI       | on-chip    | Serial Peripheral Interface ports        |
47+-----------+------------+------------------------------------------+
48| I2C       | on-chip    | Inter-Integrated Circuit                 |
49+-----------+------------+------------------------------------------+
50| SYSTICK   | on-chip    | systick                                  |
51+-----------+------------+------------------------------------------+
52| USART     | on-chip    | Serial ports                             |
53+-----------+------------+------------------------------------------+
54| USB       | on-chip    | USB device                               |
55+-----------+------------+------------------------------------------+
56| WDT       | on-chip    | Watchdog                                 |
57+-----------+------------+------------------------------------------+
58
59Other hardware features are not currently supported by Zephyr.
60
61The default configuration can be found in the Kconfig file
62:zephyr_file:`boards/arm/seeeduino_xiao/seeeduino_xiao_defconfig`.
63
64Connections and IOs
65===================
66
67The `Seeeduino XIAO wiki`_ has detailed information about
68the board including `pinouts`_ and the `schematic`_.
69
70System Clock
71============
72
73The SAMD21 MCU is configured to use the 32 kHz external crystal
74with the on-chip PLL generating the 48 MHz system clock.  The internal
75APB and GCLK unit are set up in the same way as the upstream Arduino
76libraries.
77
78SPI Port
79========
80
81The SAMD21 MCU has 6 SERCOM based SPIs.  On the XIAO, SERCOM0 can be put
82into SPI mode and used to connect to devices over pin 9 (MISO), pin 10
83(MOSI), and pin 8 (SCK).
84
85I2C Port
86========
87
88The SAMD21 MCU has 6 SERCOM based USARTs. On the XIAO, SERCOM2 is available on
89pin 4 (SDA) and pin 5 (SCL).
90
91Serial Port
92===========
93
94The SAMD21 MCU has 6 SERCOM based USARTs.  On the XIAO, SERCOM4 is
95the Zephyr console and is available on pins 7 (RX) and 6 (TX).
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 :ref:`usb-samples` 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
109the XIAO, the DAC is available on pin 0.
110
111Programming and Debugging
112*************************
113
114The XIAO ships the BOSSA compatible UF2 bootloader.  The bootloader can be
115entered by shorting the RST and GND pads twice.
116
117Additionally, if :code:`CONFIG_USB_CDC_ACM` is enabled then the bootloader
118will be entered automatically when you run :code:`west flash`.
119
120Flashing
121========
122
123#. Build the Zephyr kernel and the :ref:`hello_world` sample application:
124
125   .. zephyr-app-commands::
126      :zephyr-app: samples/hello_world
127      :board: seeeduino_xiao
128      :goals: build
129      :compact:
130
131#. Connect the XIAO to your host computer using USB
132
133#. Connect a 3.3 V USB to serial adapter to the board and to the
134   host.  See the `Serial Port`_ section above for the board's pin
135   connections.
136
137#. Run your favorite terminal program to listen for output. Under Linux the
138   terminal should be :code:`/dev/ttyUSB0`. For example:
139
140   .. code-block:: console
141
142      $ minicom -D /dev/ttyUSB0 -o
143
144   The -o option tells minicom not to send the modem initialization
145   string. Connection should be configured as follows:
146
147   - Speed: 115200
148   - Data: 8 bits
149   - Parity: None
150   - Stop bits: 1
151
152#. Short the RST and GND pads twice quickly to enter bootloader mode
153
154#. Flash the image:
155
156   .. zephyr-app-commands::
157      :zephyr-app: samples/hello_world
158      :board: seeeduino_xiao
159      :goals: flash
160      :compact:
161
162   You should see "Hello World! seeeduino_xiao" in your terminal.
163
164References
165**********
166
167.. target-notes::
168
169.. _Seeeduino XIAO wiki:
170    https://wiki.seeedstudio.com/Seeeduino-XIAO/
171
172.. _pinouts:
173    https://wiki.seeedstudio.com/Seeeduino-XIAO/#hardware-overview
174
175.. _schematic:
176    https://wiki.seeedstudio.com/Seeeduino-XIAO/#resourses
177