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
113Other hardware features are not yet supported on Zephyr porting.
114
115The default configuration can be found in the defconfig file:
116
117	``boards/arm/stm32f3_disco/stm32f3_disco_defconfig``
118
119
120Pin Mapping
121===========
122
123STM32F3DISCOVERY Discovery kit has 6 GPIO controllers. These controllers are
124responsible for pin muxing, input/output, pull-up, etc.
125
126For mode details please refer to `STM32F3DISCOVERY board User Manual`_.
127
128Default Zephyr Peripheral Mapping:
129----------------------------------
130
131.. rst-class:: rst-columns
132
133- UART_1_TX : PC4
134- UART_1_RX : PC5
135- UART_2_TX : PA2
136- UART_2_RX : PA3
137- UART_4_TX : PC10
138- UART_4_RX : PC11
139- I2C1_SCL : PB6
140- I2C1_SDA : PB7
141- I2C2_SCL : PA9
142- I2C2_SDA : PA10
143- SPI1_NSS : PA4
144- SPI1_SCK : PA5
145- SPI1_MISO : PA6
146- SPI1_MOSI : PA7
147- SPI2_NSS : PB12
148- SPI2_SCK : PB13
149- SPI2_MISO : PB14
150- SPI2_MOSI : PB15
151- CAN1_RX : PD0
152- CAN1_TX : PD1
153- USB_DM : PA11
154- USB_DP : PA12
155- USER_PB : PA0
156- LD3 : PE9
157- LD4 : PE8
158- LD5 : PE10
159- LD6 : PE15
160- LD7 : PE11
161- LD8 : PE14
162- LD9 : PE12
163- LD10 : PE13
164- PWM : PA8
165- ADC1 : PA0
166- DAC1 : PA4
167
168System Clock
169============
170
171STM32F3DISCOVERY System Clock could be driven by internal or external
172oscillator, as well as main PLL clock. By default System clock is driven
173by PLL clock at 72 MHz, driven by 8 MHz MCO from the ST Link.
174
175Serial Port
176===========
177
178STM32F3DISCOVERY Discovery kit has up to 5 UARTs. The Zephyr console output
179is assigned to UART1. Default settings are 115200 8N1.
180
181I2C
182===
183
184STM32F3DISCOVERY has up to 2 I2Cs. I2C1 is connected to the LSM303DLHC and is
185an ultra-compact low-power system-in-package featuring a 3D digital linear
186acceleration sensor and a 3D digital magnetic sensor.
187
188USB
189===
190STM32F3DISCOVERY has a USB 2.0 full-speed device interface available through
191its mini USB connector (USB USER).
192
193CAN
194===
195The STM32F3DISCOVERY does not have an onboard CAN transceiver. In
196order to use the CAN bus on the this board, an external CAN bus
197transceiver must be connected to ``PD0`` (``CAN1_RX``) and ``PD1``
198(``CAN1_TX``).
199
200Programming and Debugging
201*************************
202
203Flashing
204========
205
206STM32F3DISCOVERY Discovery kit includes a ST-LINK/V2 or ST-LINK/V2-B embedded
207debug tool interface.
208
209Applications for the ``stm32f3_disco`` board configuration can be built and
210flashed in the usual way (see :ref:`build_an_application` and
211:ref:`application_run` for more details).
212
213Flashing an application to STM32F3DISCOVERY
214-------------------------------------------
215
216First, connect the STM32F3DISCOVERY Discovery kit to your host computer using
217the USB port to prepare it for flashing. Then build and flash your application.
218
219Here is an example for the :ref:`hello_world` application.
220
221.. zephyr-app-commands::
222   :zephyr-app: samples/hello_world
223   :board: stm32f3_disco
224   :goals: build flash
225
226
227In case you are using a recent PCB revision (E or newer), you have to use an
228adapted board definition:
229
230.. zephyr-app-commands::
231   :zephyr-app: samples/hello_world
232   :board: stm32f3_disco@E
233   :goals: build flash
234
235Run a serial host program to connect with your board. For PCB version A or B a
236TTL(3.3V) serial adapter is required. For PCB version C and newer a Virtual Com
237Port (VCP) is available on the  USB ST-LINK port.
238
239.. code-block:: console
240
241   $ minicom -D /dev/<tty device>
242
243Replace <tty_device> with the port where the STM32F3DISCOVERY board can be
244found. For example, under Linux, /dev/ttyUSB0.
245
246You should see the following message on the console:
247
248.. code-block:: console
249
250   Hello World! arm
251
252
253Debugging
254=========
255
256You can debug an application in the usual way.  Here is an example for the
257:ref:`hello_world` application.
258
259.. zephyr-app-commands::
260   :zephyr-app: samples/hello_world
261   :board: stm32f3_disco
262   :goals: debug
263
264Again you have to use the adapted command for newer PCB revisions (E and newer):
265
266.. zephyr-app-commands::
267   :zephyr-app: samples/hello_world
268   :board: stm32f3_disco@E
269   :goals: debug
270
271.. _STM32F3DISCOVERY website:
272   https://www.st.com/en/evaluation-tools/stm32f3discovery.html
273
274.. _STM32F3DISCOVERY board User Manual:
275   https://www.st.com/resource/en/user_manual/dm00063382.pdf
276
277.. _STM32F303VC on www.st.com:
278   https://www.st.com/en/microcontrollers/stm32f303vc.html
279
280.. _STM32F303xC reference manual:
281   https://www.st.com/resource/en/reference_manual/dm00043574.pdf
282