1.. _stm32f3_disco_board:
2
3ST STM32F3 Discovery
4####################
5
6Overview
7********
8
9The STM32F3DISCOVERY Discovery kit features an ARM Cortex-M4 based STM32F303VC
10MCU with everything required for beginners and experienced users to get
11started quickly. Here are some highlights of the STM32F3DISCOVERY board:
12
13- STM32 microcontroller in LQFP100 package
14- Extension header for all LQFP100 I/Os for quick connection to prototyping
15  board and easy probing
16- On-board, ST-LINK/V2 for PCB version A or B or ST-LINK/V2-B for PCB version
17  C and newer, debugger/programmer with SWD connector
18- Board power supply: through USB bus or from an external 3 V or 5 V supply
19  voltage
20- External application power supply: 3 V and 5 V
21
22- Ten LEDs:
23
24       - 3.3 V power on (LD1)
25       - USB communication (LD2)
26       - Eight user LEDs: red (LD3/LD10), blue (LD4/LD9), orange (LD5/LD9)
27         and green (LD6/LD7)
28
29- Two push-buttons: USER and RESET
30- USB USER with Mini-B connector
31- L3GD20 or I3G4250D, ST MEMS motion sensor, 3-axis digital output gyroscope
32- LSM303DLHC or LSM303AGR, ST MEMS system-in-package featuring a 3D digital linear
33  acceleration sensor and a 3D digital magnetic sensor;
34
35.. HINT::
36   Recent PCB revisions (E and newer) are shipped with I3G4250D and LSM303AGR.
37
38.. image:: img/stm32f3_disco.jpg
39     :align: center
40     :alt: STM32F3DISCOVERY
41
42More information about the board can be found at the
43`STM32F3DISCOVERY website`_.
44
45Hardware
46********
47
48STM32F3DISCOVERY Discovery kit provides the following hardware components:
49
50- STM32F303VCT6 in LQFP100 package
51- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
52- 72 MHz max CPU frequency
53- VDD from 2.0 V to 3.6 V
54- 256 KB Flash
55- 40 KB SRAM
56- Routine booster: 8 Kbytes of SRAM on instruction and data bus
57- GPIO with external interrupt capability
58- 4x12-bit ADC with 39 channels
59- 2x12-bit D/A converters
60- RTC
61- General Purpose Timers (13)
62- USART/UART (5)
63- I2C (2)
64- SPI (3)
65- CAN
66- USB 2.0 full speed interface
67- Infrared transmitter
68- DMA Controller
69
70More information about STM32F303VC can be found here:
71       - `STM32F303VC on www.st.com`_
72       - `STM32F303xC reference manual`_
73
74Supported Features
75==================
76
77The Zephyr stm32f3_disco board configuration supports the following hardware
78features:
79
80+-----------+------------+-------------------------------------+
81| Interface | Controller | Driver/Component                    |
82+===========+============+=====================================+
83| NVIC      | on-chip    | nested vector interrupt controller  |
84+-----------+------------+-------------------------------------+
85| UART      | on-chip    | serial port-polling;                |
86|           |            | serial port-interrupt               |
87+-----------+------------+-------------------------------------+
88| PINMUX    | on-chip    | pinmux                              |
89+-----------+------------+-------------------------------------+
90| GPIO      | on-chip    | gpio                                |
91+-----------+------------+-------------------------------------+
92| I2C       | on-chip    | i2c                                 |
93+-----------+------------+-------------------------------------+
94| SPI       | on-chip    | spi                                 |
95+-----------+------------+-------------------------------------+
96| USB       | on-chip    | USB device                          |
97+-----------+------------+-------------------------------------+
98| CAN       | on-chip    | CAN                                 |
99+-----------+------------+-------------------------------------+
100| IWDG      | on-chip    | Independent WatchDoG                |
101+-----------+------------+-------------------------------------+
102| PWM       | on-chip    | pwm                                 |
103+-----------+------------+-------------------------------------+
104| ADC       | on-chip    | adc                                 |
105+-----------+------------+-------------------------------------+
106| DAC       | on-chip    | dac                                 |
107+-----------+------------+-------------------------------------+
108| DMA       | on-chip    | Direct Memory Access                |
109+-----------+------------+-------------------------------------+
110| die-temp  | on-chip    | die temperature sensor              |
111+-----------+------------+-------------------------------------+
112| RTC       | on-chip    | rtc                                 |
113+-----------+------------+-------------------------------------+
114
115Other hardware features are not yet supported on Zephyr porting.
116
117The default configuration can be found in
118:zephyr_file:`boards/st/stm32f3_disco/stm32f3_disco_defconfig`
119
120
121Pin Mapping
122===========
123
124STM32F3DISCOVERY Discovery kit has 6 GPIO controllers. These controllers are
125responsible for pin muxing, input/output, pull-up, etc.
126
127For more details please refer to `STM32F3DISCOVERY board User Manual`_.
128
129Default Zephyr Peripheral Mapping:
130----------------------------------
131
132.. rst-class:: rst-columns
133
134- UART_1_TX : PC4
135- UART_1_RX : PC5
136- UART_2_TX : PA2
137- UART_2_RX : PA3
138- UART_4_TX : PC10
139- UART_4_RX : PC11
140- I2C1_SCL : PB6
141- I2C1_SDA : PB7
142- I2C2_SCL : PA9
143- I2C2_SDA : PA10
144- SPI1_NSS : PA4
145- SPI1_SCK : PA5
146- SPI1_MISO : PA6
147- SPI1_MOSI : PA7
148- SPI2_NSS : PB12
149- SPI2_SCK : PB13
150- SPI2_MISO : PB14
151- SPI2_MOSI : PB15
152- CAN1_RX : PD0
153- CAN1_TX : PD1
154- USB_DM : PA11
155- USB_DP : PA12
156- USER_PB : PA0
157- LD3 : PE9
158- LD4 : PE8
159- LD5 : PE10
160- LD6 : PE15
161- LD7 : PE11
162- LD8 : PE14
163- LD9 : PE12
164- LD10 : PE13
165- PWM : PA8
166- ADC1 : PA0
167- DAC1 : PA4
168
169System Clock
170============
171
172STM32F3DISCOVERY System Clock could be driven by internal or external
173oscillator, as well as main PLL clock. By default System clock is driven
174by PLL clock at 72 MHz, driven by 8 MHz MCO from the ST Link.
175
176Serial Port
177===========
178
179STM32F3DISCOVERY Discovery kit has up to 5 UARTs. The Zephyr console output
180is assigned to UART1. Default settings are 115200 8N1.
181
182I2C
183===
184
185STM32F3DISCOVERY has up to 2 I2Cs. I2C1 is connected to the LSM303DLHC and is
186an ultra-compact low-power system-in-package featuring a 3D digital linear
187acceleration sensor and a 3D digital magnetic sensor.
188
189USB
190===
191STM32F3DISCOVERY has a USB 2.0 full-speed device interface available through
192its mini USB connector (USB USER).
193
194CAN
195===
196The STM32F3DISCOVERY does not have an onboard CAN transceiver. In
197order to use the CAN bus on the this board, an external CAN bus
198transceiver must be connected to ``PD0`` (``CAN1_RX``) and ``PD1``
199(``CAN1_TX``).
200
201Programming and Debugging
202*************************
203
204Flashing
205========
206
207STM32F3DISCOVERY Discovery kit includes a ST-LINK/V2 or ST-LINK/V2-B embedded
208debug tool interface.
209
210Applications for the ``stm32f3_disco`` board configuration can be built and
211flashed in the usual way (see :ref:`build_an_application` and
212:ref:`application_run` for more details).
213
214Flashing an application to STM32F3DISCOVERY
215-------------------------------------------
216
217First, connect the STM32F3DISCOVERY Discovery kit to your host computer using
218the USB port to prepare it for flashing. Then build and flash your application.
219
220Here is an example for the :ref:`hello_world` application.
221
222.. zephyr-app-commands::
223   :zephyr-app: samples/hello_world
224   :board: stm32f3_disco
225   :goals: build flash
226
227
228In case you are using a recent PCB revision (E or newer), you have to use an
229adapted board definition:
230
231.. zephyr-app-commands::
232   :zephyr-app: samples/hello_world
233   :board: stm32f3_disco@E
234   :goals: build flash
235
236Run a serial host program to connect with your board. For PCB version A or B a
237TTL(3.3V) serial adapter is required. For PCB version C and newer a Virtual Com
238Port (VCP) is available on the  USB ST-LINK port.
239
240.. code-block:: console
241
242   $ minicom -D /dev/<tty device>
243
244Replace <tty_device> with the port where the STM32F3DISCOVERY board can be
245found. For example, under Linux, /dev/ttyUSB0.
246
247You should see the following message on the console:
248
249.. code-block:: console
250
251   Hello World! arm
252
253
254Debugging
255=========
256
257You can debug an application in the usual way.  Here is an example for the
258:ref:`hello_world` application.
259
260.. zephyr-app-commands::
261   :zephyr-app: samples/hello_world
262   :board: stm32f3_disco
263   :goals: debug
264
265Again you have to use the adapted command for newer PCB revisions (E and newer):
266
267.. zephyr-app-commands::
268   :zephyr-app: samples/hello_world
269   :board: stm32f3_disco@E
270   :goals: debug
271
272.. _STM32F3DISCOVERY website:
273   https://www.st.com/en/evaluation-tools/stm32f3discovery.html
274
275.. _STM32F3DISCOVERY board User Manual:
276   https://www.st.com/resource/en/user_manual/dm00063382.pdf
277
278.. _STM32F303VC on www.st.com:
279   https://www.st.com/en/microcontrollers/stm32f303vc.html
280
281.. _STM32F303xC reference manual:
282   https://www.st.com/resource/en/reference_manual/dm00043574.pdf
283