1.. _it8xxx2_evb:
2
3ITE IT8XXX2 series
4######################
5
6Overview
7********
8
9The IT8XXX2 is a 32-bit RISC-V Micro-controller.
10And a highly integrated embedded controller with system functions.
11It is suitable for mobile system applications. The picture below is
12the IT81302 MECC board (also known as it8xxx2_evb) and its debug card.
13
14.. figure:: it8xxx2_evb_and_debug_card.jpg
15     :align: center
16     :alt: IT81302 EVB
17
18To find out more about ITE, visit our World Wide Web at:`ITE's website`_
19
20Hardware
21********
22The IT8XXX2 series contains different chip types(ex, it81302, it83202),
23and they support different hardware features.
24Listing the IT81302 hardware features as following:
25
26- RISC-V RV32IMAFC instruction set
27- 4KB instruction cache size
28- 60KB SDRAM in total
29- Built-in 32.768 kHz clock generator
30- PWM, eSPI, LPC, FLASH, UART, GPIO, Timer, Watchdog, ADC, JTAG
31- 6 SMBus channels, with 3 DMA controllers, compatible with I2C
32- SPI master/slave
33- USB Type-c CC Logic
34- USB Power Delivery
35- Support KB scan
36
37
38Supported Features
39==================
40currently supports the following hardware features:
41
42.. list-table:: Supported Features
43   :header-rows: 1
44   :widths: auto
45
46   * - Interface
47     - Controller
48     - Driver/Component
49   * - NVIC
50     - on-chip
51     - interrupt controller
52   * - TIMER
53     - on-chip
54     - timer
55   * - UART
56     - on-chip
57     - serial
58   * - GPIO
59     - on-chip
60     - gpio
61   * - ADC
62     - on-chip
63     - adc
64   * - I2C
65     - on-chip
66     - i2c
67   * - KSCAN
68     - on-chip
69     - kscan
70
71
72Other hardware features are not currently supported by Zephyr.
73
74The default configuration can be found in the
75:zephyr_file:`boards/ite/it8xxx2_evb/it8xxx2_evb_defconfig` Kconfig file.
76
77Hardware reworks
78****************
79
80Before using the it8xxx2_evb, some hardware rework is needed. The HW rework
81guide can be found in ITE's website.
82https://www.ite.com.tw/upload/2024_01_15/6_20240115100309cgdjgcLzX3.pdf
83
84Programming and debugging on it83202
85************************************
86
87In order to upload the application to the device,
88you'll need our flash tool and Download board.
89You can get them at: `ITE's website`_.
90
91Wiring
92=======
93#. Connect the Download Board to your host computer using the USB cable.
94
95#. Connect the it8xxx2_evb to your host computer or a 5V1A USB power supply.
96
97#. Connect the Download Board J5 to J8 on the it8xxx2_evb board.
98
99#. Connect the USB to UART wire to it8xxx2_evb.
100
101   .. image:: it8xxx2_evb_wiring.jpg
102        :align: center
103        :alt: it8xxx2_evb wiring
104
105   .. note:: Be careful during connection!
106    Use separate wires to connect I2C pins with pins on the it8xxx2_evb board.
107    Wiring connection is described in the table below.
108
109    +-------------+---------------+
110    |   J5        | it8xxx2_evb   |
111    |   Connector | J8 Connector  |
112    +=============+===============+
113    |      2      |       1       |
114    +-------------+---------------+
115    |      3      |       3       |
116    +-------------+---------------+
117    |      4      |       5       |
118    +-------------+---------------+
119
120    For USB to UART cable, connect the it8xxx2_evb as below:
121
122    +-------------+---------------+
123    | USB to UART | it8xxx2_evb   |
124    | cable       | J5 Connector  |
125    +=============+===============+
126    |     RX      |     J5.3      |
127    +-------------+---------------+
128    |     TX      |     J5.4      |
129    +-------------+---------------+
130    |     GND     | eSPI Debug.10 |
131    +-------------+---------------+
132
133Building
134========
135
136#. Build :zephyr:code-sample:`hello_world` application as you would normally do
137   (see :`Zephyr Getting Started Guide`_):.
138
139   .. zephyr-app-commands::
140      :board: it8xxx2_evb
141      :zephyr-app: samples/hello_world
142      :goals: build
143
144#. The file :file:`zephyr.bin` will be created by west.
145
146Flashing
147========
148
149Windows
150--------
151
152Use the winflash tool to program a zephyr application
153to the it8xxx2 board flash.
154
155#. Open winflash tool and make sure the order you open the switch is right.
156   Fisrt, turn on the Download board switch.
157   Second, turn on the it8xxx2_evb board switch.
158   Then, configure your winflash tool like below.
159
160    .. figure:: WinFlashTool_P2.jpg
161          :align: center
162
163    .. figure:: WinFlashTool_P4.jpg
164
165#. Using winflash tool flash zephyr.bin into your ITE board.
166   First, click ``Load`` button and select your zephyr.bin file.
167   Second, click ``run`` to flash the iamge into board.
168
169    .. figure:: WinFlashTool_P3.jpg
170          :align: center
171
172#. At this point, you have flashed your image into ITE board and
173   it will work if you turn on ITE board. You can use a terminal program
174   to verify flashing worked correctly.
175
176   For example, open device manager to find the USB Serial Port(COM4) and use your
177   terminal program to connect it(Speed: 115200).
178
179    .. figure:: WinFlashTool_P1.jpg
180          :align: center
181
182#. Turn on the it8xxx2_evb board switch, you should see ``"Hello World! it8xxx2_evb"``
183   sent by the board. If you don't see this message, press the Reset button and the
184   message should appear.
185
186Ubuntu
187--------
188
189#. Run your favorite terminal program to listen for output.
190   Under Linux the terminal should be :code:`/dev/ttyUSB0`. Do not close it.
191
192   For example:
193
194   .. code-block:: console
195
196      $ minicom -D /dev/ttyUSB0 -b 115200
197
198#. Open a second terminal window and use linux flash tool to flash your board.
199
200   .. code-block:: console
201
202      $ sudo ~/itetool/ite -f build/zephyr/zephyr.bin
203
204   .. note:: The source code of ITE tool can be downloaded here:
205    https://www.ite.com.tw/upload/2024_01_23/6_20240123162336wu55j1Rjm4.bz2
206
207#. Split first and second terminal windows to view both of them.
208   You should see ``"Hello World! it8xxx2_evb"`` in the first terminal window.
209   If you don't see this message, press the Reset button and the message should appear.
210
211Debugging
212=========
213
214Supporting uart debug, currently.
215
216Troubleshooting
217===============
218
219#. If the flash tool reports a failure, re-plug the 8390 Download board or
220   power cycle the it8xxx2_evb board and try again.
221
222References
223==========
224
225.. target-notes::
226
227.. _ITE's website: https://www.ite.com.tw/en/product/cate2/IT81202
228.. _Zephyr Getting Started Guide: https://docs.zephyrproject.org/latest/getting_started/index.html
229