1.. zephyr:board:: stm32f4_disco
2
3Overview
4********
5
6The STM32F4DISCOVERY Discovery kit features an ARM Cortex-M4 based STM32F407VG MCU
7with a wide range of connectivity support and configurations Here are
8some highlights of the STM32F4DISCOVERY board:
9
10
11- STM32 microcontroller in LQFP100 package
12- Extension header for all LQFP100 I/Os for quick connection to prototyping board and easy probing
13- On-board ST-LINK/V2 debugger/programmer with SWD connector
14- Flexible board power supply:
15
16       - USB VBUS or external source(3.3V, 5V, 7 - 12V)
17       - Power management access point
18
19- Eight LEDs:
20
21       - USB communication (LD1)
22       - 3.3 V power on (LD2)
23       - Four user LEDs: orange (LD3), green (LD4), red (LD5), and blue (LD6)
24       - 2 USB OTG LEDs for VBUS (LD7) and over-current (LD8)
25
26- Two push-buttons: USER and RESET
27- USB OTG FS with micro-AB connector
28- LIS302DL or LIS3DSH ST MEMS 3-axis accelerometer
29- MP45DT02 ST-MEMS audio sensor omni-directional digital microphone
30- CS43L22 audio DAC with integrated class D speaker driver
31
32More information about the board can be found at the `STM32F4DISCOVERY website`_.
33
34Hardware
35********
36
37STM32F4DISCOVERY Discovery kit provides the following hardware components:
38
39- STM32F407VGT6 in LQFP100 package
40- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
41- 168 MHz max CPU frequency
42- VDD from 1.8 V to 3.6 V
43- 1 MB Flash
44- 192+4 KB SRAM including 64-Kbyte of core coupled memory
45- GPIO with external interrupt capability
46- 3x12-bit ADC with 24 channels
47- 2x12-bit D/A converters
48- RTC
49- Advanced-control Timer
50- General Purpose Timers (17)
51- Watchdog Timers (2)
52- USART/UART (6)
53- I2C (3)
54- SPI (3)
55- SDIO
56- 2xCAN
57- USB 2.0 OTG FS with on-chip PHY
58- USB 2.0 OTG HS/FS with dedicated DMA, on-chip full-speed PHY and ULPI
59- 10/100 Ethernet MAC with dedicated DMA
60- 8- to 14-bit parallel camera
61- CRC calculation unit
62- True random number generator
63- DMA Controller
64
65More information about STM32F407VG can be found here:
66       - `STM32F407VG on www.st.com`_
67       - `STM32F407 reference manual`_
68
69Supported Features
70==================
71
72The Zephyr stm32f4_disco board configuration supports the following hardware features:
73
74+-----------+------------+-------------------------------------+
75| Interface | Controller | Driver/Component                    |
76+===========+============+=====================================+
77| NVIC      | on-chip    | nested vector interrupt controller  |
78+-----------+------------+-------------------------------------+
79| UART      | on-chip    | serial port-polling;                |
80|           |            | serial port-interrupt               |
81+-----------+------------+-------------------------------------+
82| PINMUX    | on-chip    | pinmux                              |
83+-----------+------------+-------------------------------------+
84| GPIO      | on-chip    | gpio                                |
85+-----------+------------+-------------------------------------+
86| PWM       | on-chip    | pwm                                 |
87+-----------+------------+-------------------------------------+
88| USB       | on-chip    | usb                                 |
89+-----------+------------+-------------------------------------+
90| CAN       | on-chip    | CAN controller                      |
91+-----------+------------+-------------------------------------+
92
93.. note:: CAN feature requires CAN transceiver, such as `SK Pang CAN breakout board`_.
94          Zephyr default configuration uses CAN_2 exclusively, as simultaneous use
95          of CAN_1 and CAN_2 is not yet supported.
96
97Other hardware features are not yet supported on Zephyr porting.
98
99The default configuration can be found in
100:zephyr_file:`boards/st/stm32f4_disco/stm32f4_disco_defconfig`
101
102
103Pin Mapping
104===========
105
106STM32F4DISCOVERY Discovery kit has 8 GPIO controllers. These controllers are responsible for pin muxing,
107input/output, pull-up, etc.
108
109For more details please refer to `STM32F4DISCOVERY board User Manual`_.
110
111Default Zephyr Peripheral Mapping:
112----------------------------------
113
114.. rst-class:: rst-columns
115
116- UART_1_TX : PB6
117- UART_1_RX : PB7
118- UART_2_TX : PA2
119- UART_2_RX : PA3
120- USER_PB : PA0
121- LD3 : PD13
122- LD4 : PD12
123- LD5 : PD14
124- LD6 : PD15
125- USB DM : PA11
126- USB DP : PA12
127- CAN1_RX : PB8
128- CAN1_TX : PB9
129- CAN2_RX : PB5
130- CAN2_TX : PB13
131
132System Clock
133============
134
135STM32F4DISCOVERY System Clock could be driven by internal or external oscillator,
136as well as main PLL clock. By default System clock is driven by PLL clock at 168MHz,
137driven by 8MHz high speed external clock.
138
139Serial Port
140===========
141
142STM32F4DISCOVERY Discovery kit has up to 6 UARTs. The Zephyr console output is assigned to UART2.
143Default settings are 115200 8N1.
144Please note that ST-Link Virtual Com Port is not wired to chip serial port. In order to
145enable console output you should use a serial cable and connect it to UART2 pins (PA2/PA3).
146
147
148Programming and Debugging
149*************************
150
151STM32F4DISCOVERY Discovery kit includes an ST-LINK/V2 embedded debug tool interface.
152
153Applications for the ``stm32f4_disco`` board configuration can be built and
154flashed in the usual way (see :ref:`build_an_application` and
155:ref:`application_run` for more details).
156
157Flashing
158========
159
160The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
161so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
162
163Alternatively, OpenOCD or JLink can also be used to flash the board using
164the ``--runner`` (or ``-r``) option:
165
166.. code-block:: console
167
168   $ west flash --runner openocd
169   $ west flash --runner jlink
170
171Flashing an application to STM32F4DISCOVERY
172-------------------------------------------
173
174Here is an example for the :zephyr:code-sample:`blinky` application.
175
176Run a serial host program to connect with your board:
177
178.. code-block:: console
179
180   $ minicom -D /dev/ttyACM0
181
182Build and flash the application:
183
184.. zephyr-app-commands::
185   :zephyr-app: samples/basic/blinky
186   :board: stm32f4_disco
187   :goals: build flash
188
189You should see user led "LD4" blinking.
190
191Debugging
192=========
193
194You can debug an application in the usual way.  Here is an example for the
195:zephyr:code-sample:`hello_world` application.
196
197.. zephyr-app-commands::
198   :zephyr-app: samples/hello_world
199   :board: stm32f4_disco
200   :maybe-skip-config:
201   :goals: debug
202
203.. _STM32F4DISCOVERY website:
204   https://www.st.com/en/evaluation-tools/stm32f4discovery.html
205
206.. _STM32F4DISCOVERY board User Manual:
207   https://www.st.com/resource/en/user_manual/dm00039084.pdf
208
209.. _STM32F407VG on www.st.com:
210   https://www.st.com/en/microcontrollers/stm32f407vg.html
211
212.. _STM32F407 reference manual:
213   https://www.st.com/resource/en/reference_manual/dm00031020.pdf
214
215.. _SK Pang CAN breakout board:
216   https://www.skpang.co.uk/products/can-bus-can-fd-breakout-board-5v-supply-and-3-3v-logic
217
218.. _STM32CubeProgrammer:
219   https://www.st.com/en/development-tools/stm32cubeprog.html
220