1.. zephyr:board:: stm32f072b_disco
2
3Overview
4********
5
6The STM32F072B-DISCO Discovery kit features an ARM Cortex-M0 based STM32F072RB
7MCU with everything required for beginners and experienced users to get
8started quickly. Here are some highlights of the STM32F072B-DISCO board:
9
10- STM32 microcontroller in LQFP64 package
11- Extension header for LQFP64 I/Os for a quick connection to the prototyping
12  board and easy probing
13- On-board ST-LINK/V2, debugger/programmer with SWD connector
14- Board power supply: through USB bus or from an external 5 V supply voltage
15- External application power supply: 3 V and 5 V
16
17- Six LEDs:
18
19  - LD1 (red/green) for USB communication
20  - LD2 (red) for 3.3 V power on
21  - Four user LEDs: LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue)
22
23- Two push-buttons: USER and RESET
24- USB USER with Mini-B connector
25- L3GD20, ST MEMS motion sensor, 3-axis digital output gyroscope
26- One linear touch sensor or four touch keys
27- RF EEprom daughter board connector
28
29More information about the board can be found at the
30`STM32F072B-DISCO website`_.
31
32Hardware
33********
34
35STM32F072B-DISCO Discovery kit provides the following hardware components:
36
37- STM32F072RBTT6 in LQFP64 package
38- ARM |reg| 32-bit Cortex |reg| -M0 CPU
39- 48 MHz max CPU frequency
40- VDD from 2.0 V to 3.6 V
41- 128 KB Flash
42- 16 KB SRAM
43- GPIO with external interrupt capability
44- 12-bit ADC with 39 channels
45- 12-bit D/A converters
46- RTC
47- General Purpose Timers (12)
48- USART/UART (4)
49- I2C (2)
50- SPI (2)
51- CAN
52- USB 2.0 full speed interface
53- DMA Controller
54- 24 capacitive sensing channels for touchkey, linear and rotary touch sensors
55
56More information about STM32F072RB can be found here:
57       - `STM32F072RB on www.st.com`_
58       - `STM32F072xB reference manual`_
59
60Supported Features
61==================
62
63The Zephyr stm32f072b_disco board configuration supports the following hardware
64features:
65
66+-----------+------------+-------------------------------------+
67| Interface | Controller | Driver/Component                    |
68+===========+============+=====================================+
69| NVIC      | on-chip    | nested vector interrupt controller  |
70+-----------+------------+-------------------------------------+
71| UART      | on-chip    | serial port-polling;                |
72|           |            | serial port-interrupt               |
73+-----------+------------+-------------------------------------+
74| PINMUX    | on-chip    | pinmux                              |
75+-----------+------------+-------------------------------------+
76| GPIO      | on-chip    | gpio                                |
77+-----------+------------+-------------------------------------+
78| CLOCK     | on-chip    | reset and clock control             |
79+-----------+------------+-------------------------------------+
80| WATCHDOG  | on-chip    | independent watchdog                |
81+-----------+------------+-------------------------------------+
82| I2C       | on-chip    | i2c controller                      |
83+-----------+------------+-------------------------------------+
84| SPI       | on-chip    | SPI controller                      |
85+-----------+------------+-------------------------------------+
86| CAN       | on-chip    | CAN controller                      |
87+-----------+------------+-------------------------------------+
88
89.. note:: CAN feature requires CAN transceiver, such as `SK Pang CAN breakout board`_.
90
91Other hardware features are not yet supported in this Zephyr port.
92
93The default configuration can be found in
94:zephyr_file:`boards/st/stm32f072b_disco/stm32f072b_disco_defconfig`
95
96
97Pin Mapping
98===========
99
100STM32F072B-DISCO Discovery kit has 6 GPIO controllers. These controllers are
101responsible for pin muxing, input/output, pull-up, etc.
102
103For more details please refer to `STM32F072B-DISCO board User Manual`_.
104
105Default Zephyr Peripheral Mapping:
106----------------------------------
107- UART_1_TX : PB6
108- UART_1_RX : PB7
109- I2C1_SCL : PB8
110- I2C1_SDA : PB9
111- I2C2_SCL : PB10
112- I2C2_SDA : PB11
113- SPI1_SCK : PB3
114- SPI1_MISO : PB4
115- SPI1_MOSI : PB5
116- USER_PB : PA0
117- LD3 : PC6
118- LD4 : PC8
119- LD5 : PC9
120- LD6 : PC7
121- CAN_RX : PB8
122- CAN_TX : PB9
123
124System Clock
125============
126
127STM32F072B-DISCO System Clock could be driven by internal or external
128oscillator, as well as main PLL clock. By default System clock is driven
129by PLL clock at 72 MHz, driven by internal 8 MHz oscillator.
130
131Serial Port
132===========
133
134STM32F072B-DISCO Discovery kit has up to 4 UARTs. The Zephyr console output
135is assigned to UART 1. Default settings are 115200 8N1.
136
137Programming and Debugging
138*************************
139
140STM32F072B-DISCO board includes an ST-LINK/V2 embedded debug tool interface.
141
142Applications for the ``stm32f072b_disco`` board configuration can be built and
143flashed in the usual way (see :ref:`build_an_application` and
144:ref:`application_run` for more details).
145
146Flashing
147========
148
149The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
150so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
151
152Alternatively, OpenOCD or JLink can also be used to flash the board using
153the ``--runner`` (or ``-r``) option:
154
155.. code-block:: console
156
157   $ west flash --runner openocd
158   $ west flash --runner jlink
159
160Flashing an application to STM32F072B-DISCO
161-------------------------------------------
162
163First, connect the STM32F072B-DISCO Discovery kit to your host computer using
164the USB port to prepare it for flashing. Then build and flash your application.
165
166Here is an example for the :zephyr:code-sample:`hello_world` application.
167
168.. zephyr-app-commands::
169   :zephyr-app: samples/hello_world
170   :board: stm32f072b_disco
171   :goals: build flash
172
173Run a serial host program to connect with your board. A TTL(3.3V) serial
174adapter is required.
175
176.. code-block:: console
177
178   $ minicom -D /dev/<tty device>
179
180Replace <tty_device> with the port where the serial adapter can be found.
181For example, under Linux, /dev/ttyUSB0.
182
183You should see the following message on the console:
184
185.. code-block:: console
186
187   Hello World! arm
188
189
190Debugging
191=========
192
193You can debug an application in the usual way.  Here is an example for the
194:zephyr:code-sample:`hello_world` application.
195
196.. zephyr-app-commands::
197   :zephyr-app: samples/hello_world
198   :board: stm32f072b_disco
199   :goals: debug
200
201References
202**********
203
204.. target-notes::
205
206.. _STM32F072B-DISCO website:
207   https://www.st.com/en/evaluation-tools/32f072bdiscovery.html
208
209
210.. _STM32F072B-DISCO board User Manual:
211   https://www.st.com/resource/en/user_manual/dm00099401.pdf
212
213.. _STM32F072RB on www.st.com:
214   https://www.st.com/en/microcontrollers/stm32f072rb.html
215
216.. _STM32F072xB reference manual:
217   https://www.st.com/resource/en/reference_manual/dm00031936.pdf
218
219.. _SK Pang CAN breakout board:
220   https://www.skpang.co.uk/products/can-bus-can-fd-breakout-board-5v-supply-and-5v-logic
221
222.. _STM32CubeProgrammer:
223   https://www.st.com/en/development-tools/stm32cubeprog.html
224