Skip to content

Commit fa4ffc2

Browse files
AlexFabrekartben
authored andcommitted
boards: st: nucleo_f072rb: add support for Nucleo-F072RB board
Add support for the STMicroelectronics Nucleo-F072RB board. Signed-off-by: Alex Fabre <[email protected]>
1 parent 5449fbb commit fa4ffc2

13 files changed

+514
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# NUCLEO_F072RB board configuration
2+
3+
# Copyright (c) 2025 Alex Fabre
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_NUCLEO_F072RB
7+
8+
config SPI_STM32_INTERRUPT
9+
default y
10+
depends on SPI
11+
12+
endif # BOARD_NUCLEO_F072RB
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Alex Fabre
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_NUCLEO_F072RB
5+
select SOC_STM32F072XB
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2025 Alex Fabre
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
arduino_header: connector {
9+
compatible = "arduino-header-r3";
10+
#gpio-cells = <2>;
11+
gpio-map-mask = <0xffffffff 0xffffffc0>;
12+
gpio-map-pass-thru = <0 0x3f>;
13+
gpio-map = <0 0 &gpioa 0 0>, /* A0 */
14+
<1 0 &gpioa 1 0>, /* A1 */
15+
<2 0 &gpioa 4 0>, /* A2 */
16+
<3 0 &gpiob 0 0>, /* A3 */
17+
<4 0 &gpioc 1 0>, /* A4 */
18+
<5 0 &gpioc 0 0>, /* A5 */
19+
<6 0 &gpioa 3 0>, /* D0 */
20+
<7 0 &gpioa 2 0>, /* D1 */
21+
<8 0 &gpioa 10 0>, /* D2 */
22+
<9 0 &gpiob 3 0>, /* D3 */
23+
<10 0 &gpiob 5 0>, /* D4 */
24+
<11 0 &gpiob 4 0>, /* D5 */
25+
<12 0 &gpiob 10 0>, /* D6 */
26+
<13 0 &gpioa 8 0>, /* D7 */
27+
<14 0 &gpioa 9 0>, /* D8 */
28+
<15 0 &gpioc 7 0>, /* D9 */
29+
<16 0 &gpiob 6 0>, /* D10 */
30+
<17 0 &gpioa 7 0>, /* D11 */
31+
<18 0 &gpioa 6 0>, /* D12 */
32+
<19 0 &gpioa 5 0>, /* D13 */
33+
<20 0 &gpiob 9 0>, /* D14 */
34+
<21 0 &gpiob 8 0>; /* D15 */
35+
};
36+
};
37+
38+
arduino_i2c: &i2c1 {};
39+
arduino_spi: &spi1 {};

boards/st/nucleo_f072rb/board.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# keep first
4+
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
5+
board_runner_args(jlink "--device=STM32F072RB" "--speed=4000")
6+
7+
# keep first
8+
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
10+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/st/nucleo_f072rb/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: nucleo_f072rb
3+
full_name: Nucleo F072RB
4+
vendor: st
5+
socs:
6+
- name: stm32f072xb
Binary file not shown.
Binary file not shown.

