1.. _hsdk4xd:
2
3DesignWare(R) ARC(R) HS4x/HS4xD Development Kit
4###############################################
5
6Overview
7********
8
9The ARC HS4x/HS4xD Development Kit is the next revision of :ref:`Synopsys HSDK board <hsdk>`.
10It includes a multicore ARC HS4xD-based chip that integrates a wide range of interfaces
11including Ethernet, HDMI, WiFi, Bluetooth, USB, SDIO, I2C, SPI, UART, I2S, ADC, PWM and GPIO,
12as well as a Think Silicon GPU.
13
14.. image:: hsdk4xd.jpg
15   :align: center
16   :alt: DesignWare(R) ARC(R) HS4x/HS4xD Development Kit (synopsys.com)
17
18For details about the board, see: `ARC HS4x/HS4xD Development Kit
19(HSDK4xD) <https://www.synopsys.com/dw/ipdir.php?ds=arc-hs-development-kit>`__
20
21Hardware
22********
23
24The ARC HSDK4xD has 24 general GPIOs, which divided into 8 groups named from ``GPIO_SEL_0`` to ``GPIO_SEL_7``.
25Each sel can configured for different functions, such as: GPIO, UART, SPI, I2C and PWM. We can program
26``CREG_GPIO_MUX`` register to do configuration for each sel. Tables below show the bit definition for
27``CREG_GPIO_MUX`` register and the details configuration for each pin.
28
29+--------+-------------+---------+--------------+---------------------------------+
30| Bit    | Name        | Access  | Reset value  | Description                     |
31+--------+-------------+---------+--------------+---------------------------------+
32| 2:0    | GPIO_SEL_0  | RW      | 0x0          | GPIO mux select for gpio[3:0]   |
33+--------+-------------+---------+--------------+---------------------------------+
34| 5:3    | GPIO_SEL_1  | RW      | 0x0          | GPIO mux select for gpio[7:4]   |
35+--------+-------------+---------+--------------+---------------------------------+
36| 8:6    | GPIO_SEL_2  | RW      | 0x0          | GPIO mux select for gpio[11:8]  |
37+--------+-------------+---------+--------------+---------------------------------+
38| 11:9   | GPIO_SEL_3  | RW      | 0x0          | GPIO mux select for gpio[15:12] |
39+--------+-------------+---------+--------------+---------------------------------+
40| 14:12  | GPIO_SEL_4  | RW      | 0x0          | GPIO mux select for gpio[17:16] |
41+--------+-------------+---------+--------------+---------------------------------+
42| 17:15  | GPIO_SEL_5  | RW      | 0x0          | GPIO mux select for gpio[19:18] |
43+--------+-------------+---------+--------------+---------------------------------+
44| 20:18  | GPIO_SEL_6  | RW      | 0x0          | GPIO mux select for gpio[21:20] |
45+--------+-------------+---------+--------------+---------------------------------+
46| 23:21  | GPIO_SEL_7  | RW      | 0x0          | GPIO mux select for gpio[23:22] |
47+--------+-------------+---------+--------------+---------------------------------+
48
49+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
50| SELS | GPIO PINS | FUN0     | FUN1      | FUN2       | FUN3     | FUN4      | FUN5        | FUN6      | FUN7        |
51+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
52| SEL0 | 0         | gpio[0]  | uart0_cts | spi1_cs[0] | gpio[0]  | gpio[0]   | pwm_ch[6]   | pwm_ch[6] | pwm_ch[1]   |
53|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
54|      | 1         | gpio[1]  | uart0_txd | spi1_mosi  | gpio[1]  | pwm_ch[0] | gpio[1]     | pwm_ch[0] | pwm_ch[0]   |
55|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
56|      | 2         | gpio[2]  | uart0_rxd | spi1 _miso | i2c1_scl | gpio[2]   | gpio[2]     | gpio[2]   | gpio[2]     |
57|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
58|      | 3         | gpio[3]  | uart0_rts | spi1_clk   | i2c1_sda | gpio[3]   | gpio[3]     | gpio[3]   | gpio[3]     |
59+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
60| SEL1 | 4         | gpio[4]  | uart1_cts | spi2_cs[0] | gpio[4]  | gpio[4]   | pwm_ch[4]   | pwm_ch[4] | pwm_ch[3]   |
61|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
62|      | 5         | gpio[5]  | uart1_txd | spi2_mosi  | gpio[5]  | pwm_ch[2] | gpio[5]     | pwm_ch[2] | pwm_ch[2]   |
63|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
64|      | 6         | gpio[6]  | uart1_rxd | spi2_miso  | i2c2_scl | gpio[6]   | gpio[6]     | gpio[6]   | gpio[6]     |
65|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
66|      | 7         | gpio[7]  | uart1_rts | spi2_clk   | i2c2_sda | gpio[7]   | gpio[7]     | gpio[7]   | gpio[7]     |
67+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
68| SEL2 | 8         | gpio[8]  | uart2_cts | spi1_cs[1] | gpio[8]  | gpio[8]   | pwm_ch[2]   | pwm_ch[2] | pwm_ch[5]   |
69|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
70|      | 9         | gpio[9]  | uart2_txd | spi1_mosi  | gpio[9]  | pwm_ch[4] | gpio[9]     | pwm_ch[4] | pwm_ch[4]   |
71|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
72|      | 10        | gpio[10] | uart2_rxd | spi1_miso  | i2c1_scl | gpio[10]  | gpio[10]    | gpio[10]  | gpio[10]    |
73|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
74|      | 11        | gpio[11] | uart2_rts | spi1_clk   | i2c1_sda | gpio[11]  | gpio[11]    | gpio[11]  | gpio[11]    |
75+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
76| SEL3 | 12        | gpio[12] | uart0_cts | spi2_cs[1] | gpio[12] | gpio[12]  | pwm_ch[0]   | pwm_ch[0] | pwm_ch[7]   |
77|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
78|      | 13        | gpio[13] | uart0_txd | spi2_mosi  | gpio[13] | pwm_ch[6] | gpio[13]    | pwm_ch[6] | pwm_ch[6]   |
79|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
80|      | 14        | gpio[14] | uart0_rxd | spi2_miso  | i2c2_scl | gpio[14]  | gpio[14]    | gpio[14]  | gpio[14]    |
81|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
82|      | 15        | gpio[15] | uart0_rts | spi2_clk   | i2c2_sda | gpio[15]  | gpio[15]    | gpio[15]  | gpio[15]    |
83+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
84| SEL4 | 16        | gpio[16] | uart1_txd | spi1_cs[2] | i2c1_scl | gpio[16]  | pwm_fault_0 | gpio[16]  | pwm_fault_0 |
85|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
86|      | 17        | gpio[17] | uart1_rxd | spi1_mosi  | i2c1_sda | pwm_ch[0] | pwm_ch[0]   | pwm_ch[5] | pwm_ch[5]   |
87+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
88| SEL5 | 18        | gpio[18] | uart2_txd | spi1_miso  | i2c2_scl | gpio[18]  | gpio[18]    | gpio[18]  | gpio[18]    |
89|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
90|      | 19        | gpio[19] | uart2_rxd | spi1_clk   | i2c2_sda | gpio[19]  | gpio[19]    | gpio[19]  | gpio[19]    |
91+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
92| SEL6 | 20        | gpio[20] | uart0_txd | spi2_cs[2] | i2c1_scl | gpio[20]  | pwm_fault_1 | gpio[20]  | pwm_fault_1 |
93|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
94|      | 21        | gpio[21] | uart0_rxd | spi2_mosi  | i2c1_sda | pwm_ch[6] | pwm_ch[6]   | pwm_ch[3] | pwm_ch[3]   |
95+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
96| SEL7 | 22        | gpio[22] | uart2_txd | spi2_miso  | i2c2_scl | gpio[22]  | gpio[22]    | gpio[22]  | gpio[22]    |
97|      +-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
98|      | 23        | gpio[23] | uart2_rxd | spi2_clk   | i2c2_sda | gpio[23]  | gpio[23]    | gpio[23]  | gpio[23]    |
99+------+-----------+----------+-----------+------------+----------+-----------+-------------+-----------+-------------+
100
101Digilent Pmod
102=============
103
104The ARC HSDK4xD features two 12-pin Pmod connectors ``Pmod_A`` and ``Pmod_B`` and one 6-pin Pmod connector ``Pmod_C``.
105The functionality of the Pmod connectors is programmable and includes GPIO, UART, SPI, I2C and PWM.
106The location of the pins on the Pmod connectors is shown in Figure below. Detailed pin descriptions
107depending on the pin multiplexer settings are provided in the subsequent sections.
108
109.. image:: pinout_diagram_of_the_pmod.jpg
110   :align: center
111   :alt: Pinout Diagram of the Pmod
112
113Pmod_A Connector
114----------------
115
116Table below lists the pin assignment of valid protocols that can be multiplexed on the ``Pmod_A``
117connector. The GPIO column is the default assignment after Reset.
118
119+------+-----------+------------+-------------+-----------+------------+-----------+
120| Pin  | GPIO      | UART       | SPI         | I2C       | PWM_1      | PWM_2     |
121+------+-----------+------------+-------------+-----------+------------+-----------+
122| A1   | gpio[8]   | uart2_cts  | spi1_cs[1]  | gpio[8]   | gpio[8]    | pwm_ch[2] |
123+------+-----------+------------+-------------+-----------+------------+-----------+
124| A2   | gpio[9]   | uart2_txd  | spi1_mosi   | gpio[9]   | pwm_ch[4]  | gpio[9]   |
125+------+-----------+------------+-------------+-----------+------------+-----------+
126| A3   | gpio[10]  | uart2_rxd  | spi1_miso   | i2c1_scl  | gpio[10]   | gpio[10]  |
127+------+-----------+------------+-------------+-----------+------------+-----------+
128| A4   | gpio[11]  | uart2_rts  | spi1_clk    | i2c1_sda  | gpio[11]   | gpio[11]  |
129+------+-----------+------------+-------------+-----------+------------+-----------+
130| A5   | GND       | GND        | GND         | GND       | GND        | GND       |
131+------+-----------+------------+-------------+-----------+------------+-----------+
132| A6   | 3V3       | 3V3        | 3V3         | 3V3       | 3V3        | 3V3       |
133+------+-----------+------------+-------------+-----------+------------+-----------+
134| A7   | gpio[20]  | gpio[20]   | gpio[20]    | gpio[20]  | gpio[20]   | gpio[20]  |
135+------+-----------+------------+-------------+-----------+------------+-----------+
136| A8   | gpio[21]  | gpio[21]   | gpio[21]    | gpio[21]  | gpio[21]   | gpio[21]  |
137+------+-----------+------------+-------------+-----------+------------+-----------+
138| A9   | n.c.      | n.c.       | n.c.        | n.c.      | n.c.       | n.c.      |
139+------+-----------+------------+-------------+-----------+------------+-----------+
140| A10  | n.c.      | n.c.       | n.c.        | n.c.      | n.c.       | n.c.      |
141+------+-----------+------------+-------------+-----------+------------+-----------+
142| A11  | GND       | GND        | GND         | GND       | GND        | GND       |
143+------+-----------+------------+-------------+-----------+------------+-----------+
144| A12  | 3V3       | 3V3        | 3V3         | 3V3       | 3V3        | 3V3       |
145+------+-----------+------------+-------------+-----------+------------+-----------+
146
147Pmod_B Connector
148----------------
149
150Table below lists the pin assignment of valid protocols that can be multiplexed on the ``Pmod_B``
151connector. The GPIO column is the default assignment after Reset.
152
153+------+-----------+------------+-------------+-----------+------------+-----------+
154| Pin  | GPIO      | UART       | SPI         | I2C       | PWM_1      | PWM_2     |
155+------+-----------+------------+-------------+-----------+------------+-----------+
156| B1   | gpio[12]  | uart0_cts  | spi2_cs[1]  | gpio[12]  | gpio[12]   | pwm_ch[0] |
157+------+-----------+------------+-------------+-----------+------------+-----------+
158| B2   | gpio[13]  | uart0_txd  | spi2_mosi   | gpio[13]  | pwm_ch[6]  | gpio[13]  |
159+------+-----------+------------+-------------+-----------+------------+-----------+
160| B3   | gpio[14]  | uart0_rxd  | spi2_miso   | i2c2_scl  | gpio[14]   | gpio[14]  |
161+------+-----------+------------+-------------+-----------+------------+-----------+
162| B4   | gpio[15]  | uart0_rts  | spi2_clk    | i2c2_sda  | gpio[15]   | gpio[15]  |
163+------+-----------+------------+-------------+-----------+------------+-----------+
164| B5   | GND       | GND        | GND         | GND       | GND        | GND       |
165+------+-----------+------------+-------------+-----------+------------+-----------+
166| B6   | 3V3       | 3V3        | 3V3         | 3V3       | 3V3        | 3V3       |
167+------+-----------+------------+-------------+-----------+------------+-----------+
168| B7   | gpio[22]  | gpio[22]   | gpio[22]    | gpio[22]  | gpio[22]   | gpio[22]  |
169+------+-----------+------------+-------------+-----------+------------+-----------+
170| B8   | gpio[23]  | gpio[23]   | gpio[23]    | gpio[23]  | gpio[23]   | gpio[23]  |
171+------+-----------+------------+-------------+-----------+------------+-----------+
172| B9   | n.c.      | n.c.       | n.c.        | n.c.      | n.c.       | n.c.      |
173+------+-----------+------------+-------------+-----------+------------+-----------+
174| B10  | n.c.      | n.c.       | n.c.        | n.c.      | n.c.       | n.c.      |
175+------+-----------+------------+-------------+-----------+------------+-----------+
176| B11  | GND       | GND        | GND         | GND       | GND        | GND       |
177+------+-----------+------------+-------------+-----------+------------+-----------+
178| B12  | 3V3       | 3V3        | 3V3         | 3V3       | 3V3        | 3V3       |
179+------+-----------+------------+-------------+-----------+------------+-----------+
180
181Pmod_C Connector
182----------------
183
184Table below lists the pin assignment of valid protocols that can be multiplexed on the ``Pmod_C``
185connector. The GPIO column is the default assignment after Reset.
186
187+------+-----------+------------+-------------+-----------+-----------+
188| Pin  | GPIO      | UART       | SPI         | I2C       | PWM       |
189+------+-----------+------------+-------------+-----------+-----------+
190| C1   | gpio[16]  | uart1_txd  | spi1_cs[2]  | i2c1_scl  | gpio[16]  |
191+------+-----------+------------+-------------+-----------+-----------+
192| C2   | gpio[17]  | uart1_rxd  | spi1_mosi   | i2c1_sda  | pwm_ch[0] |
193+------+-----------+------------+-------------+-----------+-----------+
194| C3   | gpio[18]  | uart2_txd  | spi1_miso   | i2c2_scl  | gpio[18]  |
195+------+-----------+------------+-------------+-----------+-----------+
196| C4   | gpio[19]  | uart2_rxd  | spi1_clk    | i2c2_sda  | gpio[19]  |
197+------+-----------+------------+-------------+-----------+-----------+
198| C5   | GND       | GND        | GND         | GND       | GND       |
199+------+-----------+------------+-------------+-----------+-----------+
200| C6   | 3V3       | 3V3        | 3V3         | 3V3       | 3V3       |
201+------+-----------+------------+-------------+-----------+-----------+
202
203Mikrobus
204========
205
206The ARC HSDK4xD features a set of MikroBUS headers. Figure below shows the relevant function assignments,
207fully compatible with the MikroBUS standard. Table below shows the pin assignment on the I/O Multiplexer.
208
209.. image:: mikrobus_header.jpg
210   :align: center
211   :alt: mikrobus header
212
213+-------+-----------------+------+-----------+
214| Pin   | I/O             | Pin  | I/O       |
215+-------+-----------------+------+-----------+
216| AN    | ADC VIN6*       | PWM  | pwm_ch[0] |
217+-------+-----------------+------+-----------+
218| RST   | GPX_Port0_bit1  | INT  | gpio[16]  |
219+-------+-----------------+------+-----------+
220| CS    | spi2_cs[1]      | RX   | uart2_rxd |
221+-------+-----------------+------+-----------+
222| SCK   | spi2_clk        | TX   | uart2_txd |
223+-------+-----------------+------+-----------+
224| MISO  | spi2_miso       | SCL  | i2c2_scl  |
225+-------+-----------------+------+-----------+
226| MOSI  | spi2_mosi       | SDA  | i2c2_sda  |
227+-------+-----------------+------+-----------+
228
229.. note::
230    ADC VIN6 is available through the on-board ADC and is
231    read though SPI0 using SPI chip select 1.
232
233Arduino
234=======
235
236The ARC HSDK4xD provides an Arduino shield interface. Figure below shows the relevant
237function assignments. The Arduino shield interface is compatible with the Arduino UNO
238R3 with the following exceptions: 5 Volt shields are not supported, the IOREF voltage on
239the ARC HSDK4xD board is fixed to 3V3. Note that the ICSP header is also not available. Most
240shields do not require this ICSP header as the SPI master interface on this ICSP header
241is also available on the ``IO10`` to ``IO13`` pins.
242
243.. image:: arduino_shield_interface.jpg
244   :align: center
245   :alt: arduino shield interface
246
247Table below shows the pin assignment on the I/O Multiplexer. Multiplexing is controlled by software
248using the ``CREG_GPIO_MUX`` register (see Pinmux ). After a reset, all ports are configured as GPIO inputs.
249
250+-------+------------+-----------------+------------+
251| Pin   | I/O-1      | I/O-2           | I/O-3      |
252+-------+------------+-----------------+------------+
253| AD0   | ADC VIN0*  | GPX_port0_bit2  | -          |
254+-------+------------+-----------------+------------+
255| AD1   | ADC VIN1*  | GPX_port0_bit3  | -          |
256+-------+------------+-----------------+------------+
257| AD2   | ADC VIN2*  | GPX_port0_bit4  | -          |
258+-------+------------+-----------------+------------+
259| AD3   | ADC VIN3*  | GPX_port0_bit5  | -          |
260+-------+------------+-----------------+------------+
261| AD4   | ADC VIN4*  | gpio[18]        | i2c2_sda   |
262+-------+------------+-----------------+------------+
263| AD5   | ADC VIN5*  | gpio[19]        | i2c2_scl   |
264+-------+------------+-----------------+------------+
265| IO0   | gpio[23]   | uart2_rxd       | -          |
266+-------+------------+-----------------+------------+
267| IO1   | gpio[22]   | uart2_txd       | -          |
268+-------+------------+-----------------+------------+
269| IO2   | gpio[16]   | -               | -          |
270+-------+------------+-----------------+------------+
271| IO3   | gpio[17]   | pwm_ch[5]       | -          |
272+-------+------------+-----------------+------------+
273| IO4   | gpio[11]   | -               |            |
274+-------+------------+-----------------+------------+
275| IO5   | gpio[9]    | pwm_ch[4]       | -          |
276+-------+------------+-----------------+------------+
277| IO6   | gpio[21]   | pwm_ch[3]       | -          |
278+-------+------------+-----------------+------------+
279| IO7   | gpio[20]   | -               | -          |
280+-------+------------+-----------------+------------+
281| IO8   | gpio[10]   | -               | -          |
282+-------+------------+-----------------+------------+
283| IO9   | gpio[8]    | pwm_ch[2]       | -          |
284+-------+------------+-----------------+------------+
285| IO10  | gpio[12]   | pwm_ch[0]       | spi2_cs[1] |
286+-------+------------+-----------------+------------+
287| IO11  | gpio[13]   | pwm_ch[6]       | spi2_mosi  |
288+-------+------------+-----------------+------------+
289| IO12  | gpio[14]   | -               | spi2_miso  |
290+-------+------------+-----------------+------------+
291| IO13  | gpio[15]   | -               | spi2_clk   |
292+-------+------------+-----------------+------------+
293
294I/O expander
295============
296
297The ARC HSDK4xD board includes a CY8C9520A I/O expander from `Cypress CY8C9520A
298<https://www.cypress.com/file/37971/download>`__. The I/O
299expander offers additional GPIO signals and board control signals and can be accessed
300through the on-board I2C bus, we have implemented a basic driver for it.
301Tables below shows an overview of relevant I/O signals.
302
303+------------+---------------------------------------------+
304| Pins       | Usage                                       |
305+------------+---------------------------------------------+
306| port0_bit0 | RS9113 Bluetooth I2S RX enable (active low) |
307+------------+---------------------------------------------+
308| port0_bit1 | mikroBUS Reset (active low)                 |
309+------------+---------------------------------------------+
310| port0_bit2 | GPIO for Arduino AD0                        |
311+------------+---------------------------------------------+
312| port0_bit3 | GPIO for Arduino AD1                        |
313+------------+---------------------------------------------+
314| port0_bit4 | GPIO for Arduino AD2                        |
315+------------+---------------------------------------------+
316| port0_bit5 | GPIO for Arduino AD3                        |
317+------------+---------------------------------------------+
318| port1_bit4 | On-board user LED0                          |
319+------------+---------------------------------------------+
320| port1_bit5 | On-board user LED1                          |
321+------------+---------------------------------------------+
322| port1_bit6 | On-board user LED2                          |
323+------------+---------------------------------------------+
324| port1_bit7 | On-board user LED3                          |
325+------------+---------------------------------------------+
326
327On-board user LEDS
328==================
329
330The ARC HSDK4xD includes 4 user LEDs(active high), which can be controlled through the I/O expander pins.
331
332+-------+-----------------+
333| LEDs  | PINs            |
334+-------+-----------------+
335| LED0  | GPX_port1_bit4  |
336+-------+-----------------+
337| LED1  | GPX_port1_bit5  |
338+-------+-----------------+
339| LED2  | GPX_port1_bit6  |
340+-------+-----------------+
341| LED3  | GPX_port1_bit7  |
342+-------+-----------------+
343
344For hardware feature details, refer to : `Designware HS4x/HS4xD Development Kit website
345<https://www.synopsys.com/dw/ipdir.php?ds=arc-hs-development-kit>`__.
346
347Programming and Debugging
348*************************
349
350Required Hardware and Software
351==============================
352
353To use Zephyr RTOS applications on the HS4x/HS4xD Development Kit board, a few
354additional pieces of hardware are required.
355
356* A micro USB cable provides USB-JTAG debug and USB-UART communication
357  to the board
358
359* A universal switching power adaptor (110-240V
360  AC to 12V DC), provided in the package, provides power to the board.
361
362* :ref:`The Zephyr SDK <toolchain_zephyr_sdk>`
363
364* Terminal emulator software for use with the USB-UART. Suggestion:
365  `Putty Website`_.
366
367* (optional) A collection of Pmods, Arduino modules, or Mikro modules.
368  See `Digilent Pmod Modules`_ or develop your custom interfaces to attach
369  to the Pmod connector.
370
371Set up the ARC HS4x/HS4xD Development Kit
372=========================================
373
374To run Zephyr application on ARC HS4x/HS4xD Development Kit, you need to
375set up the board correctly.
376
377* Connect the digilent USB cable from your host to the board.
378
379* Connect the 12V DC power supply to your board
380
381Set up Zephyr Software
382======================
383
384Building Sample Applications
385==============================
386
387You can try many of the :ref:`sample applications and demos
388<samples-and-demos>`.  We'll use :ref:`hello_world`, found in
389:zephyr_file:`samples/hello_world` as an example.
390
391Configuring
392-----------
393
394You may need to write a ``prj_arc.conf`` file if the sample doesn't have one.
395Next, you can use the menuconfig rule to configure the target. By specifying
396``hsdk4xd`` as the board configuration, you can select the ARC HS4x/HS4xD Development
397Kit board support for Zephyr.
398
399.. zephyr-app-commands::
400   :board: hsdk4xd
401   :zephyr-app: samples/hello_world
402   :goals: menuconfig
403
404
405Building
406--------
407
408You can build an application in the usual way.  Refer to
409:ref:`build_an_application` for more details. Here is an example for
410:ref:`hello_world`.
411
412.. zephyr-app-commands::
413   :board: hsdk4xd
414   :zephyr-app: samples/hello_world
415   :maybe-skip-config:
416   :goals: build
417
418
419Connecting Serial Output
420=========================
421
422In the default configuration, Zephyr's HS4x/HS4xD Development Kit images support
423serial output via the USB-UART on the board.  To enable serial output:
424
425* Open a serial port emulator (i.e. on Linux minicom, putty, screen, etc)
426
427* Specify the tty driver name, for example, on Linux this may be
428  :file:`/dev/ttyUSB0`
429
430* Set the communication settings to:
431
432
433========= =====
434Parameter Value
435========= =====
436Baud:     115200
437Data:     8 bits
438Parity:    None
439Stopbits:  1
440========= =====
441
442Debugging
443==========
444
445Using the latest version of Zephyr SDK(>=0.15.2), you can debug and
446flash (run) HS4x/HS4xD Development Kit directly.
447
448One option is to build and debug the application using the usual
449Zephyr build system commands.
450
451.. zephyr-app-commands::
452   :board: hsdk4xd
453   :app: <my app>
454   :goals: debug
455
456At this point you can do your normal debug session. Set breakpoints and then
457:kbd:`c` to continue into the program.
458
459The other option is to launch a debug server, as follows.
460
461.. zephyr-app-commands::
462   :board: hsdk4xd
463   :app: <my app>
464   :goals: debugserver
465
466Then connect to the debug server at the HS4x/HS4xD Development Kit from a second
467console, from the build directory containing the output :file:`zephyr.elf`.
468
469.. code-block:: console
470
471   $ cd <my app>
472   $ $ZEPHYR_SDK_INSTALL_DIR/arc-zephyr-elf/arc-zephyr-elf-gdb zephyr.elf
473   (gdb) target remote localhost:3333
474   (gdb) load
475   (gdb) b main
476   (gdb) c
477
478Flashing
479========
480
481If you just want to download the application to the HS4x/HS4xD Development Kit's DDR
482and run, you can do so in the usual way.
483
484.. zephyr-app-commands::
485   :board: hsdk4xd
486   :app: <my app>
487   :goals: flash
488
489This command still uses openocd and gdb to load the application elf file to
490HS4x/HS4xD Development Kit, but it will load the application and immediately run. If
491power is removed, the application will be lost since it wasn't written to flash.
492
493Most of the time you will not be flashing your program but will instead debug
494it using openocd and gdb. The program can be download via the USB cable into
495the code and data memories.
496
497The HS4x/HS4xD Development Kit also supports flashing the Zephyr application
498with the U-Boot bootloader, a powerful and flexible tool for loading
499an executable from different sources and running it on the target platform.
500
501The U-Boot implementation for the HS4x/HS4xD Development Kit was further extended with
502additional functionality that allows users to better manage the broad
503configurability of the HS4x/HS4xD Development Kit
504
505When you are ready to deploy the program so that it boots up automatically on
506reset or power-up, you can follow the steps to place the program on SD card.
507
508For details, see: `Uboot-HS4x/HS4xD-Command-Reference
509<https://github.com/foss-for-synopsys-dwc-arc-processors/linux/wiki/Uboot-HSDK-4xD-Command-Reference#launching-baremetal-application-on-hsdk-4xd>`__
510
511Supported peripheral
512====================
513
514The following list indicates the state of HS4x/HS4xD Development Kit peripherals’ support
515
516+------------+---------+
517| Peripheral | Support |
518+------------+---------+
519| ADC        | No      |
520+------------+---------+
521| Bluetooth  | No      |
522+------------+---------+
523| Ethernet   | No      |
524+------------+---------+
525| GPIO       | No      |
526+------------+---------+
527| GPU        | No      |
528+------------+---------+
529| HDMI       | No      |
530+------------+---------+
531| I2C        | No      |
532+------------+---------+
533| I2S        | No      |
534+------------+---------+
535| PWM        | No      |
536+------------+---------+
537| SDIO       | No      |
538+------------+---------+
539| SPI        | No      |
540+------------+---------+
541| UART       | Yes     |
542+------------+---------+
543| USB        | No      |
544+------------+---------+
545| WiFi       | No      |
546+------------+---------+
547
548References
549**********
550
551.. _embARC website: https://www.embarc.org
552
553.. _Designware HS Development Kit website: https://www.synopsys.com/dw/ipdir.php?ds=arc-hs-development-kit
554
555.. _Digilent Pmod Modules: http://store.digilentinc.com/pmod-modules
556
557.. _Putty website: http://www.putty.org
558