1.. _v2m_beetle_board:
2
3ARM V2M Beetle
4##############
5
6Overview
7********
8
9The v2m_beetle board configuration is used by Zephyr applications that run on
10the V2M Beetle board. It provides support for the Beetle ARM Cortex-M3 CPU and
11the following devices:
12
13- Nested Vectored Interrupt Controller (NVIC)
14- System Tick System Clock (SYSTICK)
15- Cortex-M System Design Kit GPIO
16- Cortex-M System Design Kit UART
17
18.. image:: img/v2m_beetle.jpg
19     :align: center
20     :alt: ARM V2M Beetle
21
22More information about the board can be found at the `V2M Beetle Website`_.
23
24Hardware
25********
26
27ARM V2M BEETLE provides the following hardware components:
28
29- ARM Cortex-M3
30- ARM IoT Subsystem for Cortex-M
31- CORDIO Bluetooth Smart radio
32- Memory
33
34  - 256KB of embedded flash
35  - 128KB SRAM
36  - 2MB of external QSPI flash.
37
38- Debug
39
40  - JTAG, SWD & 4 bit TRACE
41  - CMSIS-DAP with a virtual UART port
42
43- Arduino interface
44
45  - GPIO, UART, SPI, I2C
46  - Analog signals
47
48
49Supported Features
50===================
51
52The v2m_beetle board configuration supports the following hardware features:
53
54+-----------+------------+-------------------------------------+
55| Interface | Controller | Driver/Component                    |
56+===========+============+=====================================+
57| NVIC      | on-chip    | nested vector interrupt controller  |
58+-----------+------------+-------------------------------------+
59| SYSTICK   | on-chip    | systick                             |
60+-----------+------------+-------------------------------------+
61| UART      | on-chip    | serial port-polling;                |
62|           |            | serial port-interrupt               |
63+-----------+------------+-------------------------------------+
64| PINMUX    | on-chip    | pinmux                              |
65+-----------+------------+-------------------------------------+
66| GPIO      | on-chip    | gpio                                |
67+-----------+------------+-------------------------------------+
68| WATCHDOG  | on-chip    | watchdog                            |
69+-----------+------------+-------------------------------------+
70| TIMER     | on-chip    | timer                               |
71+-----------+------------+-------------------------------------+
72
73Other hardware features are not currently supported by the port.
74See the `V2M Beetle Website`_ for a complete list of V2M Beetle board hardware
75features.
76
77The default configuration can be found in the defconfig file:
78
79.. code-block:: console
80
81   boards/arm/v2m_beetle/v2m_beetle_defconfig
82
83Interrupt Controller
84====================
85
86Beetle is a Cortex-M3 based SoC and has 15 fixed exceptions and 45 IRQs.
87
88A Cortex-M3/4-based board uses vectored exceptions. This means each exception
89calls a handler directly from the vector table.
90
91Handlers are provided for exceptions 1-6, 11-12, and 14-15. The table here
92identifies the handlers used for each exception.
93
94+------+------------+----------------+--------------------------+
95| Exc# | Name       | Remarks        | Used by Zephyr Kernel    |
96+======+============+================+==========================+
97| 1    | Reset      |                | system initialization    |
98+------+------------+----------------+--------------------------+
99| 2    | NMI        |                | system fatal error       |
100+------+------------+----------------+--------------------------+
101| 3    | Hard fault |                | system fatal error       |
102+------+------------+----------------+--------------------------+
103| 4    | MemManage  | MPU fault      | system fatal error       |
104+------+------------+----------------+--------------------------+
105| 5    | Bus        |                | system fatal error       |
106+------+------------+----------------+--------------------------+
107| 6    | Usage      | undefined      | system fatal error       |
108|      | fault      | instruction,   |                          |
109|      |            | or switch      |                          |
110|      |            | attempt to ARM |                          |
111|      |            | mode           |                          |
112+------+------------+----------------+--------------------------+
113| 11   | SVC        |                | system calls, kernel     |
114|      |            |                | run-time exceptions,     |
115|      |            |                | and IRQ offloading       |
116+------+------------+----------------+--------------------------+
117| 12   | Debug      |                | system fatal error       |
118|      | monitor    |                |                          |
119+------+------------+----------------+--------------------------+
120| 14   | PendSV     |                | context switch           |
121+------+------------+----------------+--------------------------+
122| 15   | SYSTICK    |                | system clock             |
123+------+------------+----------------+--------------------------+
124
125Pin Mapping
126===========
127
128The ARM V2M Beetle Board has 4 GPIO controllers. These controllers are responsible for pin muxing, input/output, pull-up, etc.
129
130All GPIO controller pins are exposed via the following sequence of pin numbers:
131
132- Pins 0 - 15 are for GPIO 0
133- Pins 16 - 31 are for GPIO 1
134
135Mapping from the ARM V2M Beetle Board pins to GPIO controllers:
136
137.. rst-class:: rst-columns
138
139   - D0 : P0_0
140   - D1 : P0_1
141   - D2 : P0_2
142   - D3 : P0_3
143   - D4 : P0_4
144   - D5 : P0_5
145   - D6 : P0_6
146   - D7 : P0_7
147   - D8 : P0_8
148   - D9 : P0_9
149   - D10 : P0_10
150   - D11 : P0_11
151   - D12 : P0_12
152   - D13 : P0_13
153   - D14 : P0_14
154   - D15 : P0_15
155   - D16 : P1_0
156   - D17 : P1_1
157   - D18 : P1_2
158   - D19 : P1_3
159   - D20 : P1_4
160   - D21 : P1_5
161   - D22 : P1_6
162   - D23 : P1_7
163   - D24 : P1_8
164   - D25 : P1_9
165   - D26 : P1_10
166   - D27 : P1_11
167   - D28 : P1_12
168   - D29 : P1_13
169   - D30 : P1_14
170   - D31 : P1_15
171
172Peripheral Mapping:
173
174.. rst-class:: rst-columns
175
176   - UART_0_RX : D0
177   - UART_0_TX : D1
178   - SPI_0_CS : D10
179   - SPI_0_MOSI : D11
180   - SPI_0_MISO : D12
181   - SPI_0_SCLK : D13
182   - I2C_0_SCL : D14
183   - I2C_0_SDA : D15
184   - UART_1_RX : D16
185   - UART_1_TX : D17
186   - SPI_1_CS : D18
187   - SPI_1_MOSI : D19
188   - SPI_1_MISO : D20
189   - SPI_1_SCK : D21
190   - I2C_1_SDA : D22
191   - I2C_1_SCL : D23
192
193For mode details please refer to `Beetle Technical Reference Manual (TRM)`_.
194
195System Clock
196============
197
198V2M Beetle has one external and two on-chip oscillators. The slow clock is
19932.768 kHz, and the main clock is 24 MHz. The processor can set up PLL to drive
200the master clock.
201
202Serial Port
203===========
204
205The ARM Beetle processor has two UARTs. Both the UARTs have only two wires for
206RX/TX and no flow control (CTS/RTS) or FIFO. The Zephyr console output, by
207default, is utilizing UART1.
208
209Programming and Debugging
210*************************
211
212Flashing
213========
214
215CMSIS DAP
216---------
217
218V2M Beetle provides:
219
220- A USB connection to the host computer, which exposes a Mass Storage and an
221  USB Serial Port.
222- A Serial Flash device, which implements the USB flash disk file storage.
223- A physical UART connection which is relayed over interface USB Serial port.
224
225This interfaces are exposed via CMSIS DAP. For more details please refer
226to `CMSIS-DAP Website`_.
227
228Flashing an application to V2M Beetle
229-------------------------------------
230
231You can build applications in the usual way. Here is an example for
232the :ref:`hello_world` application.
233
234.. zephyr-app-commands::
235   :zephyr-app: samples/hello_world
236   :board: v2m_beetle
237   :goals: build
238
239Connect the V2M Beetle to your host computer using the USB port and you should
240see a USB connection which exposes a Mass Storage (MBED) and a USB Serial Port.
241Copy the generated zephyr.bin in the MBED drive.
242Reset the board and you should be able to see on the corresponding Serial Port
243the following message:
244
245.. code-block:: console
246
247   Hello World! arm
248
249
250.. _V2M Beetle Website:
251   https://developer.arm.com/Tools%20and%20Software/Beetle%20IoT%20Evaluation%20Platform
252
253.. _Beetle Technical Reference Manual (TRM):
254   https://developer.arm.com/documentation/100417/latest/
255
256.. _CMSIS-DAP Website:
257   https://arm-software.github.io/CMSIS_5/DAP/html/index.html
258