1.. _wio_terminal:
2
3Wio Terminal
4############
5
6Overview
7********
8
9The Wio Terminal is a small (72 mm x 57 mm x 12 mm) and powerful ARM board with
10wireless connectivity (2.4G/5G dual-band Wi-Fi and BLE 5.0), LCD display,
11USB C port, FPC connector, microSD card slot, Raspberry Pi compatible 40-pins
12header and 2 Grove connectors.
13
14.. image:: img/wio_terminal.png
15     :width: 500px
16     :align: center
17     :alt: Seeed Studio Wio Terminal
18
19Hardware
20********
21
22- ATSAMD51P19 ARM Cortex-M4F processor at 120 MHz
23- 512 KiB flash memory and 192 KiB of RAM
24- 4 MiB external flash
25- MicroSD card slot
26- RTL8720DN 2.4G/5G Dual Bands Wireless and BLE5.0 Combo Module
27- 2.4inch LCD display
28- LIS3DH accelerometer
29- Microphone 1.0V-10V -42dB
30- Speaker ≥78dB @10cm 4000Hz
31- Light Sensor 400-1050nm
32- Infrared Emitter 940nm
33- GPIO 40 pin (Raspberry Pi compatible)
34- 2x Grove connectors
35- 1x user LED
36- 3x user buttons
37- 5-way user button
38- Power/Reset/Boot mode switch
39- Native USB port
40
41Supported Features
42==================
43
44The wio_terminal board configuration supports the following hardware features:
45
46.. list-table::
47    :header-rows: 1
48
49    * - Interface
50      - Controller
51      - Driver / Component
52    * - NVIC
53      - on-chip
54      - Nested vector interrupt controller
55    * - Flash
56      - on-chip
57      - Can be used with LittleFS to store files
58    * - SYSTICK
59      - on-chip
60      - Systick
61    * - WDT
62      - on-chip
63      - Watchdog
64    * - GPIO
65      - on-chip
66      - I/O ports
67    * - USART
68      - on-chip
69      - Serial port
70    * - I2C
71      - on-chip
72      - Inter-Integrated Circuit
73    * - SPI
74      - on-chip
75      - Serial Peripheral Interface port
76    * - TRNG
77      - on-chip
78      - True Random Number Generator
79    * - HWINFO
80      - on-chip
81      - Unique 128 bit serial number
82    * - RTC
83      - on-chip
84      - Real-Time Counter
85    * - USB
86      - on-chip
87      - USB device
88    * - PWM
89      - on-chip
90      - PWM
91
92Other hardware features are not currently supported by Zephyr.
93
94The default configuration can be found in the Kconfig file
95:zephyr_file:`boards/arm/wio_terminal/wio_terminal_defconfig`.
96
97Zephyr can use the default Cortex-M SYSTICK timer or the SAM0 specific RTC.
98To use the RTC, set :kconfig:option:`CONFIG_CORTEX_M_SYSTICK=n` and set
99:kconfig:option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` to no more than 32 kHZ divided
100by 7, i.e. no more than 4500.
101
102Connections and IOs
103===================
104
105The `Wio Terminal Getting started guide`_ has detailed information about the
106board including `pinouts`_ and its `schematics`_.
107
108System Clock
109============
110
111The SAMD51 MCU is configured to use the 32.768 kHz internal oscillator with the
112on-chip PLL generating the 120 MHz system clock.
113
114Serial Port
115===========
116
117Zephyr console output is available using the USB connector, which is used to
118make the console available on PC as USB CDC class.
119
120USB Device Port
121===============
122
123The SAMD51 MCU has a USB device port that can be used to communicate with a
124host PC.  See the :ref:`usb-samples` sample applications for more, such as the
125:zephyr:code-sample:`usb-cdc-acm` sample which sets up a virtual serial port that echos
126characters back to the host PC.
127
128Programming and Debugging
129*************************
130
131The Wio Terminal ships with an UF2 bootloader that is BOSSA compatible. The
132bootloader can be entered by quickly tapping the reset button twice.
133
134The UF2 file is generated when building the application, and it is possible to
135use it to flash the target. Enter the bootloader by quickly sliding the power
136button twice, and copy the UF2 file to the USB mass storage device. The device
137reboots on the new firmware after the UF2 file has finished transferring.
138
139Flashing
140========
141
142#. Build the Zephyr kernel and the :code:`button` sample application:
143
144   .. zephyr-app-commands::
145      :zephyr-app: samples/basic/button
146      :board: wio_terminal
147      :goals: build
148      :compact:
149
150#. Swipe the reset/power button down twice quickly to enter bootloader mode
151
152#. Flash the image:
153
154   .. zephyr-app-commands::
155      :zephyr-app: samples/basic/button
156      :board: wio_terminal
157      :goals: flash
158      :compact:
159
160   You should see the blue (user) LED flashing whenever you press the third
161   (counting from the top left) user button at the top of the Wio Terminal.
162
163Debugging
164=========
165
166In addition to the built-in bootloader, the Wio Terminal can be flashed and
167debugged using an SWD probe such as the Segger J-Link.
168
169#.  Solder cables to the :code:`SWCLK`, :code:`SWDIO`, :code:`RESET`,
170    :code:`GND`, and :code:`3V3` pins. See `Test with SWD`_ for more
171    information.
172
173#. Connect the board to the probe by connecting the :code:`SWCLK`,
174   :code:`SWDIO`, :code:`RESET`, :code:`GND`, and :code:`3V3` pins on the
175   Wio Terminal to the :code:`SWCLK`, :code:`SWDIO`, :code:`RESET`,
176   :code:`GND`, and :code:`VTref` pins on the `J-Link`_.
177
178#. Flash the image:
179
180   .. zephyr-app-commands::
181      :zephyr-app: samples/basic/button
182      :board: wio_terminal
183      :goals: flash -r openocd
184      :compact:
185
186#. Start debugging:
187
188   .. zephyr-app-commands::
189      :zephyr-app: samples/basic/button
190      :board: wio_terminal
191      :goals: debug
192      :compact:
193
194References
195**********
196
197.. target-notes::
198
199.. _Wio Terminal Getting started guide:
200   https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/
201
202.. _pinouts:
203    https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/#pinout-diagram
204
205.. _schematics:
206    https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/#resources
207
208.. _Test with SWD:
209    https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/#test-with-swd
210
211.. _J-Link:
212    https://www.segger.com/products/debug-probes/j-link/technology/interface-description/
213