Skip to content

Commit 06a1618

Browse files
committed
[board] Add NUCLEO-H533RE board support
1 parent d0fcb0d commit 06a1618

8 files changed

Lines changed: 331 additions & 9 deletions

File tree

.github/workflows/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ jobs:
202202
- name: Examples STM32H5 Series
203203
if: always()
204204
run: |
205-
(cd examples && ../tools/scripts/examples_compile.py nucleo_h503rb weact_h503cb weact_h523ce weact_h562rg)
205+
(cd examples && ../tools/scripts/examples_compile.py nucleo_h503rb nucleo_h533re weact_h503cb weact_h523ce weact_h562rg)
206206
- name: Examples STM32H7 Series
207207
if: always()
208208
run: |

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -781,45 +781,46 @@ We have out-of-box support for many development boards including documentation.
781781
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-g474re">NUCLEO-G474RE</a></td>
782782
</tr><tr>
783783
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-h503rb">NUCLEO-H503RB</a></td>
784+
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-h533re">NUCLEO-H533RE</a></td>
784785
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-h723zg">NUCLEO-H723ZG</a></td>
785786
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-h743zi">NUCLEO-H743ZI</a></td>
786-
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l031k6">NUCLEO-L031K6</a></td>
787787
</tr><tr>
788+
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l031k6">NUCLEO-L031K6</a></td>
788789
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l053r8">NUCLEO-L053R8</a></td>
789790
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l152re">NUCLEO-L152RE</a></td>
790791
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l432kc">NUCLEO-L432KC</a></td>
791-
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l452re">NUCLEO-L452RE</a></td>
792792
</tr><tr>
793+
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l452re">NUCLEO-L452RE</a></td>
793794
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l476rg">NUCLEO-L476RG</a></td>
794795
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l496zg-p">NUCLEO-L496ZG-P</a></td>
795796
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-l552ze-q">NUCLEO-L552ZE-Q</a></td>
796-
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-u083rc">NUCLEO-U083RC</a></td>
797797
</tr><tr>
798+
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-u083rc">NUCLEO-U083RC</a></td>
798799
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-u385rg-q">NUCLEO-U385RG-Q</a></td>
799800
<td align="center"><a href="https://modm.io/reference/config/modm-nucleo-u575zi-q">NUCLEO-U575ZI-Q</a></td>
800801
<td align="center"><a href="https://modm.io/reference/config/modm-olimexino-stm32">OLIMEXINO-STM32</a></td>
801-
<td align="center"><a href="https://modm.io/reference/config/modm-rp-pico">Raspberry Pi Pico</a></td>
802802
</tr><tr>
803+
<td align="center"><a href="https://modm.io/reference/config/modm-rp-pico">Raspberry Pi Pico</a></td>
803804
<td align="center"><a href="https://modm.io/reference/config/modm-samd21-mini">SAMD21-MINI</a></td>
804805
<td align="center"><a href="https://modm.io/reference/config/modm-samd21-xplained-pro">SAMD21-XPLAINED-PRO</a></td>
805806
<td align="center"><a href="https://modm.io/reference/config/modm-same54-xplained-pro">SAME54-XPLAINED-PRO</a></td>
806-
<td align="center"><a href="https://modm.io/reference/config/modm-same70-xplained">SAME70-XPLAINED</a></td>
807807
</tr><tr>
808+
<td align="center"><a href="https://modm.io/reference/config/modm-same70-xplained">SAME70-XPLAINED</a></td>
808809
<td align="center"><a href="https://modm.io/reference/config/modm-samg55-xplained-pro">SAMG55-XPLAINED-PRO</a></td>
809810
<td align="center"><a href="https://modm.io/reference/config/modm-samv71-xplained-ultra">SAMV71-XPLAINED-ULTRA</a></td>
810811
<td align="center"><a href="https://modm.io/reference/config/modm-srxe">Smart Response XE</a></td>
811-
<td align="center"><a href="https://modm.io/reference/config/modm-stm32_f4ve">STM32-F4VE</a></td>
812812
</tr><tr>
813+
<td align="center"><a href="https://modm.io/reference/config/modm-stm32_f4ve">STM32-F4VE</a></td>
813814
<td align="center"><a href="https://modm.io/reference/config/modm-stm32f030_demo">STM32F030-DEMO</a></td>
814815
<td align="center"><a href="https://modm.io/reference/config/modm-thingplus-rp2040">THINGPLUS-RP2040</a></td>
815816
<td align="center"><a href="https://modm.io/reference/config/modm-weact-c011f6">WEACT-C011F6</a></td>
816-
<td align="center"><a href="https://modm.io/reference/config/modm-weact-g0b1cb">WEACT-G0B1CB</a></td>
817817
</tr><tr>
818+
<td align="center"><a href="https://modm.io/reference/config/modm-weact-g0b1cb">WEACT-G0B1CB</a></td>
818819
<td align="center"><a href="https://modm.io/reference/config/modm-weact-h503cb">WEACT-H503CB</a></td>
819820
<td align="center"><a href="https://modm.io/reference/config/modm-weact-h523ce">WEACT-H523CE</a></td>
820821
<td align="center"><a href="https://modm.io/reference/config/modm-weact-h562rg">WEACT-H562RG</a></td>
821-
<td align="center"><a href="https://modm.io/reference/config/modm-weact-u585ci">WEACT-U585CI</a></td>
822822
</tr><tr>
823+
<td align="center"><a href="https://modm.io/reference/config/modm-weact-u585ci">WEACT-U585CI</a></td>
823824
</tr>
824825
</table>
825826
<!--/bsptable-->

