1.. zephyr:board:: olimex_stm32_p405
2
3Overview
4********
5
6The OLIMEX-STM32-P405 board is based on the STMicroelectronics STM32F405RG ARM
7Cortex-M4 CPU.
8
9Hardware
10********
11
12Information about the board can be found at the
13`OLIMEX-STM32-P405 website`_ and `OLIMEX-STM32-P405 user manual`_.
14The `ST STM32F405RG Datasheet`_ contains the processor's
15information and the datasheet.
16
17Supported Features
18==================
19
20The olimex_stm32_p405 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
36Other hardware features have not been enabled yet for this board.
37
38Pin Mapping
39===========
40
41.. figure:: img/olimex-stm32-p405-front.jpg
42     :align: center
43     :alt: OLIMEX-STM32-P405 connectors
44
45     OLIMEX-STM32-P405 connectors
46
47LED
48---
49
50* USER_LED (red) = PC12
51* PWR_LED (red) = power
52
53Push buttons
54------------
55
56* USER_BUTTON = PA0
57* RST = NRST
58
59External Connectors
60-------------------
61
62JTAG debug
63
64+-------+--------------+-------+--------------+
65| PIN # | Signal Name  | Pin # | Signal Name  |
66+=======+==============+=======+==============+
67| 1     | +3.3V        | 11    | -            |
68+-------+--------------+-------+--------------+
69| 2     | +3.3V        | 12    | GND          |
70+-------+--------------+-------+--------------+
71| 3     | PB4 / TRST   | 13    | PB3 / TDO    |
72+-------+--------------+-------+--------------+
73| 4     | GND          | 14    | GND          |
74+-------+--------------+-------+--------------+
75| 5     | PA15 / TDI   | 15    | PB4 / TRST   |
76+-------+--------------+-------+--------------+
77| 6     | GND          | 16    | GND          |
78+-------+--------------+-------+--------------+
79| 7     | PA13 / TMS   | 17    | -            |
80+-------+--------------+-------+--------------+
81| 8     | GND          | 18    | GND          |
82+-------+--------------+-------+--------------+
83| 9     | PA14 / TCK   | 19    | +5V_JTAG     |
84+-------+--------------+-------+--------------+
85| 10    | GND          | 20    | GND          |
86+-------+--------------+-------+--------------+
87
88UEXT
89
90+-------+-----------------------+----------------+
91| PIN # | Wire   Name           | STM32F405 port |
92+=======+=======================+================+
93| 1     | +3.3V                 | -              |
94+-------+-----------------------+----------------+
95| 2     | GND                   | -              |
96+-------+-----------------------+----------------+
97| 3     | PA9/USART1_TX         | PA9            |
98+-------+-----------------------+----------------+
99| 4     | PA10/USART1_RX        | PA10           |
100+-------+-----------------------+----------------+
101| 5     | PB6/I2C1_SCL          | PB6            |
102+-------+-----------------------+----------------+
103| 6     | PB7/I2C1_SDA          | PB7            |
104+-------+-----------------------+----------------+
105| 7     | PA6/SPI1_MISO         | PA6            |
106+-------+-----------------------+----------------+
107| 8     | PA7/SPI1_MOSI         | PA7            |
108+-------+-----------------------+----------------+
109| 9     | PA5/SPI1_SCK          | PA5            |
110+-------+-----------------------+----------------+
111| 10    | PA4/SPI1_NSS          | PA4            |
112+-------+-----------------------+----------------+
113
114
115GPIO row of pins
116
117+---------+----------------------------------------------+
118| Pin     | STM32F405 Pin Functions                      |
119+=========+==============================================+
120| 3V3     | N/A                                          |
121+---------+----------------------------------------------+
122| PA1     | PA1/USART2_RTS/ADC1/TIM2_CH2                 |
123+---------+----------------------------------------------+
124| PA8     | PA8/USART1_CK/TIM1_CH1/MCO                   |
125+---------+----------------------------------------------+
126| PB0     | PB0/ADC8/TIM3_CH3/TIM1_CH2N                  |
127+---------+----------------------------------------------+
128| PB1     | PB1/ADC9/TIM3_CH4/TIM1_CH3N                  |
129+---------+----------------------------------------------+
130| PB2     | PB2/BOOT1                                    |
131+---------+----------------------------------------------+
132| PB5     | PB5/I2C1_SMBAI/TIM3_CH2/SPI1_MOSI            |
133+---------+----------------------------------------------+
134| PB8     | PB8/TIM4_CH3/I2C1_SCL/CANRX                  |
135+---------+----------------------------------------------+
136| PB9     | PB9/TIM4_CH4/I2C1_SDA/CANTX                  |
137+---------+----------------------------------------------+
138| VDDA    | N/A                                          |
139+---------+----------------------------------------------+
140| GNDA    | N/A                                          |
141+---------+----------------------------------------------+
142| PB10    | PB10/I2C2_SCL/USART3_TX/TIM2_CH3             |
143+---------+----------------------------------------------+
144| PB11    | PB11/I2C2_SDA/USART3_RX/TIM2_CH4             |
145+---------+----------------------------------------------+
146| PB12    | PB12/SPI2_NSS/I2C2_SMBAL/USART3_CK/TIM1_BKIN |
147+---------+----------------------------------------------+
148| PB13    | PB13/SPI2_SCK/USART3_CTS/TIM1_CH1N           |
149+---------+----------------------------------------------+
150| PB14    | PB14/SPI2_MISO/USART3_RTS/TIM1_CH2N          |
151+---------+----------------------------------------------+
152| PB15    | PB15/SPI2_MOSI/TIM1_CH3N                     |
153+---------+----------------------------------------------+
154| RST     | NRST                                         |
155+---------+----------------------------------------------+
156| PC0     | PC0/ADC10                                    |
157+---------+----------------------------------------------+
158| PC1     | PC1/ADC11                                    |
159+---------+----------------------------------------------+
160| PC2     | PC2/ADC12                                    |
161+---------+----------------------------------------------+
162| PC3     | PC3/ADC13                                    |
163+---------+----------------------------------------------+
164| PC4     | PC4/ADC14                                    |
165+---------+----------------------------------------------+
166| PC5     | PC5/ADC15                                    |
167+---------+----------------------------------------------+
168| PC6     | PC6/TIM3_CH1                                 |
169+---------+----------------------------------------------+
170| PC7     | PC7/TIM3_CH2                                 |
171+---------+----------------------------------------------+
172| PC8     | PC8/TIM3_CH3                                 |
173+---------+----------------------------------------------+
174| PC9     | PC9/TIM3_CH4                                 |
175+---------+----------------------------------------------+
176| PC10    | PC10/USART3_TX                               |
177+---------+----------------------------------------------+
178| PC12    | PC12/USART3_CK                               |
179+---------+----------------------------------------------+
180| PC13    | PC13/ANTI_TAMP                               |
181+---------+----------------------------------------------+
182| PD2     | PD2/TIM3_ETR                                 |
183+---------+----------------------------------------------+
184| +5V_USB | N/A                                          |
185+---------+----------------------------------------------+
186| VIN     | N/A                                          |
187+---------+----------------------------------------------+
188| GND     | N/A                                          |
189+---------+----------------------------------------------+
190
191
192
193System Clock
194============
195
196OLIMEX-STM32-P405 has two external oscillators. The frequency of
197the slow clock is 32.768 kHz. The frequency of the main clock
198is 8 MHz. The processor can setup HSE to drive the master clock,
199which can be set as high as 168 MHz.
200
201Programming and Debugging
202*************************
203The OLIMEX-STM32-P405 board does not include an embedded debug tool
204interface. You will need to use ST tools or an external JTAG probe.
205In the following examples a ST-Link V2 USB dongle is used.
206
207Flashing an application to the Olimex-STM32-P405
208================================================
209
210The sample application :zephyr:code-sample:`hello_world` is being used in this tutorial.
211
212Connect the ST-Link USB dongle to your host computer and to the JTAG port of
213the OLIMEX-STM32-P405 board.
214
215Now build and flash the application.
216
217.. zephyr-app-commands::
218   :zephyr-app: samples/hello_world
219   :board: olimex_stm32_p405
220   :goals: build flash
221
222Run a serial host program to connect with your board:
223
224.. code-block:: console
225
226   $ minicom -D /dev/ttyACM0
227
228After resetting the board, you should see the following message:
229
230.. code-block:: console
231
232   ***** BOOTING ZEPHYR OS v1.8.99 - BUILD: Aug  4 2017 14:54:40 *****
233   Hello World! arm
234
235Debugging
236=========
237
238You can debug an application in the usual way.  Here is an example for the
239:zephyr:code-sample:`hello_world` application.
240
241.. zephyr-app-commands::
242   :zephyr-app: samples/hello_world
243   :board: olimex_stm32_p405
244   :maybe-skip-config:
245   :goals: debug
246
247.. _OLIMEX-STM32-P405 website:
248   https://www.olimex.com/Products/ARM/ST/STM32-P405/
249
250.. _OLIMEX-STM32-P405 user manual:
251   https://www.olimex.com/Products/ARM/ST/STM32-P405/resources/STM32-P405_UM.pdf
252
253.. _ST STM32F405RG Datasheet:
254   https://www.st.com/resource/en/reference_manual/dm00031020.pdf
255