Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[board] DevEBox STM32H750VB with blink example #678

Merged
merged 2 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
- name: Examples STM32H7 Series
if: always()
run: |
(cd examples && ../tools/scripts/examples_compile.py nucleo_h743zi nucleo_h723zg)
(cd examples && ../tools/scripts/examples_compile.py nucleo_h743zi nucleo_h723zg stm32h750vbt6_devebox)
stm32f4-examples-1:
runs-on: ubuntu-20.04
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,66 +487,67 @@ We have out-of-box support for many development boards including documentation.
<td align="center"><a href="https://modm.io/reference/module/modm-board-blue-pill-f103">Blue Pill F103</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-devebox-stm32f4xx">DEVEBOX-STM32F4XX</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-devebox-stm32h750vb">DEVEBOX-STM32H750VB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f051r8">DISCO-F051R8</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f072rb">DISCO-F072RB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f100rb">DISCO-F100RB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f303vc">DISCO-F303VC</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f303vc">DISCO-F303VC</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f407vg">DISCO-F407VG</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f429zi">DISCO-F429ZI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f469ni">DISCO-F469NI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f746ng">DISCO-F746NG</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f746ng">DISCO-F746NG</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-f769ni">DISCO-F769NI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-l152rc">DISCO-L152RC</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-disco-l476vg">DISCO-L476VG</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-feather-m0">FEATHER-M0</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-feather-m0">FEATHER-M0</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-mega-2560-pro">MEGA-2560-PRO</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f031k6">NUCLEO-F031K6</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f042k6">NUCLEO-F042K6</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f072rb">NUCLEO-F072RB</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f072rb">NUCLEO-F072RB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f091rc">NUCLEO-F091RC</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f103rb">NUCLEO-F103RB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f303k8">NUCLEO-F303K8</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f303re">NUCLEO-F303RE</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f303re">NUCLEO-F303RE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f334r8">NUCLEO-F334R8</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f401re">NUCLEO-F401RE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f411re">NUCLEO-F411RE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f429zi">NUCLEO-F429ZI</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f429zi">NUCLEO-F429ZI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f439zi">NUCLEO-F439ZI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f446re">NUCLEO-F446RE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f446ze">NUCLEO-F446ZE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f746zg">NUCLEO-F746ZG</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f746zg">NUCLEO-F746ZG</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-f767zi">NUCLEO-F767ZI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-g071rb">NUCLEO-G071RB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-g431kb">NUCLEO-G431KB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-g431rb">NUCLEO-G431RB</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-g431rb">NUCLEO-G431RB</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-g474re">NUCLEO-G474RE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-h723zg">NUCLEO-H723ZG</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-h743zi">NUCLEO-H743ZI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l031k6">NUCLEO-L031K6</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l031k6">NUCLEO-L031K6</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l152re">NUCLEO-L152RE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l432kc">NUCLEO-L432KC</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l452re">NUCLEO-L452RE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l476rg">NUCLEO-L476RG</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l476rg">NUCLEO-L476RG</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-nucleo-l496zg-p">NUCLEO-L496ZG-P</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-olimexino-stm32">OLIMEXINO-STM32</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-raspberrypi">Raspberry Pi</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-samd21-mini">SAMD21-MINI</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-samd21-mini">SAMD21-MINI</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-samg55-xplained-pro">SAMG55-XPLAINED-PRO</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-stm32_f4ve">STM32-F4VE</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-stm32f030_demo">STM32F030-DEMO</a></td>
<td align="center"><a href="https://modm.io/reference/module/modm-board-srxe">Smart Response XE</a></td>
</tr><tr>
<td align="center"><a href="https://modm.io/reference/module/modm-board-srxe">Smart Response XE</a></td>
</tr>
</table>
<!--/bsptable-->
Expand Down
28 changes: 28 additions & 0 deletions examples/stm32h750vbt6_devebox/blink/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2021, Henrik Hose
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>

using namespace Board;

