1.. _adp_xc7k_ae350:
2
3Andes ADP-XC7K AE350
4####################
5
6Overview
7********
8
9ADP-XC7K AE350 board is for AndeShape AE350 platform on ADP-XC7K series
10FPGA-based development boards.
11
12ADP-XC7K series are FPGA-based development and prototyping boards for evaluation of
13variety of AndesCore processors and AndeShape SoC platform IPs.
14AE350 is a RISC-V platform which can integrate AndesCore CPUs with a collection
15of fundamental peripheral IPs.
16
171st figure shows the green PCB is ADP-XC7K160 and 2nd figure shows the red PCB is ADP-XC7K410.
18
19.. image:: img/adp_xc7k160.jpg
20     :align: center
21     :alt: ADP-XC7K160
22
23.. image:: img/adp_xc7k410.jpg
24     :align: center
25     :alt: ADP-XC7K410
26
27More information can be found on `ADP-XC7K160/410`_ and `AndeShape AE350`_ websites.
28
29Hardware
30********
31
32The ADP-XC7K AE350 platform integrates 1 ~ 4 cores 32/64-bit 60MHz RISC-V CPUs, DSP,
331GB RAM, Cache, SPI flash memory, ethernet controller and other peripherals.
34
35The ADP-XC7K AE350 platform provides following hardware components:
36
37- 1 ~ 4 cores 32/64-bit 60MHz AndeStar v5 RISC-V CPUs
38- 1GB on-board SDRAM
39- 2MB SPI flash memory (1MB can be used for XIP)
40- UART
41- I2C
42- SPI
43- GPIO
44- PWM
45- DMA
46- 10/100 Ethernet RJ45 port
47- LCD module connector
48- 16KB I2C EEPROM
49- SD memory card slot
50- MIC-in, Line-in, and Line-out with AC97 audio codec
51
52Supported Features
53==================
54
55The ``adp_xc7k/ae350`` board configuration supports the following hardware features:
56
57+----------------+------------+----------------------+
58| Interface      | Controller | Driver/Component     |
59+================+============+======================+
60| PLIC           | on-chip    | interrupt_controller |
61+----------------+------------+----------------------+
62| RISC-V Machine | on-chip    | timer                |
63| Timer          |            |                      |
64+----------------+------------+----------------------+
65| GPIO           | on-chip    | gpio                 |
66+----------------+------------+----------------------+
67| UART           | on-chip    | serial               |
68+----------------+------------+----------------------+
69| COUNTER        | on-chip    | counter              |
70+----------------+------------+----------------------+
71| SPI            | on-chip    | spi                  |
72+----------------+------------+----------------------+
73| I2C            | on-chip    | i2c                  |
74+----------------+------------+----------------------+
75| EEPROM         | on-chip    | eeprom               |
76+----------------+------------+----------------------+
77| FLASH          | on-chip    | flash                |
78+----------------+------------+----------------------+
79| HWINFO         | on-chip    | syscon               |
80+----------------+------------+----------------------+
81| MAILBOX        | on-chip    | mbox                 |
82+----------------+------------+----------------------+
83| DMA            | on-chip    | dma                  |
84+----------------+------------+----------------------+
85| WATCHDOG       | on-chip    | wdt                  |
86+----------------+------------+----------------------+
87
88Other hardware features are not supported yet.
89
90Connections and IOs
91===================
92
93The ADP-XC7K AE350 platform has 1 GPIO controller. It providing 32 bits of IO.
94It is responsible for pin input/output, pull-up, etc.
95
96Mapping from GPIO controller to the ADP-XC7K board pins:
97
98+--------------------+--------------------+
99| GPIO controller    | Usage / Board pins |
100+====================+====================+
101| **Push Buttons**   |                    |
102+--------------------+--------------------+
103| GPIO.0             | SW1                |
104+--------------------+--------------------+
105| GPIO.1             | SW2                |
106+--------------------+--------------------+
107| GPIO.2             | SW3                |
108+--------------------+--------------------+
109| GPIO.3             | SW4                |
110+--------------------+--------------------+
111| GPIO.4             | SW5                |
112+--------------------+--------------------+
113| GPIO.5             | SW6                |
114+--------------------+--------------------+
115| GPIO.6             | SW7                |
116+--------------------+--------------------+
117| **7-Segment LED1** |                    |
118+--------------------+--------------------+
119| GPIO.16            | 7SEG1.A            |
120+--------------------+--------------------+
121| GPIO.17            | 7SEG1.B            |
122+--------------------+--------------------+
123| GPIO.18            | 7SEG1.C            |
124+--------------------+--------------------+
125| GPIO.19            | 7SEG1.D            |
126+--------------------+--------------------+
127| GPIO.20            | 7SEG1.E            |
128+--------------------+--------------------+
129| GPIO.21            | 7SEG1.F            |
130+--------------------+--------------------+
131| GPIO.22            | 7SEG1.G            |
132+--------------------+--------------------+
133| GPIO.23            | 7SEG1.DP           |
134+--------------------+--------------------+
135| **7-Segment LED2** |                    |
136+--------------------+--------------------+
137| GPIO.24            | 7SEG2.A            |
138+--------------------+--------------------+
139| GPIO.25            | 7SEG2.B            |
140+--------------------+--------------------+
141| GPIO.26            | 7SEG2.C            |
142+--------------------+--------------------+
143| GPIO.27            | 7SEG2.D            |
144+--------------------+--------------------+
145| GPIO.28            | 7SEG2.E            |
146+--------------------+--------------------+
147| GPIO.29            | 7SEG2.F            |
148+--------------------+--------------------+
149| GPIO.30            | 7SEG2.G            |
150+--------------------+--------------------+
151| GPIO.31            | 7SEG2.DP           |
152+--------------------+--------------------+
153| **GPIO pins**      |                    |
154+--------------------+--------------------+
155| GPIO.7             | IDE_CON1.4         |
156+--------------------+--------------------+
157| GPIO.8             | IDE_CON1.6         |
158+--------------------+--------------------+
159| GPIO.9             | IDE_CON1.8         |
160+--------------------+--------------------+
161| GPIO.10            | IDE_CON1.10        |
162+--------------------+--------------------+
163| GPIO.11            | IDE_CON1.11        |
164+--------------------+--------------------+
165| GPIO.12            | IDE_CON1.12        |
166+--------------------+--------------------+
167| GPIO.13            | IDE_CON1.13        |
168+--------------------+--------------------+
169| GPIO.14            | IDE_CON1.14        |
170+--------------------+--------------------+
171| GPIO.15            | IDE_CON1.15        |
172+--------------------+--------------------+
173
174Other peripheral mapping are listed below:
175
176+-------------+---------------------------------+
177| Peripherals | Usage / Board pins              |
178+=============+=================================+
179| SPI_1       | internal connected to SPI Flash |
180+-------------+---------------------------------+
181| SPI_2_CS    | IDE_CON1.37                     |
182+-------------+---------------------------------+
183| SPI_2_MOSI  | IDE_CON1.36                     |
184+-------------+---------------------------------+
185| SPI_2_MISO  | IDE_CON1.38                     |
186+-------------+---------------------------------+
187| SPI_2_SCLK  | IDE_CON1.35                     |
188+-------------+---------------------------------+
189| I2C_SDA     | J27.1                           |
190+-------------+---------------------------------+
191| I2C_SCL     | J27.2                           |
192+-------------+---------------------------------+
193
194System Clock
195------------
196
197The ADP-XC7K AE350 platform has 60MHz core clock.
198
199Serial Port
200-----------
201
202The ADP-XC7K AE350 platform has 2 UARTs.
203The Zephyr console output is by default assigned to UART2 and the default
204settings are 115200 8N1.
205
206Programming and debugging
207*************************
208
209For debugging zephyr applications or burning them into a flash, you will need to
210connect Andes ICE from host computer to ADP-XC7K board and execute the
211Andes ICE management software, ICEman, on this host computer.
212
213Connecting Andes ICE (AICE)
214===========================
215
216AICE is used for flashing and debugging the board. Please connect AICE to both
217ADP-XC7K board and the host computer as shown in the figure.
218
219.. image:: img/connect_aice.jpg
220     :align: center
221     :alt: Connect AICE
222
223More information can be found on `AICE-MINI+`_, `AICE-MICRO`_ website
224
225Building
226========
227
228You can build applications in the usual way. Here is an example for
229the :zephyr:code-sample:`hello_world` application.
230
231.. zephyr-app-commands::
232   :zephyr-app: samples/hello_world
233   :board: adp_xc7k/ae350
234   :goals: build
235
236Flashing
237========
238
239Before flashing, you have to download ICEman (``ice.zip``) from the
240`Andes Development Kit`_.
241If you want to use XIP mode (``CONFIG_XIP=y``), you also need to download
242the flash burner (``flash.zip``).
243
244At first, you should run ICEman when flashing and debugging program.
245
246.. code-block:: console
247
248   # Enable execute file permission of ICEman
249   chmod a+x ./ICEman
250
251   # Running the ICEman server
252   sudo ./ICEman -Z v5
253
254.. note::
255
256   To run ICEman commands as a normal user, you will need to install the
257   :file:`70-ndsusb-v1.rules` udev rules file (usually by placing it in
258   :file:`/etc/udev/rules.d`, then unplugging and plugging the
259   AICE adapter in again via USB.).
260
261If ``CONFIG_XIP=n``, you can load the program (``zephyr.elf``) into RAM directly
262and execute it.
263
264.. code-block:: console
265
266   # Check the ICEman server is running
267   # Load the program into RAM and execute it
268   riscv64-zephyr-elf-gdb build/zephyr/zephyr.elf
269   (gdb) target remote :1111
270   (gdb) monitor reset halt
271   (gdb) load
272   (gdb) quit
273
274If ``CONFIG_XIP=y``, you need to burn the program (``zephyr.bin``) into flash memory
275and execute it.
276
277.. code-block:: console
278
279   # Check the ICEman server is running
280   # Burn the program into flash and execute it
281   <FLASH>/bin/target_burn_frontend \
282       -P 4444 --unlock --verify --image=build/zephyr/zephyr.bin \
283       --algorithm-bin=<FLASH>/target_bin/target_SPI_v5_[32|64].bin
284
285   # Note:
286   #   1. Assume the flash burner is downloaded to <FLASH> directory
287   #   2. For algorithm-bin file, use target_SPI_v5_32.bin in RV32 platform and
288   #      use target_SPI_v5_64.bin in RV64 platform
289
290Open a serial terminal with the following settings:
291
292- Speed: 115200
293- Data: 8 bits
294- Parity: None
295- Stop bits: 1
296
297you should see the following message in the terminal:
298
299.. code-block:: console
300
301   ***** Booting Zephyr OS v2.4.0 *****
302   Hello World! adp_xc7k
303
304Debugging
305=========
306
307.. code-block:: console
308
309   # Check the ICEman server is running
310   # Load and debug program
311   ./riscv64-zephyr-elf-gdb build/zephyr/zephyr.elf
312   (gdb) target remote :1111
313   (gdb) monitor reset halt
314   (gdb) load
315
316If ``CONFIG_XIP=y``, please follow the flashing section to burn the program into
317flash memory first.
318Then, you can use GDB to debug program by above commands but do NOT execute ``load``
319command since the program has been placed in the flash memory.
320
321References
322**********
323
324.. target-notes::
325
326.. _ADP-XC7K160/410: http://www.andestech.com/en/products-solutions/andeshape-platforms/adp-xc7k160-410/
327
328.. _AndeShape AE350: http://www.andestech.com/en/products-solutions/andeshape-platforms/ae350-axi-based-platform-pre-integrated-with-n25f-nx25f-a25-ax25/
329
330.. _AICE-MINI+: http://www.andestech.com/en/products-solutions/andeshape-platforms/aice-mini-plus/
331
332.. _AICE-MICRO: http://www.andestech.com/en/products-solutions/andeshape-platforms/aice-micro/
333
334.. _Andes Development Kit: https://github.com/andestech/Andes-Development-Kit/releases
335