boards/st/nucleo_f072rb/doc/index.rst

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
.. zephyr:board:: nucleo_f072rb
2+
3+
Overview
4+
********
5+
The STM32 Nucleo-64 development board with STM32F072RB MCU, supports Arduino and ST morpho connectivity.
6+
7+
The STM32 Nucleo board provides an affordable, and flexible way for users to try out new concepts,
8+
and build prototypes with the STM32 microcontroller, choosing from the various
9+
combinations of performance, power consumption, and features.
10+
11+
The Arduino* Uno V3 connectivity support and the ST morpho headers allow easy functionality
12+
expansion of the STM32 Nucleo open development platform with a wide choice of
13+
specialized shields.
14+
15+
The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer.
16+
17+
The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together
18+
with various packaged software examples.
19+
20+
More information about the board can be found at the `Nucleo F072RB website`_.
21+
22+
Hardware
23+
********
24+
Nucleo F072RB provides the following hardware components:
25+
26+
- STM32 microcontroller in QFP64 package
27+
- Two types of extension resources:
28+
29+
- Arduino* Uno V3 connectivity
30+
- ST morpho extension pin headers for full access to all STM32 I/Os
31+
32+
- On-board ST-LINK/V2-1 debugger/programmer with SWD connector:
33+
34+
- Selection-mode switch to use the kit as a standalone ST-LINK/V2-1
35+
36+
- Flexible board power supply:
37+
38+
- USB VBUS or external source (3.3V, 5V, 7 - 12V)
39+
- Power management access point
40+
41+
- Three LEDs:
42+
43+
- USB communication (LD1), user LED (LD2), power LED (LD3)
44+
45+
- Two push-buttons: USER and RESET
46+
- USB re-enumeration capability. Three different interfaces supported on USB:
47+
48+
- Virtual COM port
49+
- Mass storage
50+
- Debug port
51+
52+
More information about STM32F072RB can be found in
53+
the `STM32F072 reference manual`_ .
54+
55+
56+
Supported Features
57+
==================
58+
59+
The Zephyr ``nucleo_f072rb`` board supports the following hardware features:
60+
61+
+-----------+------------+-------------------------------------+
62+
| Interface | Controller | Driver/Component |
63+
+===========+============+=====================================+
64+
| NVIC | on-chip | nested vector interrupt controller |
65+
+-----------+------------+-------------------------------------+
66+
| UART | on-chip | serial port-polling; |
67+
| | | serial port-interrupt |
68+
+-----------+------------+-------------------------------------+
69+
| PINMUX | on-chip | pinmux |
70+
+-----------+------------+-------------------------------------+
71+
| GPIO | on-chip | gpio |
72+
+-----------+------------+-------------------------------------+
73+
| CLOCK | on-chip | reset and clock control |
74+
+-----------+------------+-------------------------------------+
75+
| FLASH | on-chip | flash memory |
76+
+-----------+------------+-------------------------------------+
77+
| WATCHDOG | on-chip | independent watchdog |
78+
+-----------+------------+-------------------------------------+
79+
| I2C | on-chip | i2c controller |
80+
+-----------+------------+-------------------------------------+
81+
| SPI | on-chip | SPI controller |
82+
+-----------+------------+-------------------------------------+
83+
| RTC | on-chip | rtc |
84+
+-----------+------------+-------------------------------------+
85+
86+
Other hardware features are not yet supported in this Zephyr port.
87+
88+
The default configuration can be found in
89+
:zephyr_file:`boards/st/nucleo_f072rb/nucleo_f072rb_defconfig`
90+
91+
Connections and IOs
92+
===================
93+
94+
Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
95+
input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
96+
GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
97+
capable except for analog inputs.
98+
99+
Board connectors:
100+
-----------------
101+
.. image:: img/nucleo_f072rb_connectors.webp
102+
:align: center
103+
:alt: Nucleo F072RB connectors
104+
105+
Default Zephyr Peripheral Mapping:
106+
----------------------------------
107+
108+
- UART_1 TX/RX : PA9/PA10
109+
- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual COM Port)
110+
- I2C1 SCL/SDA : PB8/PB9 (Arduino I2C)
111+
- I2C2 SCL/SDA : PB10/PB11
112+
- SPI1 NSS/SCK/MISO/MOSI : PB6/PA5/PA6/PA7 (Arduino SPI)
113+
- SPI2 SCK/MISO/MOSI : PB13/PB14/PB15
114+
- USER_PB : PC13
115+
- LD1 : PA5
116+
117+
For more details please refer to `STM32 Nucleo-64 board User Manual`_.
118+
119+
Programming and Debugging
120+
*************************
121+
122+
Nucleo F072RB board includes an ST-LINK/V2-1 embedded debug tool interface.
123+
124+
Applications for the ``nucleo_f072rb`` board configuration can be built and
125+
flashed in the usual way (see :ref:`build_an_application` and
126+
:ref:`application_run` for more details).
127+
128+
Flashing
129+
========
130+
131+
The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
132+
so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
133+
134+
Alternatively, OpenOCD or JLink can also be used to flash the board using
135+
the ``--runner`` (or ``-r``) option:
136+
137+
.. code-block:: console
138+
139+
$ west flash --runner openocd
140+
$ west flash --runner jlink
141+
142+
Flashing an application to Nucleo F072RB
143+
----------------------------------------
144+
145+
Here is an example for the :zephyr:code-sample:`blinky` application.
146+
147+
.. zephyr-app-commands::
148+
:zephyr-app: samples/basic/blinky
149+
:board: nucleo_f072rb
150+
:goals: build flash
151+
152+
You will see the LED blinking every second.
153+
154+
Debugging
155+
=========
156+
157+
You can debug an application in the usual way. Here is an example for the
158+
:zephyr:code-sample:`hello_world` application.
159+
160+
.. zephyr-app-commands::
161+
:zephyr-app: samples/hello_world
162+
:board: nucleo_f072rb
163+
:maybe-skip-config:
164+
:goals: debug
165+
166+
References
167+
**********
168+
169+
.. target-notes::
170+
171+
.. _Nucleo F072RB website:
172+
https://www.st.com/en/evaluation-tools/nucleo-f072rb.html
173+
174+
.. _STM32F072 reference manual:
175+
https://www.st.com/resource/en/reference_manual/dm00031936.pdf
176+
177+
.. _STM32 Nucleo-64 board User Manual:
178+
https://www.st.com/resource/en/user_manual/dm00105823.pdf
179+
180+
.. _STM32CubeProgrammer:
181+
https://www.st.com/en/development-tools/stm32cubeprog.html
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* Copyright (c) 2025 Alex Fabre
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <st/f0/stm32f072Xb.dtsi>
9+
#include <st/f0/stm32f072r(8-b)tx-pinctrl.dtsi>
10+
#include "arduino_r3_connector.dtsi"
11+
#include "st_morpho_connector.dtsi"
12+
#include <zephyr/dt-bindings/input/input-event-codes.h>
13+
14+
/ {
15+
model = "STMicroelectronics NUCLEO-F072RB board";
16+
compatible = "st,stm32f072rb-nucleo";
17+
18+
chosen {
19+
zephyr,console = &usart2;
20+
zephyr,shell-uart = &usart2;
21+
zephyr,sram = &sram0;
22+
zephyr,flash = &flash0;
23+
};
24+
25+
leds: leds {
26+
compatible = "gpio-leds";
27+
green_led_2: led_2 {
28+
gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
29+
label = "User LD2";
30+
};
31+
};
32+
33+
gpio_keys {
34+
compatible = "gpio-keys";
35+
user_button: button {
36+
label = "User";
37+
gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
38+
zephyr,code = <INPUT_KEY_0>;
39+
};
40+
};
41+
42+
aliases {
43+
led0 = &green_led_2;
44+
sw0 = &user_button;
45+
watchdog0 = &iwdg;
46+
die-temp0 = &die_temp;
47+
volt-sensor0 = &vref;
48+
};
49+
};
50+
51+
&clk_lse {
52+
status = "okay";
53+
};
54+
55+
&clk_hse {
56+
hse-bypass;
57+
clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
58+
status = "okay";
59+
};
60+
61+
&pll {
62+
clocks = <&clk_hse>;
63+
prediv = <1>;
64+
mul = <6>;
65+
status = "okay";
66+
};
67+
68+
&rcc {
69+
clocks = <&pll>;
70+
clock-frequency = <DT_FREQ_M(48)>;
71+
ahb-prescaler = <1>;
72+
apb1-prescaler = <2>;
73+
};
74+
75+
&usart1 {
76+
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
77+
pinctrl-names = "default";
78+
current-speed = <115200>;
79+
status = "okay";
80+
};
81+
82+
&usart2 {
83+
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
84+
pinctrl-names = "default";
85+
current-speed = <115200>;
86+
status = "okay";
87+
};
88+
89+
&i2c1 {
90+
pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
91+
pinctrl-names = "default";
92+
status = "okay";
93+
clock-frequency = <I2C_BITRATE_FAST>;
94+
};
95+
96+
&i2c2 {
97+
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
98+
pinctrl-names = "default";
99+
status = "okay";
100+
clock-frequency = <I2C_BITRATE_FAST>;
101+
};
102+
103+
&spi1 {
104+
pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
105+
pinctrl-names = "default";
106+
cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
107+
status = "okay";
108+
};
109+
110+
&spi2 {
111+
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
112+
pinctrl-names = "default";
113+
status = "okay";
114+
};
115+
116+
&iwdg {
117+
status = "okay";
118+
};
119+
120+
&adc1 {
121+
pinctrl-0 = <&adc_in0_pa0>;
122+
pinctrl-names = "default";
123+
st,adc-clock-source = "SYNC";
124+
st,adc-prescaler = <4>;
125+
status = "okay";
126+
};
127+
128+
&rtc {
129+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
130+
<&rcc STM32_SRC_LSE RTC_SEL(1)>;
131+
status = "okay";
132+
};
133+
134+
&die_temp {
135+
status = "okay";
136+
};
137+
138+
&vref {
139+
status = "okay";
140+
};

0 commit comments

Comments
 (0)