int
main()
{
Board::initialize();

while(true)
{
LedGreen::toggle();
modm::delay(100ms + ButtonK1::read()*500ms + ButtonK2::read()*1000ms);
}

return 0;
}
1 change: 1 addition & 0 deletions examples/stm32h750vbt6_devebox/blink/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source [find interface/stlink.cfg]
10 changes: 10 additions & 0 deletions examples/stm32h750vbt6_devebox/blink/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<library>
<extends>modm:devebox-stm32h750vb</extends>
<options>
<option name="modm:build:build.path">../../../build/stm32h750vbt6_devebox/blink</option>
<option name="modm:build:openocd.cfg">openocd.cfg</option>
</options>
<modules>
<module>modm:build:scons</module>
</modules>
</library>
172 changes: 172 additions & 0 deletions src/modm/board/devebox_stm32h750vb/board.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* Copyright (c) 2021, Henrik Hose
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#ifndef MODM_STM32_H750VB_DEVEBOX_HPP
#define MODM_STM32_H750VB_DEVEBOX_HPP

#include <modm/platform.hpp>
#include <modm/architecture/interface/clock.hpp>

using namespace modm::platform;

/// @ingroup modm_board_devebox_stm32h750vb
namespace Board
{
using namespace modm::literals;

/// STM32H750 running at 400MHz from the external 25MHz HSE
struct SystemClock
{
// NOTE: revision Y at 400MHz, only revision V runs at 480Mhz!!!
// some of the devebox boards including the original one have the Y version!!!
static constexpr uint32_t SysClk = 400_MHz;
// Max 400MHz or 480MHz
static constexpr uint32_t Hclk = SysClk / 1; // D1CPRE
static constexpr uint32_t Frequency = Hclk;
// Max 200MHz or 240MHz
static constexpr uint32_t Ahb = Hclk / 2; // HPRE
static constexpr uint32_t Ahb1 = Ahb;
static constexpr uint32_t Ahb2 = Ahb;
static constexpr uint32_t Ahb3 = Ahb;
static constexpr uint32_t Ahb4 = Ahb;
// Max 100MHz or 120MHz
static constexpr uint32_t Apb1 = Ahb / 2; // D2PPRE1
static constexpr uint32_t Apb2 = Ahb / 2; // D2PPRE2
static constexpr uint32_t Apb3 = Ahb / 2; // D1PPRE
static constexpr uint32_t Apb4 = Ahb / 2; // D3PPRE

static constexpr uint32_t Adc1 = Ahb1;
static constexpr uint32_t Adc2 = Ahb1;
static constexpr uint32_t Adc3 = Ahb4;

static constexpr uint32_t Dac1 = Apb1;

static constexpr uint32_t Spi1 = Apb2;
static constexpr uint32_t Spi2 = Apb1;
static constexpr uint32_t Spi3 = Apb1;
static constexpr uint32_t Spi4 = Apb2;
static constexpr uint32_t Spi5 = Apb2;
static constexpr uint32_t Spi6 = Apb4;

static constexpr uint32_t Usart1 = Apb2;
static constexpr uint32_t Usart2 = Apb1;
static constexpr uint32_t Usart3 = Apb1;
static constexpr uint32_t Uart4 = Apb1;
static constexpr uint32_t Uart5 = Apb1;
static constexpr uint32_t Usart6 = Apb2;
static constexpr uint32_t Uart7 = Apb1;
static constexpr uint32_t Uart8 = Apb1;

static constexpr uint32_t LpUart1 = Apb4;

static constexpr uint32_t Can1 = Apb1;
static constexpr uint32_t Can2 = Apb1;

static constexpr uint32_t I2c1 = Apb1;
static constexpr uint32_t I2c2 = Apb1;
static constexpr uint32_t I2c3 = Apb1;
static constexpr uint32_t I2c4 = Apb4;

static constexpr uint32_t Apb1Timer = Apb1 * 2;
static constexpr uint32_t Apb2Timer = Apb2 * 2;
static constexpr uint32_t Timer1 = Apb2Timer;
static constexpr uint32_t Timer2 = Apb1Timer;
static constexpr uint32_t Timer3 = Apb1Timer;
static constexpr uint32_t Timer4 = Apb1Timer;
static constexpr uint32_t Timer5 = Apb1Timer;
static constexpr uint32_t Timer6 = Apb1Timer;
static constexpr uint32_t Timer7 = Apb1Timer;
static constexpr uint32_t Timer8 = Apb2Timer;
static constexpr uint32_t Timer12 = Apb1Timer;
static constexpr uint32_t Timer13 = Apb1Timer;
static constexpr uint32_t Timer14 = Apb1Timer;
static constexpr uint32_t Timer15 = Apb2Timer;
static constexpr uint32_t Timer16 = Apb2Timer;
static constexpr uint32_t Timer17 = Apb2Timer;

static constexpr uint32_t Usb = 48_MHz; // From PLL3Q

static bool inline
enable()
{
Rcc::enableExternalCrystal(); // 25MHz
Rcc::setVoltageScaling(Rcc::VoltageScaling::Scale0); // required for 400MHz/480MHz
const Rcc::PllFactors pllFactors1{
.range = Rcc::PllInputRange::MHz8_16,
.pllM = 2, // 25MHz / M= 12.5MHz
.pllN = 64, // 12.5MHz * N= 800MHz
.pllP = 2, // 800MHz / P= 400MHz = F_cpu
.pllQ = 20, // 800MHz / Q= 40MHz
.pllR = 20, // 800MHz / R= 40MHz
};
Rcc::enablePll1(Rcc::PllSource::ExternalClock, pllFactors1);
// Use PLL3 for USB 48MHz
const Rcc::PllFactors pllFactors3{
.range = Rcc::PllInputRange::MHz4_8,
.pllM = 5, // 25MHz / M= 5MHz
.pllN = 48, // 5MHz * N= 240MHz
.pllP = 2, // 240MHz / P= 120MHz
.pllQ = 5, // 240MHz / Q= 48MHz = F_usb
.pllR = 5, // 240MHz / R= 48MHz
};
Rcc::enablePll3(Rcc::PllSource::ExternalClock, pllFactors3);
Rcc::setFlashLatency<Ahb>();
// max 240MHz on AHB
Rcc::setAhbPrescaler(Rcc::AhbPrescaler::Div2);
// max 120MHz on APB
Rcc::setApb1Prescaler(Rcc::Apb1Prescaler::Div2);
Rcc::setApb2Prescaler(Rcc::Apb2Prescaler::Div2);
Rcc::setApb3Prescaler(Rcc::Apb3Prescaler::Div2);
Rcc::setApb4Prescaler(Rcc::Apb4Prescaler::Div2);
// update clock frequencies
Rcc::updateCoreFrequency<Hclk>();
Rcc::enableUsbClockSource(Rcc::UsbClockSource::Pll3Q);
// Switch the main clock source to PLL
Rcc::enableSystemClock(Rcc::SystemClockSource::Pll1P);

return true;
}
};


using ButtonK1 = GpioInverted<GpioInputE3>;
using ButtonK2 = GpioInverted<GpioInputC5>;

using LedGreen = GpioInverted<GpioOutputA1>; // User LED

using Leds = SoftwareGpioPort< LedGreen >;

namespace usb
{
using Dm = GpioA11; // DM: USB_DM
using Dp = GpioA12; // DP: USB_DP
}


inline void
initialize()
{
SystemClock::enable();
SysTickTimer::initialize<SystemClock>();

LedGreen::setOutput(modm::Gpio::Low);

ButtonK1::setInput(Gpio::InputType::PullUp);
ButtonK1::setInputTrigger(Gpio::InputTrigger::FallingEdge);
ButtonK1::enableExternalInterrupt();
salkinium marked this conversation as resolved.
Show resolved Hide resolved

ButtonK2::setInput(Gpio::InputType::PullUp);
ButtonK2::setInputTrigger(Gpio::InputTrigger::FallingEdge);
ButtonK2::enableExternalInterrupt();
}
}

#endif // MODM_STM32_H750VB_DEVEBOX_HPP
14 changes: 14 additions & 0 deletions src/modm/board/devebox_stm32h750vb/board.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<library>
<repositories>
<repository>
<path>../../../../repo.lb</path>
</repository>
</repositories>

<options>
<option name="modm:target">stm32h750vbt6/revY</option>
</options>
<modules>
<module>modm:board:devebox-stm32h750vb</module>
</modules>
</library>
Loading