examples/generic/usb/project.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<!-- <extends>modm:weact-u585ci</extends> -->
2323
<!-- <extends>modm:nucleo-u575zi-q</extends> -->
2424
<!-- <extends>modm:nucleo-h503rb</extends> -->
25+
<!-- <extends>modm:nucleo-h533re</extends> -->
2526
<!-- <extends>modm:weact-h503cb</extends> -->
2627
<!-- <extends>modm:weact-h523ce</extends> -->
2728
<!-- <extends>modm:weact-h562rg</extends> -->
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2016-2017, Niklas Hauser
3+
*
4+
* This file is part of the modm project.
5+
*
6+
* This Source Code Form is subject to the terms of the Mozilla Public
7+
* License, v. 2.0. If a copy of the MPL was not distributed with this
8+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
9+
*/
10+
// ----------------------------------------------------------------------------
11+
12+
#include <modm/board.hpp>
13+
#include <modm/processing.hpp>
14+
15+
using namespace Board;
16+
17+
int
18+
main()
19+
{
20+
Board::initialize();
21+
Leds::setOutput();
22+
23+
// Use the logging streams to print some messages.
24+
// Change MODM_LOG_LEVEL above to enable or disable these messages
25+
MODM_LOG_DEBUG << "debug" << modm::endl;
26+
MODM_LOG_INFO << "info" << modm::endl;
27+
MODM_LOG_WARNING << "warning" << modm::endl;
28+
MODM_LOG_ERROR << "error" << modm::endl;
29+
30+
for (const auto [traits, start, end, size] : modm::platform::HeapTable())
31+
{
32+
MODM_LOG_INFO.printf("Memory section %#x @[0x%p,0x%p](%u)\n",
33+
traits.value, start, end, size);
34+
}
35+
36+
uint32_t counter(0);
37+
modm::ShortTimeout tmr;
38+
39+
while (true)
40+
{
41+
Leds::write(1 << (counter % (Leds::width+1) ));
42+
// modm::delay(Button::read() ? 100ms : 500ms);
43+
tmr.restart(Button::read() ? 100ms : 500ms);
44+
while(not tmr.execute()) ;
45+
46+
MODM_LOG_INFO << "loop: " << counter++ << modm::endl;
47+
}
48+
49+
return 0;
50+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<library>
2+
<extends>modm:nucleo-h533re</extends>
3+
<options>
4+
<option name="modm:build:build.path">../../../build/nucleo_h533re/blink</option>
5+
</options>
6+
<modules>
7+
<module>modm:architecture:memory</module>
8+
<module>modm:build:scons</module>
9+
<module>modm:processing:timer</module>
10+
</modules>
11+
</library>
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
/*
2+
* Copyright (c) 2026, Niklas Hauser
3+
*
4+
* This file is part of the modm project.
5+
*
6+
* This Source Code Form is subject to the terms of the Mozilla Public
7+
* License, v. 2.0. If a copy of the MPL was not distributed with this
8+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
9+
*/
10+
// ----------------------------------------------------------------------------
11+
12+
#pragma once
13+
14+
#include <modm/platform.hpp>
15+
#include <modm/architecture.hpp>
16+
#include <modm/debug.hpp>
17+
18+
using namespace modm::platform;
19+
20+
/// @ingroup modm_board_nucleo_h533re
21+
#define MODM_BOARD_HAS_LOGGER
22+
23+
namespace Board
24+
{
25+
/// @ingroup modm_board_nucleo_h533re
26+
/// @{
27+
using namespace modm::literals;
28+
29+
/// STM32H533RE running at 250MHz from PLL clock generated from 24 MHz HSE
30+
struct SystemClock
31+
{
32+
static constexpr uint32_t Hse = 24_MHz;
33+
static constexpr uint32_t Lse = 32.768_kHz;
34+
35+
static constexpr Rcc::PllConfig pll1
36+
{
37+
.range = Rcc::PllInputRange::MHz2_4,
38+
.M = 12, // 24 MHz / 12 = 2 MHz
39+
.N = 250, // 2 MHz * 120 = 500 MHz
40+
.P = 2, // 500 MHz / 2 = 250 MHz = F_cpu
41+
};
42+
static constexpr uint32_t Pll1P = Hse / pll1.M * pll1.N / pll1.P;
43+
static_assert(Pll1P == Rcc::MaxFrequency);
44+
45+
static constexpr Rcc::PllConfig pll3
46+
{
47+
.range = Rcc::PllInputRange::MHz8_16,
48+
.M = 3, // 24 MHz / 3 = 8 MHz
49+
.N = 18, // 8 MHz * 18 = 144 MHz
50+
.Q = 3, // 144 MHz / 3 = 48 MHz = F_usb
51+
};
52+
static constexpr uint32_t Pll3Q = Hse / pll3.M * pll3.N / pll3.Q;
53+
54+
static constexpr uint32_t SysClk = Pll1P;
55+
static constexpr uint32_t Frequency = SysClk;
56+
57+
// AHB Bus - Max 250MHz
58+
static constexpr uint32_t Hclk = SysClk / 1;
59+
static constexpr uint32_t Ahb = Hclk;
60+
61+
// APB Buses - Max 250MHz
62+
static constexpr uint32_t Apb1 = Hclk / 1;
63+
static constexpr uint32_t Apb2 = Hclk / 1;
64+
static constexpr uint32_t Apb3 = Hclk / 1;
65+
66+
// Peripherals on AHB2
67+
static constexpr uint32_t Adc1 = Hclk;
68+
static constexpr uint32_t Dac1 = Hclk;
69+
70+
// Peripherals on APB2
71+
static constexpr uint32_t Spi1 = Apb2;
72+
static constexpr uint32_t Usart1 = Apb2;
73+
74+
// Peripherals on APB1
75+
static constexpr uint32_t Spi2 = Apb1;
76+
static constexpr uint32_t Spi3 = Apb1;
77+
static constexpr uint32_t Usart2 = Apb1;
78+
static constexpr uint32_t Usart3 = Apb1;
79+
static constexpr uint32_t Fdcan1 = Apb1;
80+
81+
// Peripherals on APB3
82+
static constexpr uint32_t LpUart1 = Apb3;
83+
84+
// Timer Clocks
85+
static constexpr uint32_t Apb1Timer = Apb1 * 1;
86+
static constexpr uint32_t Apb2Timer = Apb2 * 1;
87+
88+
static constexpr uint32_t Timer1 = Apb2Timer;
89+
static constexpr uint32_t Timer2 = Apb1Timer;
90+
static constexpr uint32_t Timer3 = Apb1Timer;
91+
static constexpr uint32_t Timer6 = Apb1Timer;
92+
static constexpr uint32_t Timer7 = Apb1Timer;
93+
94+
static constexpr uint32_t Rtc = Lse;
95+
static constexpr uint32_t Usb = Pll3Q;
96+
static constexpr uint32_t Iwdg = Rcc::LsiFrequency;
97+
98+
static bool inline
99+
enable()
100+
{
101+
Rcc::enableLseCrystal();
102+
Rcc::enableHseCrystal();
103+
104+
Rcc::setVoltageScaling(Rcc::VoltageScaling::Scale0);
105+
Rcc::setFlashLatency<Frequency>();
106+
107+
Rcc::enablePll1(Rcc::PllSource::Hse, pll1);
108+
Rcc::enablePll3(Rcc::PllSource::Hse, pll3);
109+
110+
Rcc::setAhbPrescaler(Rcc::AhbPrescaler::Div1);
111+
Rcc::setApb1Prescaler(Rcc::ApbPrescaler::Div1);
112+
Rcc::setApb2Prescaler(Rcc::ApbPrescaler::Div1);
113+
Rcc::setApb3Prescaler(Rcc::ApbPrescaler::Div1);
114+
115+
Rcc::updateCoreFrequency<Frequency>();
116+
117+
Rcc::enableSystemClock(Rcc::SystemClockSource::Pll1P);
118+
Rcc::setUsbClockSource(Rcc::UsbClockSource::Pll3Q);
119+
Rcc::setRealTimeClockSource(Rcc::RealTimeClockSource::Lse);
120+
121+
return true;
122+
}
123+
};
124+
125+
using A0 = GpioA0;
126+
using A1 = GpioA1;
127+
using A2 = GpioB1;
128+
using A3 = GpioB0;
129+
using A4 = GpioC1;
130+
using A5 = GpioC0;
131+
132+
using D0 = GpioB15;
133+
using D1 = GpioB14;
134+
using D2 = GpioC8;
135+
using D3 = GpioB3;
136+
using D4 = GpioB5;
137+
using D5 = GpioB4;
138+
using D6 = GpioB10;
139+
using D7 = GpioA8;
140+
using D8 = GpioC7;
141+
using D9 = GpioC6;
142+
using D10 = GpioC9;
143+
using D11 = GpioA7;
144+
using D12 = GpioA6;
145+
using D13 = GpioA5;
146+
using D14 = GpioB7;
147+
using D15 = GpioB6;
148+
149+
using Button = GpioInputC13;
150+
151+
using Led = GpioOutputA5;
152+
using Leds = SoftwareGpioPort< Led >;
153+
/// @}
154+
155+
namespace usb
156+
{
157+
/// @ingroup modm_board_nucleo_h533re
158+
/// @{
159+
using Dm = GpioA11;
160+
using Dp = GpioA12;
161+
162+
using Device = UsbFs;
163+
/// @}
164+
}
165+
166+
namespace stlink
167+
{
168+
/// @ingroup modm_board_nucleo_h533re
169+
/// @{
170+
using Tx = GpioOutputA2;
171+
using Rx = GpioInputA3;
172+
using Uart = BufferedUart<UsartHal2, UartTxBuffer<2048>>;
173+
/// @}
174+
}
175+
176+
/// @ingroup modm_board_nucleo_h533re
177+
/// @{
178+
using LoggerDevice = modm::IODeviceWrapper< stlink::Uart, modm::IOBuffer::BlockIfFull >;
179+
180+
inline void
181+
initialize()
182+
{
183+
SystemClock::enable();
184+
SysTickTimer::initialize<SystemClock>();
185+
186+
stlink::Uart::connect<stlink::Tx::Tx, stlink::Rx::Rx>();
187+
stlink::Uart::initialize<SystemClock, 115200_Bd>();
188+
189+
Led::setOutput(modm::Gpio::Low);
190+
Button::setInput();
191+
}
192+
193+
inline void
194+
initializeUsb(uint8_t priority=3)
195+
{
196+
usb::Device::initialize<SystemClock>(priority);
197+
usb::Device::connect<usb::Dm::Dm, usb::Dp::Dp>();
198+
}
199+
/// @}
200+
201+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<library>
2+
<repositories>
3+
<repository>
4+
<path>../../../../repo.lb</path>
5+
</repository>
6+
</repositories>
7+
8+
<options>
9+
<option name="modm:target">stm32h533ret6</option>
10+
</options>
11+
<modules>
12+
<module>modm:board:nucleo-h533re</module>
13+
</modules>
14+
</library>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (c) 2026, Niklas Hauser
5+
#
6+
# This file is part of the modm project.
7+
#
8+
# This Source Code Form is subject to the terms of the Mozilla Public
9+
# License, v. 2.0. If a copy of the MPL was not distributed with this
10+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
11+
# -----------------------------------------------------------------------------
12+
13+
def init(module):
14+
module.name = ":board:nucleo-h533re"
15+
module.description = """
16+
# NUCLEO-H533RE
17+
18+
[Nucleo kit for STM32H533RE](https://www.st.com/en/evaluation-tools/nucleo-h533re.html)
19+
"""
20+
21+
def prepare(module, options):
22+
if not options[":target"].partname.startswith("stm32h533ret"):
23+
return False
24+
25+
module.depends(
26+
":debug",
27+
":architecture:clock",
28+
":platform:core",
29+
":platform:gpio",
30+
":platform:clock",
31+
":platform:uart:2",
32+
":platform:usb")
33+
34+
return True
35+
36+
def build(env):
37+
env.outbasepath = "modm/src/modm/board"
38+
env.substitutions = {
39+
"with_logger": True,
40+
"with_assert": env.has_module(":architecture:assert")
41+
}
42+
env.template("../board.cpp.in", "board.cpp")
43+
env.copy(".")
44+
env.collect(":build:openocd.source", "board/st_nucleo_h5.cfg")

0 commit comments

Comments
 (0)