1.. _mps2_armv6m_board:
2
3ARM V2M MPS2 Armv6-m (AN383)
4############################
5
6Overview
7********
8
9Currently ``mps2/an383`` is the only mps2 Armv6-m based board target supported in Zephyr.
10It provides support for the ARM Cortex-M0+ (AN383) CPU and the following devices:
11
12- Nested Vectored Interrupt Controller (NVIC)
13- System Tick System Clock (SYSTICK)
14- Cortex-M System Design Kit UART
15
16.. image:: img/mps2.jpg
17     :align: center
18     :alt: ARM V2M MPS2
19
20In addition to enabling actual hardware usage, this board target can
21also use `FVP`_. to emulate the AN383 platform running on the MPS2+.
22
23More information about the board can be found at the `V2M MPS2 Website`_.
24
25The Application Note AN383 can be found at `Application Note AN383`_.
26
27.. note::
28   This board target makes no claims about its suitability for use
29   with actual MPS2 hardware systems using AN383, or any other hardware
30   system. It has been tested on FVP.
31
32
33Hardware
34********
35
36ARM V2M MPS2 AN383 provides the following hardware components:
37
38- ARM Cortex-M0+
39- ARM IoT Subsystem for Cortex-M
40- Form factor: 140x120cm
41- ZBTSRAM: 8MB single cycle SRAM, 16MB PSRAM
42- Video: QSVGA touch screen panel, 4bit RGB VGA connector
43- Audio: Audio Codec
44- Debug:
45
46  - ARM JTAG20 connector
47  - ARM parallel trace connector (MICTOR38)
48  - 20 pin Cortex debug connector
49  - 10 pin Cortex debug connector
50  - ILA connector for FPGA debug
51
52- Expansion
53
54  - GPIO
55  - SPI
56
57.. note::
58   4 MB of flash memory (in ZBTSRAM 1, starting at address 0x00400000) and 4 MB of RAM
59   (in ZBTSRAM 2 & 3, starting at address 0x20000000) are available.
60
61Supported Features
62==================
63
64The ``mps2/an383`` board target supports the following hardware features:
65
66+-----------+------------+-------------------------------------+
67| Interface | Controller | Driver/Component                    |
68+===========+============+=====================================+
69| NVIC      | on-chip    | nested vector interrupt controller  |
70+-----------+------------+-------------------------------------+
71| SYSTICK   | on-chip    | systick                             |
72+-----------+------------+-------------------------------------+
73| UART      | on-chip    | serial port-polling;                |
74|           |            | serial port-interrupt               |
75+-----------+------------+-------------------------------------+
76| GPIO      | on-chip    | gpio                                |
77+-----------+------------+-------------------------------------+
78| WATCHDOG  | on-chip    | watchdog                            |
79+-----------+------------+-------------------------------------+
80| TIMER     | on-chip    | counter                             |
81+-----------+------------+-------------------------------------+
82| DUALTIMER | on-chip    | counter                             |
83+-----------+------------+-------------------------------------+
84
85Other hardware features are not currently supported by the port.
86See the `V2M MPS2 Website`_ for a complete list of V2M MPS2 board hardware
87features.
88
89The default configuration can be found in
90:zephyr_file:`boards/arm/mps2/mps2_an383_defconfig`
91
92Interrupt Controller
93====================
94
95MPS2 is a Cortex-M0+ based SoC and has 6 fixed exceptions and 32 IRQs.
96
97A Cortex-M0+ board uses vectored exceptions. This means each exception
98calls a handler directly from the vector table.
99
100Handlers are provided for exceptions 1-3, 11, and 14-15. The table here
101MPS2 is a Cortex-M0+ based SoC and has 15 fixed exceptions and 45 IRQs.
102
103+------+------------+----------------+--------------------------+
104| Exc# | Name       | Remarks        | Used by Zephyr Kernel    |
105+======+============+================+==========================+
106| 1    | Reset      |                | system initialization    |
107+------+------------+----------------+--------------------------+
108| 2    | NMI        |                | system fatal error       |
109+------+------------+----------------+--------------------------+
110| 3    | Hard fault |                | system fatal error       |
111+------+------------+----------------+--------------------------+
112| 11   | SVC        |                | system calls, kernel     |
113|      |            |                | run-time exceptions,     |
114|      |            |                | and IRQ offloading       |
115+------+------------+----------------+--------------------------+
116| 14   | PendSV     |                | context switch           |
117+------+------------+----------------+--------------------------+
118| 15   | SYSTICK    | optional       | system clock             |
119+------+------------+----------------+--------------------------+
120
121Pin Mapping
122===========
123
124The ARM V2M MPS2 Board has 4 GPIO controllers. These controllers are responsible
125for pin muxing, input/output, pull-up, etc.
126
127All GPIO controller pins are exposed via the following sequence of pin numbers:
128
129- Pins 0 - 15 are for GPIO 0
130- Pins 16 - 31 are for GPIO 1
131- Pins 32 -  47 are for GPIO 2
132- Pins 48 -  51 are for GPIO 3
133
134Mapping from the ARM MPS2 Board pins to GPIO controllers:
135
136.. rst-class:: rst-columns
137
138   - D0 : EXT_0
139   - D1 : EXT_4
140   - D2 : EXT_2
141   - D3 : EXT_3
142   - D4 : EXT_1
143   - D5 : EXT_6
144   - D6 : EXT_7
145   - D7 : EXT_8
146   - D8 : EXT_9
147   - D9 : EXT_10
148   - D10 : EXT_12
149   - D11 : EXT_13
150   - D12 : EXT_14
151   - D13 : EXT_11
152   - D14 : EXT_15
153   - D15 : EXT_5
154   - D16 : EXT_16
155   - D17 : EXT_17
156   - D18 : EXT_18
157   - D19 : EXT_19
158   - D20 : EXT_20
159   - D21 : EXT_21
160   - D22 : EXT_22
161   - D23 : EXT_23
162   - D24 : EXT_24
163   - D25 : EXT_25
164   - D26 : EXT_26
165   - D27 : EXT_30
166   - D28 : EXT_28
167   - D29 : EXT_29
168   - D30 : EXT_27
169   - D31 : EXT_32
170   - D32 : EXT_33
171   - D33 : EXT_34
172   - D34 : EXT_35
173   - D35 : EXT_36
174   - D36 : EXT_38
175   - D37 : EXT_39
176   - D38 : EXT_40
177   - D39 : EXT_44
178   - D40 : EXT_41
179   - D41 : EXT_31
180   - D42 : EXT_37
181   - D43 : EXT_42
182   - D44 : EXT_43
183   - D45 : EXT_45
184   - D46 : EXT_46
185   - D47 : EXT_47
186   - D48 : EXT_48
187   - D49 : EXT_49
188   - D50 : EXT_50
189   - D51 : EXT_51
190
191Peripheral Mapping:
192
193.. rst-class:: rst-columns
194
195   - UART_3_RX : D0
196   - UART_3_TX : D1
197   - SPI_3_CS : D10
198   - SPI_3_MOSI : D11
199   - SPI_3_MISO : D12
200   - SPI_3_SCLK : D13
201   - I2C_3_SDA : D14
202   - I2C_3_SCL : D15
203   - UART_4_RX : D26
204   - UART_4_TX : D30
205   - SPI_4_CS : D36
206   - SPI_4_MOSI : D37
207   - SPI_4_MISO : D38
208   - SPI_4_SCK : D39
209   - I2C_4_SDA : D40
210   - I2C_4_SCL : D41
211
212For more details please refer to `MPS2 Technical Reference Manual (TRM)`_.
213
214System Clock
215============
216
217The V2M MPS2 main clock is 24 MHz.
218
219Serial Port
220===========
221
222The V2M MPS2 processor has five UARTs. Both the UARTs have only two wires for
223RX/TX and no flow control (CTS/RTS) or FIFO. The Zephyr console output, by
224default, is utilizing UART0.
225
226Programming and Debugging
227*************************
228
229Flashing
230========
231
232V2M MPS2 provides:
233
234- A USB connection to the host computer, which exposes a Mass Storage and an
235  USB Serial Port.
236- A Serial Flash device, which implements the USB flash disk file storage.
237- A physical UART connection which is relayed over interface USB Serial port.
238
239Flashing an application to V2M MPS2
240-----------------------------------
241
242Here is an example for the :zephyr:code-sample:`hello_world` application.
243
244.. zephyr-app-commands::
245   :zephyr-app: samples/hello_world
246   :board: mps2/an383
247   :goals: build
248
249Connect the V2M MPS2 to your host computer using the USB port and you should
250see a USB connection which exposes a Mass Storage and a USB Serial Port.
251Copy the generated zephyr.bin in the exposed drive.
252Reset the board and you should be able to see on the corresponding Serial Port
253the following message:
254
255.. code-block:: console
256
257   Hello World! arm
258
259Running an applicatoin with FVP
260-------------------------------
261
262Here is the same example for running with FVP.
263Set the ``ARMFVP_BIN_PATH`` environemnt variable to the location of your FVP you have downloaded from `here <FVP_>`_
264
265.. code-block:: console
266
267    export ARMFVP_BIN_PATH=/home/../FVP_MPS2/
268
269Then build with the same command you would use normally, and run with ``west build -t run_armfvp``.
270
271.. _V2M MPS2 Website:
272   https://developer.mbed.org/platforms/ARM-MPS2/
273
274.. _MPS2 Technical Reference Manual (TRM):
275   https://developer.arm.com/documentation/100112/0200/
276
277.. _Application Note AN383:
278   https://documentation-service.arm.com/static/5ed1051dca06a95ce53f88a1
279
280.. _FVP:
281   https://developer.arm.com/downloads/view/FMFVP
282