1.. zephyr:board:: stm32f412g_disco
2
3Overview
4********
5
6The STM32F412 Discovery kit features an ARM Cortex-M4 based STM32F412ZG MCU
7with a wide range of connectivity support and configurations Here are
8some highlights of the STM32F412G-DISCO board:
9
10
11- STM32F412ZGT6 microcontroller featuring 1 Mbyte of Flash memory and 256 Kbytes of RAM in an LQFP144 package
12- On-board ST-LINK/V2-1 SWD debugger supporting USB re-enumeration capability:
13
14       - USB virtual COM port
15       - mass storage
16       - debug port
17
18- 1.54 inch 240x240 pixel TFT color LCD with parallel interface and capacitive touchscreen
19- I2S Audio CODEC, with a stereo headset jack, including analog microphone input and a loudspeaker output
20- Stereo digital MEMS microphones
21- MicroSD card connector extension
22- I2C extension connector
23- 128 Mbit Quad-SPI Nor Flash
24- Reset button and Joystick
25- Four color user LEDs.
26- USB OTG FS with Micro-AB connector
27- Four power supply options:
28
29       - ST-LINK/V2-1 USB connector
30       - User USB FS connector
31       - VIN from Arduino* connectors
32       - + 5 V from Arduino* connectors
33
34- Two power supplies for MCU: 2.0 V and 3.3 V
35- Compatible with Arduino(tm) Uno revision 3 connectors
36- Extension connector for direct access to various features of STM32F412ZGT6 MCU
37- Comprehensive free software including a variety of examples, part of STM32Cube package
38
39More information about the board can be found at the `32F412GDISCOVERY website`_.
40
41Hardware
42********
43
44STM32F412G-DISCO Discovery kit provides the following hardware components:
45
46- STM32F412ZGT6 in LQFP144 package
47- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
48- 100 MHz max CPU frequency
49- VDD from 1.7 V to 3.6 V
50- 1 MB Flash
51- 256 KB SRAM
52- GPIO with external interrupt capability
53- LCD parallel interface, 8080/6800 modes
54- 1x12-bit ADC with 16 channels
55- RTC
56- Advanced-control Timer
57- General Purpose Timers (12)
58- Watchdog Timers (2)
59- USART/UART (4)
60- I2C (4)
61- SPI (5)
62- SDIO
63- 2xCAN
64- CRC calculation unit
65- True random number generator
66- DMA Controller
67
68More information about STM32F412ZG can be found here:
69       - `STM32F412ZG on www.st.com`_
70       - `STM32F412 reference manual`_
71
72Supported Features
73==================
74
75The Zephyr stm32f412g_disco board configuration supports the following hardware features:
76
77+-----------+------------+-------------------------------------+
78| Interface | Controller | Driver/Component                    |
79+===========+============+=====================================+
80| NVIC      | on-chip    | nested vector interrupt controller  |
81+-----------+------------+-------------------------------------+
82| UART      | on-chip    | serial port-polling;                |
83|           |            | serial port-interrupt               |
84+-----------+------------+-------------------------------------+
85| PINMUX    | on-chip    | pinmux                              |
86+-----------+------------+-------------------------------------+
87| GPIO      | on-chip    | gpio                                |
88+-----------+------------+-------------------------------------+
89| I2C       | on-chip    | i2c                                 |
90+-----------+------------+-------------------------------------+
91| SPI       | on-chip    | spi                                 |
92+-----------+------------+-------------------------------------+
93| QSPI NOR  | on-chip    | off-chip flash                      |
94+-----------+------------+-------------------------------------+
95
96Other hardware features are not yet supported on Zephyr porting.
97
98The default configuration can be found in
99:zephyr_file:`boards/st/stm32f412g_disco/stm32f412g_disco_defconfig`
100
101
102Pin Mapping
103===========
104
105STM32F412G-DISCO Discovery kit has 8 GPIO controllers. These controllers are responsible for pin muxing,
106input/output, pull-up, etc.
107
108For more details please refer to `32F412GDISCOVERY board User Manual`_.
109
110Default Zephyr Peripheral Mapping:
111----------------------------------
112- UART_2_TX : PA2
113- UART_2_RX : PA3
114- LD1 : PE0
115- LD2 : PE1
116- LD3 : PE2
117- LD4 : PE3
118
119System Clock
120============
121
122STM32F412G-DISCO System Clock could be driven by internal or external oscillator,
123as well as main PLL clock. By default System clock is driven by PLL clock at 100MHz,
124driven internal oscillator.
125
126Serial Port
127===========
128
129The STM32F412G Discovery kit has up to 4 UARTs. The Zephyr console output is assigned to UART2.
130Default settings are 115200 8N1.
131
132
133Programming and Debugging
134*************************
135
136STM32F412G-DISCO Discovery kit includes an ST-LINK/V2 embedded debug tool interface.
137
138Applications for the ``stm32f412g_disco`` board configuration can be built and
139flashed in the usual way (see :ref:`build_an_application` and
140:ref:`application_run` for more details).
141
142Flashing
143========
144
145The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
146so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
147
148Alternatively, OpenOCD or JLink can also be used to flash the board using
149the ``--runner`` (or ``-r``) option:
150
151.. code-block:: console
152
153   $ west flash --runner openocd
154   $ west flash --runner jlink
155
156Flashing an application to STM32F412G-DISCO
157-------------------------------------------
158
159Connect the STM32F412G-DISCO Discovery kit to your host computer using
160the USB port, then run a serial host program to connect with your
161board:
162
163.. code-block:: console
164
165   $ minicom -D /dev/ttyACM0
166
167Then build and flash an application. Here is an example for the
168:zephyr:code-sample:`hello_world` application.
169
170.. zephyr-app-commands::
171   :zephyr-app: samples/hello_world
172   :board: stm32f412g_disco
173   :goals: build flash
174
175You should see the following message on the console:
176
177.. code-block:: console
178
179   Hello World! arm
180
181
182Debugging
183=========
184
185You can debug an application in the usual way.  Here is an example for the
186:zephyr:code-sample:`hello_world` application.
187
188.. zephyr-app-commands::
189   :zephyr-app: samples/hello_world
190   :board: stm32f412g_disco
191   :maybe-skip-config:
192   :goals: debug
193
194.. _32F412GDISCOVERY website:
195   https://www.st.com/en/evaluation-tools/32f412gdiscovery.html
196
197.. _32F412GDISCOVERY board User Manual:
198   https://www.st.com/resource/en/user_manual/dm00275919.pdf
199
200.. _STM32F412ZG on www.st.com:
201   https://www.st.com/en/microcontrollers/stm32f412zg.html
202
203.. _STM32F412 reference manual:
204   https://www.st.com/resource/en/reference_manual/dm00180369.pdf
205
206.. _STM32CubeProgrammer:
207   https://www.st.com/en/development-tools/stm32cubeprog.html
208