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

[stm32] Add STM32L5 #800

Merged
merged 15 commits into from
Jan 19, 2022
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
21 changes: 21 additions & 0 deletions .github/workflows/compile-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,27 @@ jobs:
name: stm32l4-compile-all-3
path: test/all/log

stm32l5-compile-all:
if: github.event.label.name == 'ci:hal'
runs-on: ubuntu-20.04
container:
image: ghcr.io/modm-ext/modm-build-cortex-m:latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Checkout code and update modm tools
run: |
(git submodule sync && git submodule update --init --jobs 8) & pip3 install --upgrade --upgrade-strategy=eager modm & wait
- name: Compile HAL for all STM32L5
run: |
(cd test/all && python3 run_all.py stm32l5 --quick-remaining)
- name: Upload log artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: stm32l5-compile-all
path: test/all/log

stm32g0-compile-all:
if: github.event.label.name == 'ci:hal'
runs-on: ubuntu-20.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ jobs:
if: always()
run: |
(cd examples && ../tools/scripts/examples_compile.py stm32l476_discovery nucleo_l476rg nucleo_l432kc nucleo_l452re nucleo_l496zg-p)
- name: Examples STM32L5 Series
if: always()
run: |
(cd examples && ../tools/scripts/examples_compile.py nucleo_l552ze-q)
- name: Examples STM32G4 Series
if: always()
run: |
Expand Down
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ git clone --recurse-submodules --jobs 8 https://github.com/modm-io/modm.git

## Microcontrollers

modm can create a HAL for <!--allcount-->3256<!--/allcount--> devices of these vendors:
modm can create a HAL for <!--allcount-->3300<!--/allcount--> devices of these vendors:

- STMicroelectronics STM32: <!--stmcount-->2682<!--/stmcount--> devices.
- STMicroelectronics STM32: <!--stmcount-->2726<!--/stmcount--> devices.
- Microchip SAM: <!--samcount-->186<!--/samcount--> devices.
- Microchip AVR: <!--avrcount-->388<!--/avrcount--> devices.

Expand All @@ -99,7 +99,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<table>
<tr>
<th align="center"></th>
<th align="center" colspan="12">STM32</th>
<th align="center" colspan="13">STM32</th>
<th align="center" colspan="3">SAM</th>
<th align="center" colspan="3">AT</th>
</tr><tr>
Expand All @@ -116,6 +116,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<th align="center">L0</th>
<th align="center">L1</th>
<th align="center">L4</th>
<th align="center">L5</th>
<th align="center">D21</th>
<th align="center">G55</th>
<th align="center">V70</th>
Expand All @@ -136,6 +137,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">○</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">✅</td>
<td align="center">○</td>
Expand All @@ -156,6 +158,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">○</td>
Expand All @@ -177,6 +180,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">○</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">○</td>
<td align="center">✕</td>
<td align="center">○</td>
<td align="center">○</td>
Expand All @@ -196,6 +200,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">✕</td>
<td align="center">○</td>
Expand All @@ -216,6 +221,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">✕</td>
<td align="center">○</td>
Expand All @@ -242,6 +248,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">✕</td>
</tr><tr>
<td align="left">External Interrupt</td>
<td align="center">✅</td>
Expand All @@ -257,6 +264,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">○</td>
<td align="center">✅</td>
Expand All @@ -278,6 +286,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">○</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">○</td>
<td align="center">✕</td>
<td align="center">✕</td>
Expand All @@ -302,6 +311,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr><tr>
<td align="left">I<sup>2</sup>C</td>
<td align="center">✅</td>
Expand All @@ -316,6 +326,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">○</td>
<td align="center">○</td>
Expand All @@ -339,6 +350,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">○</td>
<td align="center">○</td>
<td align="center">○</td>
<td align="center">○</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">✕</td>
Expand All @@ -356,6 +368,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✕</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">○</td>
Expand All @@ -376,6 +389,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">✅</td>
<td align="center">○</td>
Expand All @@ -397,6 +411,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">✕</td>
Expand All @@ -416,6 +431,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">○</td>
<td align="center">○</td>
Expand All @@ -438,6 +454,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">✅</td>
<td align="center">✅</td>
Expand All @@ -456,6 +473,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✕</td>
<td align="center">✕</td>
<td align="center">✕</td>
Expand All @@ -478,6 +496,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">○</td>
<td align="center">✕</td>
<td align="center">✕</td>
Expand Down Expand Up @@ -563,13 +582,14 @@ We have out-of-box support for many development boards including documentation.
<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>
<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-nucleo-l552ze-q">NUCLEO-L552ZE-Q</a></td>
</tr><tr>
<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>
<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>
</tr><tr>
<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>
Expand Down
53 changes: 53 additions & 0 deletions examples/nucleo_l552ze-q/adc_basic/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2021, Raphael Lehmann
* Copyright (c) 2022, Christopher Durand
*
* 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>

#undef MODM_LOG_LEVEL
#define MODM_LOG_LEVEL modm::log::INFO

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

MODM_LOG_INFO << "STM32L5 ADC basic example" << modm::endl;
MODM_LOG_INFO << " running on Nucleo-L552ZE-Q" << modm::endl << modm::endl;

MODM_LOG_INFO << "Configuring ADC ...";
// max. ADC clock for STM32L552: 80 MHz
// 110 MHz AHB clock / 2 = 55 MHz
Adc1::initialize(
Adc1::ClockMode::SynchronousPrescaler2,
Adc1::ClockSource::SystemClock,
Adc1::Prescaler::Disabled,
Adc1::CalibrationMode::SingleEndedInputsMode,
true);
// GpioB1: A6
Adc1::connect<GpioB1::In16>();
Adc1::setPinChannel<GpioB1>(Adc1::SampleTime::Cycles13);

while (true)
{
Adc1::startConversion();
while(!Adc1::isConversionFinished)
;
const auto adcValue = Adc1::getValue();
MODM_LOG_INFO << "adcValue=" << adcValue;
const float voltage = adcValue * 3.3 / 0xfff;
MODM_LOG_INFO << " voltage=";
MODM_LOG_INFO.printf("%.3f\n", voltage);
Board::Leds::toggle();
modm::delay(500ms);
}

return 0;
}
11 changes: 11 additions & 0 deletions examples/nucleo_l552ze-q/adc_basic/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<library>
<extends>modm:nucleo-l552ze-q</extends>
<options>
<option name="modm:build:build.path">../../../build/nucleo_l552ze-q/adc_basic</option>
</options>
<modules>
<module>modm:debug</module>
<module>modm:platform:adc:1</module>
<module>modm:build:scons</module>
</modules>
</library>
37 changes: 37 additions & 0 deletions examples/nucleo_l552ze-q/blink/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2021, Raphael Lehmann
*
* 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();

MODM_LOG_DEBUG << "debug" << modm::endl;
MODM_LOG_INFO << "info" << modm::endl;
MODM_LOG_WARNING << "warning" << modm::endl;
MODM_LOG_ERROR << "error" << modm::endl;

uint32_t counter = 0;

while (true)
{
Leds::write(counter % (1 << 3));
modm::delay(Button::read() ? 250ms : 500ms);
MODM_LOG_INFO << "loop: " << counter << modm::endl;
counter++;
}

return 0;
}
10 changes: 10 additions & 0 deletions examples/nucleo_l552ze-q/blink/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<library>
<extends>modm:nucleo-l552ze-q</extends>
<options>
<option name="modm:build:build.path">../../../build/nucleo_l552ze-q/blink</option>
</options>
<modules>
<module>modm:platform:gpio</module>
<module>modm:build:scons</module>
</modules>
</library>
Loading