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