1.. zephyr:board:: olimex_stm32_e407
2
3Overview
4********
5
6The OLIMEX-STM32-E407 board is open source hardware and is based on
7the STMicroelectronics STM32F407ZG ARM Cortex-M4 CPU.
8
9Hardware
10********
11
12Information about the board can be found at the
13`OLIMEX-STM32-E407 website`_ and `OLIMEX-STM32-E407 user manual`_.
14The `ST STM32F407ZG Datasheet`_ contains the processor's
15information and the datasheet.
16
17Supported Features
18==================
19
20The olimex_stm32_e407 board configuration supports the following
21hardware features:
22
23+------------+------------+----------------------+
24| Interface  | Controller | Driver/Component     |
25+============+============+======================+
26| NVIC       | on-chip    | nested vectored      |
27|            |            | interrupt controller |
28+------------+------------+----------------------+
29| SYSTICK    | on-chip    | system clock         |
30+------------+------------+----------------------+
31| UART       | on-chip    | serial port          |
32+------------+------------+----------------------+
33| GPIO       | on-chip    | gpio                 |
34+------------+------------+----------------------+
35| USB OTG FS | on-chip    | USB device           |
36+------------+------------+----------------------+
37| USB OTG HS | on-chip    | USB device           |
38+------------+------------+----------------------+
39
40Other hardware features have not been enabled yet for this board.
41
42Pin Mapping
43===========
44
45.. figure:: img/olimex-stm32-e407-front.jpg
46     :align: center
47     :alt: OLIMEX-STM32-E407 connectors
48
49     OLIMEX-STM32-E407 connectors
50
51LED
52---
53
54* LED (green) = PC13
55* PWR_LED (red) = power
56
57Push buttons
58------------
59
60* BUT = PA0
61* RST = NRST
62
63External Connectors
64-------------------
65
66JTAG/SWD debug
67
68+-------+--------------+-------+--------------+
69| PIN # | Signal Name  | Pin # | Signal Name  |
70+=======+==============+=======+==============+
71| 1     | +3.3V        | 11    | -            |
72+-------+--------------+-------+--------------+
73| 2     | +3.3V        | 12    | GND          |
74+-------+--------------+-------+--------------+
75| 3     | PB4 / TRST   | 13    | PB3 / TDO    |
76+-------+--------------+-------+--------------+
77| 4     | GND          | 14    | GND          |
78+-------+--------------+-------+--------------+
79| 5     | PA15 / TDI   | 15    | PB4 / TRST   |
80+-------+--------------+-------+--------------+
81| 6     | GND          | 16    | GND          |
82+-------+--------------+-------+--------------+
83| 7     | PA13 / TMS   | 17    | -            |
84+-------+--------------+-------+--------------+
85| 8     | GND          | 18    | GND          |
86+-------+--------------+-------+--------------+
87| 9     | PA14 / TCK   | 19    | +5V_JTAG     |
88+-------+--------------+-------+--------------+
89| 10    | GND          | 20    | GND          |
90+-------+--------------+-------+--------------+
91
92UEXT
93
94+-------+-----------------------+----------------+
95| PIN # | Wire   Name           | STM32F407 port |
96+=======+=======================+================+
97| 1     | +3.3V                 | -              |
98+-------+-----------------------+----------------+
99| 2     | GND                   | -              |
100+-------+-----------------------+----------------+
101| 3     | PC6/USART6_TX         | PC6            |
102+-------+-----------------------+----------------+
103| 4     | PC7/USART6_RX         | PC7            |
104+-------+-----------------------+----------------+
105| 5     | PB8/I2C1_SCL          | PB8            |
106+-------+-----------------------+----------------+
107| 6     | PB9/I2C1_SDA          | PB9            |
108+-------+-----------------------+----------------+
109| 7     | PC2/SPI2_MISO         | PC2            |
110+-------+-----------------------+----------------+
111| 8     | PC3/SPI2_MOSI         | PC3            |
112+-------+-----------------------+----------------+
113| 9     | PB10/SPI_SCK/UART3_TX | PB10           |
114+-------+-----------------------+----------------+
115| 10    | RB7/UEXT_CS           | PB7            |
116+-------+-----------------------+----------------+
117
118Arduino Headers
119---------------
120
121CON1 power
122
123+-------+--------------+-------------------------+
124| Pin   | Signal Name  | STM32F407 Pin#          |
125+=======+==============+=========================+
126| RST   | RESET        | 25                      |
127+-------+--------------+-------------------------+
128| 3V3   | VCC (3V3)    | N/A                     |
129+-------+--------------+-------------------------+
130| 5V    | VDD (5V)     | N/A                     |
131+-------+--------------+-------------------------+
132| GND   | GND          | N/A                     |
133+-------+--------------+-------------------------+
134| GND   | GND          | N/A                     |
135+-------+--------------+-------------------------+
136| VIN   | VIN          | N/A                     |
137+-------+--------------+-------------------------+
138
139CON2 analog
140
141+-------+--------------+-------------------------+
142| Pin   | Signal Name  | STM32F407 Pin#          |
143+=======+==============+=========================+
144| A0    | PC0          | 26                      |
145+-------+--------------+-------------------------+
146| A1    | PF6          | 18                      |
147+-------+--------------+-------------------------+
148| A2    | PF7          | 19                      |
149+-------+--------------+-------------------------+
150| A3    | PF8          | 20                      |
151+-------+--------------+-------------------------+
152| A4    | PF9          | 21                      |
153+-------+--------------+-------------------------+
154| A5    | PF10         | 22                      |
155+-------+--------------+-------------------------+
156
157CON3 digital
158
159+-------+---------------+-------------------------+
160| Pin   | Signal Name   | STM32F407 Pin#          |
161+=======+===============+=========================+
162| D0    | PB7/USART1_RX | 137                     |
163+-------+---------------+-------------------------+
164| D1    | PB6/USART1_TX | 136                     |
165+-------+---------------+-------------------------+
166| D2    | PE2           | 1                       |
167+-------+---------------+-------------------------+
168| D3    | PE4           | 3                       |
169+-------+---------------+-------------------------+
170| D4    | PE5           | 4                       |
171+-------+---------------+-------------------------+
172| D5    | PR6           | 5                       |
173+-------+---------------+-------------------------+
174| D6    | PG7           | 92                      |
175+-------+---------------+-------------------------+
176| D7    | PG8           | 93                      |
177+-------+---------------+-------------------------+
178
179CON4 digital
180
181+-------+--------------+-------------------------+
182| Pin   | Signal Name  | STM32F407 Pin#          |
183+=======+==============+=========================+
184| D8    | PG12         | 35                      |
185+-------+--------------+-------------------------+
186| D9    | PG15         | 70                      |
187+-------+--------------+-------------------------+
188| D10   | PA4          | 40                      |
189+-------+--------------+-------------------------+
190| D11   | PB5          | 43                      |
191+-------+--------------+-------------------------+
192| D12   | PA6          | 42                      |
193+-------+--------------+-------------------------+
194| D13   | PA5          | 41                      |
195+-------+--------------+-------------------------+
196| GND   | AGND         | 31                      |
197+-------+--------------+-------------------------+
198| AREF  | AREF         | 32                      |
199+-------+--------------+-------------------------+
200
201PD
202
203+-------+--------------+-------+--------------+
204| PIN # | Signal Name  | Pin # | Signal Name  |
205+=======+==============+=======+==============+
206| 1     | +3.3V        | 11    | PD8          |
207+-------+--------------+-------+--------------+
208| 2     | GND          | 12    | PD9          |
209+-------+--------------+-------+--------------+
210| 3     | PD0          | 13    | PD10         |
211+-------+--------------+-------+--------------+
212| 4     | PD1          | 14    | PD11         |
213+-------+--------------+-------+--------------+
214| 5     | PD2/SD_MMC   | 15    | PD12         |
215+-------+--------------+-------+--------------+
216| 6     | PD3          | 16    | PD13         |
217+-------+--------------+-------+--------------+
218| 7     | PD4          | 17    | PD14         |
219+-------+--------------+-------+--------------+
220| 8     | PD5          | 18    | PD15         |
221+-------+--------------+-------+--------------+
222| 9     | PD6          | 19    | +5V          |
223+-------+--------------+-------+--------------+
224| 10    | PD7          | 20    | GND          |
225+-------+--------------+-------+--------------+
226
227PE
228
229+-------+--------------+-------+--------------+
230| PIN # | Signal Name  | Pin # | Signal Name  |
231+=======+==============+=======+==============+
232| 1     | +3.3V        | 11    | PE8          |
233+-------+--------------+-------+--------------+
234| 2     | GND          | 12    | PE9          |
235+-------+--------------+-------+--------------+
236| 3     | PE0          | 13    | PE10         |
237+-------+--------------+-------+--------------+
238| 4     | PE1          | 14    | PE11         |
239+-------+--------------+-------+--------------+
240| 5     | PE2/D2       | 15    | PE12         |
241+-------+--------------+-------+--------------+
242| 6     | PE3          | 16    | PE13         |
243+-------+--------------+-------+--------------+
244| 7     | PE4/D3       | 17    | PE14         |
245+-------+--------------+-------+--------------+
246| 8     | PE5/D4       | 18    | PE15         |
247+-------+--------------+-------+--------------+
248| 9     | PE6/D5       | 19    | +5V          |
249+-------+--------------+-------+--------------+
250| 10    | PE7          | 20    | GND          |
251+-------+--------------+-------+--------------+
252
253PF
254
255+-------+--------------+-------+--------------+
256| PIN # | Signal Name  | Pin # | Signal Name  |
257+=======+==============+=======+==============+
258| 1     | +3.3V        | 11    | PF8/A3       |
259+-------+--------------+-------+--------------+
260| 2     | GND          | 12    | PF9/A4       |
261+-------+--------------+-------+--------------+
262| 3     | PF0          | 13    | PF10/A5      |
263+-------+--------------+-------+--------------+
264| 4     | PF1          | 14    | PF11/A6      |
265+-------+--------------+-------+--------------+
266| 5     | PF2          | 15    | PF12         |
267+-------+--------------+-------+--------------+
268| 6     | PF3          | 16    | PF13         |
269+-------+--------------+-------+--------------+
270| 7     | PF4          | 17    | PF14         |
271+-------+--------------+-------+--------------+
272| 8     | PF5          | 18    | PF15         |
273+-------+--------------+-------+--------------+
274| 9     | PF6/A1       | 19    | +5V          |
275+-------+--------------+-------+--------------+
276| 10    | PF7/A2       | 20    | GND          |
277+-------+--------------+-------+--------------+
278
279PG
280
281+-------+--------------+-------+--------------+
282| PIN # | Signal Name  | Pin # | Signal Name  |
283+=======+==============+=======+==============+
284| 1     | +3.3V        | 11    | PG8/D7       |
285+-------+--------------+-------+--------------+
286| 2     | GND          | 12    | PG9          |
287+-------+--------------+-------+--------------+
288| 3     | PG0          | 13    | PG10/UEXT_CS |
289+-------+--------------+-------+--------------+
290| 4     | PG1          | 14    | PG11/TX_EN   |
291+-------+--------------+-------+--------------+
292| 5     | PG2          | 15    | PG12/D8      |
293+-------+--------------+-------+--------------+
294| 6     | PG3          | 16    | PG13/TXD0    |
295+-------+--------------+-------+--------------+
296| 7     | PG4          | 17    | PG14/TXD1    |
297+-------+--------------+-------+--------------+
298| 8     | PG5          | 18    | PG15/D9      |
299+-------+--------------+-------+--------------+
300| 9     | PG6          | 19    | +5V          |
301+-------+--------------+-------+--------------+
302| 10    | PG7/D6       | 20    | GND          |
303+-------+--------------+-------+--------------+
304
305System Clock
306============
307
308OLIMEX-STM32-E407 has two external oscillators. The frequency of
309the slow clock is 32.768 kHz. The frequency of the main clock
310is 12 MHz. The processor can setup HSE to drive the master clock,
311which can be set as high as 168 MHz.
312
313Programming and Debugging
314*************************
315The OLIMEX-STM32-E407 board does not include an embedded debug tool
316interface. You will need to use ST tools or an external JTAG probe.
317In the following examples a ST-Link V2 USB dongle is used.
318
319If you have an external JTAG probe compliant with the default Zephyr OpenOCD
320configuration, however, then applications for the ``olimex_stm32_e407`` board
321configuration can be built and flashed in the usual way (see
322:ref:`build_an_application` and :ref:`application_run` for more details).
323
324Flashing an application to the Olimex-STM32-E407
325================================================
326
327Connect the ST-Link USB dongle to your host computer and to the JTAG port of
328the OLIMEX-STM32-E407 board. Then build and flash an application.
329
330Here is an example for the :zephyr:code-sample:`hello_world` application.
331
332.. zephyr-app-commands::
333   :zephyr-app: samples/hello_world
334   :board: olimex_stm32_e407
335   :goals: build flash
336
337Run a serial host program to connect with your board:
338
339.. code-block:: console
340
341   $ minicom -D /dev/ttyACM0
342
343After resetting the board, you should see the following message:
344
345.. code-block:: console
346
347   ***** BOOTING ZEPHYR OS v1.8.99 - BUILD: May 29 2017 22:31:53 *****
348   Hello World! arm
349
350Debugging
351=========
352
353Provided that you have a JTAG probe, you can debug an application in the usual
354way.  Here is an example for the :zephyr:code-sample:`hello_world` application.
355
356.. zephyr-app-commands::
357   :zephyr-app: samples/hello_world
358   :board: olimex_stm32_e407
359   :maybe-skip-config:
360   :goals: debug
361
362.. _OLIMEX-STM32-E407 website:
363   https://www.olimex.com/Products/ARM/ST/STM32-E407/open-source-hardware
364
365.. _OLIMEX-STM32-E407 user manual:
366   https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407.pdf
367
368.. _ST STM32F407ZG Datasheet:
369   https://www.st.com/resource/en/reference_manual/dm00031020.pdf
370