1.. _96b_aerocore2_board:
2
396Boards Aerocore2
4##################
5
6Overview
7********
8
9The 96Boards Aerocore2 Mezzanine is based on the STMicroelectronics
10STM32F427VIT6 Cortex-M4 CPU primarily designed for use in drones.
11This board acts as a mezzanine platform for all 96Boards CE compliant
12boards. It can also be used as a standalone board.
13
14
15.. figure:: img/96b_aerocore2.jpg
16     :align: center
17     :alt: 96Boards Aerocore2
18
19     96Boards Aerocore2
20
21Hardware
22********
23
2496Boards Aerocore2 provides the following hardware components:
25
26- STM32F427VIT6 in LQFP100 package
27- ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU
28- 168 MHz max CPU frequency
29- VDD from 1.7 V to 3.6 V
30- 2048 KB Flash
31- 256 KB SRAM
32- GPIO with external interrupt capability
33- 12-bit ADC with 16 channels
34- RTC
35- Advanced-control Timers (2)
36- General Purpose Timers (10)
37- Watchdog Timers (2)
38- USART/UART (4)
39- I2C (3)
40- SPI (3)
41- SDIO
42- USB 2.0 OTG FS
43- DMA Controller
44
45More information about STM32F427VIT6 can be found here:
46       - `STM32F427 on www.st.com`_
47
48Supported Features
49==================
50
51The Zephyr 96b_aerocore2 board configuration supports the following hardware
52features:
53
54+------------+------------+-------------------------------------+
55| Interface  | Controller | Driver/Component                    |
56+============+============+=====================================+
57| NVIC       | on-chip    | nested vector interrupt controller  |
58+------------+------------+-------------------------------------+
59| SYSTICK    | on-chip    | system clock                        |
60+------------+------------+-------------------------------------+
61| UART       | on-chip    | serial port                         |
62+------------+------------+-------------------------------------+
63| GPIO       | on-chip    | gpio                                |
64+------------+------------+-------------------------------------+
65| PINMUX     | on-chip    | pinmux                              |
66+------------+------------+-------------------------------------+
67| FLASH      | on-chip    | flash                               |
68+------------+------------+-------------------------------------+
69| SPI        | on-chip    | spi                                 |
70+------------+------------+-------------------------------------+
71| I2C        | on-chip    | i2c                                 |
72+------------+------------+-------------------------------------+
73| PWM        | on-chip    | timers / pwm                        |
74+------------+------------+-------------------------------------+
75| USB OTG FS | on-chip    | USB device                          |
76+------------+------------+-------------------------------------+
77| ADC        | on-chip    | adc                                 |
78+------------+------------+-------------------------------------+
79
80More details about the board can be found at `96Boards website`_.
81
82The default configuration can be found in
83:zephyr_file:`boards/96boards/aerocore2/96b_aerocore2_defconfig`
84
85Connections and IOs
86===================
87
88LED
89---
90
91- LED1 / User1 LED = PE10
92- LED2 / User2 LED = PE9
93
94External Connectors
95-------------------
96
97Octal PWM Header (J1)
98
99+-------+-------------+-------------------------+-------+-------------+-------+-------------+
100| PIN # | Signal Name | STM32F427 Functions Pin | PIN # | Signal Name | Pin # | Signal Name |
101+=======+=============+=========================+=======+=============+=======+=============+
102| 1     | PWM4_CH1    | PD12                    | 2     | 5.0v        | 3     | GND         |
103+-------+-------------+-------------------------+-------+-------------+-------+-------------+
104| 4     | PWM4_CH2    | PD13                    | 5     | 5.0v        | 6     | GND         |
105+-------+-------------+-------------------------+-------+-------------+-------+-------------+
106| 7     | PWM4_CH3    | PD14                    | 8     | 5.0v        | 9     | GND         |
107+-------+-------------+-------------------------+-------+-------------+-------+-------------+
108| 10    | PWM4_CH4    | PD15                    | 11    | 5.0v        | 12    | GND         |
109+-------+-------------+-------------------------+-------+-------------+-------+-------------+
110| 13    | PWM5_CH1    | PA0                     | 14    | 5.0v        | 15    | GND         |
111+-------+-------------+-------------------------+-------+-------------+-------+-------------+
112| 16    | PWM5_CH2    | PA1                     | 17    | 5.0v        | 18    | GND         |
113+-------+-------------+-------------------------+-------+-------------+-------+-------------+
114| 19    | PWM5_CH3    | PA2                     | 20    | 5.0v        | 21    | GND         |
115+-------+-------------+-------------------------+-------+-------------+-------+-------------+
116| 22    | PWM5_CH4    | PA3                     | 23    | 5.0v        | 24    | GND         |
117+-------+-------------+-------------------------+-------+-------------+-------+-------------+
118
119
120IO Header J11
121
122+-------+-------------+-------+-------------+
123| PIN # | Signal Name | PIN # | Signal Name |
124+=======+=============+=======+=============+
125| 1     | PB9         | 2     | PB8*        |
126+-------+-------------+-------+-------------+
127| 3     | PC9         | 4     | PB0         |
128+-------+-------------+-------+-------------+
129| 5     | PE5         | 6     | NA          |
130+-------+-------------+-------+-------------+
131| 7     | PE6         | 8     | NA          |
132+-------+-------------+-------+-------------+
133| 9     | PC6         | 10    | NA          |
134+-------+-------------+-------+-------------+
135| 11    | PC7         | 12    | NA          |
136+-------+-------------+-------+-------------+
137| 13    | PC8         | 14    | NA          |
138+-------+-------------+-------+-------------+
139| 15    | PA8         | 16    | GND         |
140+-------+-------------+-------+-------------+
141| 17    | PA9         | 18    | 3v3         |
142+-------+-------------+-------+-------------+
143| 19    | PA10        | 20    | GND         |
144+-------+-------------+-------+-------------+
145
146* PB8 is connected to a watchdog buzzer, It needs to be pulsed every 10 seconds to keep the buzzer silent.
147
148IO Header J5
149
150+-------+-------------+-------------------------+-------+-------------+-------------------------+
151| PIN # | Signal Name | STM32F427 Functions Pin | PIN # | Signal Name | STM32F427 Functions Pin |
152+=======+=============+=========================+=======+=============+=========================+
153| 1     | AGND        | AGND                    | 2     | ADC1_13     | PC3                     |
154+-------+-------------+-------------------------+-------+-------------+-------------------------+
155| 3     | ADC1_12     | PC2                     | 4     | ADC1_11     | PC1                     |
156+-------+-------------+-------------------------+-------+-------------+-------------------------+
157| 5     | I2C_SDA     | PB11                    | 6     | GND         | GND                     |
158+-------+-------------+-------------------------+-------+-------------+-------------------------+
159| 7     | I2C_SCL     | PB10                    | 8     | VCC 3v3     | VCC 3v3                 |
160+-------+-------------+-------------------------+-------+-------------+-------------------------+
161| 9     | NC          | NC                      | 10    | NC          | NC                      |
162+-------+-------------+-------------------------+-------+-------------+-------------------------+
163| 11    | NC          | NC                      | 12    | NC          | NC                      |
164+-------+-------------+-------------------------+-------+-------------+-------------------------+
165| 13    | UART_TX 7   | PE8                     | 14    | GND         | GND                     |
166+-------+-------------+-------------------------+-------+-------------+-------------------------+
167| 15    | UART_RX 7   | PE7                     | 16    | GND         | GND                     |
168+-------+-------------+-------------------------+-------+-------------+-------------------------+
169| 17    | UART_TX 2   | PD5                     | 18    | GND         | GND                     |
170+-------+-------------+-------------------------+-------+-------------+-------------------------+
171| 19    | UART_TX 2   | PD6                     | 20    | GND         | GND                     |
172+-------+-------------+-------------------------+-------+-------------+-------------------------+
173| 21    | NC          | NC                      | 10    | NC          | NC                      |
174+-------+-------------+-------------------------+-------+-------------+-------------------------+
175| 23    | NC          | NC                      | 10    | NC          | NC                      |
176+-------+-------------+-------------------------+-------+-------------+-------------------------+
177| 25    | SPI1_NIRQ   | PC5                     | 26    | GND         | GND                     |
178+-------+-------------+-------------------------+-------+-------------+-------------------------+
179| 27    | SPI1_CLK    | PA5                     | 28    | SPI1_MISO   | PA6                     |
180+-------+-------------+-------------------------+-------+-------------+-------------------------+
181| 29    | SPI1_CS0    | PA4                     | 30    | SPI1_MOSI   | PA7                     |
182+-------+-------------+-------------------------+-------+-------------+-------------------------+
183| 31    | CAN_TX      | PD1                     | 32    | CANH        | NC                      |
184+-------+-------------+-------------------------+-------+-------------+-------------------------+
185| 33    | CAN_RX      | PD0                     | 34    | CANL        | NC                      |
186+-------+-------------+-------------------------+-------+-------------+-------------------------+
187
188
189GPS connector J15
190
191+-------+-------------+-------------------------+
192| PIN # | Signal Name | STM32F427 Functions Pin |
193+=======+=============+=========================+
194| 1     | V_OUT 5v    | NC                      |
195+-------+-------------+-------------------------+
196| 2     | UART1_TX    | PB6                     |
197+-------+-------------+-------------------------+
198| 3     | UART1_RX    | PB7                     |
199+-------+-------------+-------------------------+
200| 4     | VCC 3v3     | NC                      |
201+-------+-------------+-------------------------+
202| 5     | GND         | GND                     |
203+-------+-------------+-------------------------+
204
205
206Spektrum connector J3
207
208+-------+-------------+-------------------------+
209| PIN # | Signal Name | STM32F427 Functions Pin |
210+=======+=============+=========================+
211| 1     | VCC 3v3     | NC                      |
212+-------+-------------+-------------------------+
213| 2     | GND         | GND                     |
214+-------+-------------+-------------------------+
215| 3     | UART8_RX    | PE0                     |
216+-------+-------------+-------------------------+
217
218
219External Clock Sources
220----------------------
221
222STM32F4 has one external oscillator. The frequency of the clock is
22332.768 kHz. The internal 16MHz clock is used as the main clock.
224
225Serial Port
226-----------
227
22896Boards Aerocore2 board has up to 4 U(S)ARTs. The Zephyr console output is
229assigned to USART7. Default settings are 115200 8N1.
230
231I2C
232---
233
23496Boards Aerocore2 board has 1 I2C port. The default I2C mapping for Zephyr is:
235
236- I2C1_SCL : PB10
237- I2C1_SDA : PB11
238
239SPI
240---
241
24296Boards Aerocore2 board has 1 SPI port. The default SPI mapping for Zephyr is:
243
244- SPI1_CS0  : PA4
245- SPI1_SCK  : PA5
246- SPI1_MISO : PA6
247- SPI1_MOSI : PA7
248
249USB
250===
251
25296Boards Aerocore2 board has a USB OTG dual-role device (DRD) controller that
253supports both device and host functions through its mini "OTG" USB connector.
254Only USB device functions are supported in Zephyr at the moment.
255
256Programming and Debugging
257*************************
258
259There are 2 main entry points for flashing STM32F4X SoCs, one using the ROM
260bootloader, and another by using the SWD debug port (which requires additional
261hardware). Flashing using the ROM bootloader requires a special activation
262pattern, which can be triggered by using the BOOT0 pin. The ROM bootloader
263supports flashing via USB (DFU), UART, I2C and SPI. You can read more about
264how to enable and use the ROM bootloader by checking the application
265note `AN2606`_, page 109.
266
267Flashing
268========
269
270Installing dfu-util
271-------------------
272
273It is recommended to use at least v0.8 of `dfu-util`_. The package available in
274debian/ubuntu can be quite old, so you might have to build dfu-util from source.
275
276Flashing an Application to 96Boards Aerocore2
277---------------------------------------------
278
279Connect the micro-USB cable to the USB OTG/STM_CONSOLE Aerocore2 port and to your computer.
280The board should power ON. Force the board into DFU mode by keeping the BOOT0
281switch pressed while pressing and releasing the RST switch.
282
283The BOOT button is located at the back-side of the PCB.
284
285Confirm that the board is in DFU mode:
286
287.. code-block:: console
288
289   $ sudo dfu-util -l
290   dfu-util 0.8
291   Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
292   Copyright 2010-2014 Tormod Volden and Stefan Schmidt
293   This program is Free Software and has ABSOLUTELY NO WARRANTY
294   Please report bugs to dfu-util@lists.gnumonks.org
295   Found DFU: [0483:df11] ver=2200, devnum=15, cfg=1, intf=0, alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="3574364C3034"
296   Found DFU: [0483:df11] ver=2200, devnum=15, cfg=1, intf=0, alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="3574364C3034"
297   Found DFU: [0483:df11] ver=2200, devnum=15, cfg=1, intf=0, alt=1, name="@Option Bytes /0x1FFFC000/01*016 e", serial="3574364C3034"
298   Found DFU: [0483:df11] ver=2200, devnum=15, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,03*128Kg", serial="3574364C3034"
299   Found Runtime: [05ac:8290] ver=0104, devnum=2, cfg=1, intf=5, alt=0, name="UNKNOWN", serial="UNKNOWN"
300
301You should see following confirmation on your Linux host:
302
303.. code-block:: console
304
305   $ dmesg
306   usb 1-2.1: new full-speed USB device number 14 using xhci_hcd
307   usb 1-2.1: New USB device found, idVendor=0483, idProduct=df11
308   usb 1-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
309   usb 1-2.1: Product: STM32 BOOTLOADER
310   usb 1-2.1: Manufacturer: STMicroelectronics
311   usb 1-2.1: SerialNumber: 3574364C3034
312
313Then build and flash an application. Here is an example for the
314:zephyr:code-sample:`hello_world` application.
315
316.. zephyr-app-commands::
317   :zephyr-app: samples/hello_world
318   :board: 96b_aerocore2
319   :goals: build flash
320
321Connect a USB-TTL dongle to the UART_7 header port and to your computer.
322Run your favorite terminal program to listen for output.
323
324.. code-block:: console
325
326   $ minicom -D <tty_device> -b 115200
327
328Replace :code:`<tty_device>` with the port where the board 96Boards Aerocore2
329can be found. For example, under Linux, :code:`/dev/ttyUSB0`.
330The ``-b`` option sets baud rate ignoring the value from config.
331
332Press the Reset button and you should see the following message in your
333terminal:
334
335.. code-block:: console
336
337   Hello World! arm
338
339.. _96Boards website:
340   https://www.96boards.org/product/aerocore2/
341
342.. _STM32F427 on www.st.com:
343   https://www.st.com/en/microcontrollers-microprocessors/stm32f427vi.html
344
345.. _dfu-util:
346   http://dfu-util.sourceforge.net/build.html
347
348.. _AN2606:
349   https://www.st.com/content/ccc/resource/technical/document/application_note/b9/9b/16/3a/12/1e/40/0c/CD00167594.pdf/files/CD00167594.pdf/jcr:content/translations/en.CD00167594.pdf
350