From 9dcda4e99769b9068e93dd2f55f0a8a666260e7f Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 4 Sep 2025 11:33:22 +0100 Subject: [PATCH 1/4] Minor changes (#67) Signed-off-by: George Popa Co-authored-by: Frederic Pillon * fix: commented out potential non-included library * Update examples/Peripherals/Registers/Reset_reason/Reset_reason.ino Co-authored-by: Frederic Pillon Signed-off-by: Alex * Update examples/Peripherals/Registers/Reset_reason/Reset_reason.ino Co-authored-by: Frederic Pillon Signed-off-by: Alex * Update examples/Peripherals/Registers/Reset_reason/Reset_reason.ino Co-authored-by: Frederic Pillon Signed-off-by: Alex * Update examples/Peripherals/Registers/Reset_reason/Reset_reason.ino Co-authored-by: Frederic Pillon Signed-off-by: Alex * Update examples/Peripherals/Registers/Reset_reason/Reset_reason.ino Co-authored-by: Frederic Pillon Signed-off-by: Alex * Update examples/Peripherals/Registers/Reset_reason/Reset_reason.ino Co-authored-by: Frederic Pillon Signed-off-by: Alex --------- Signed-off-by: George Popa Signed-off-by: Alex Co-authored-by: Frederic Pillon --- .../Peripherals/Registers/Reset_reason/Reset_reason.ino | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/Peripherals/Registers/Reset_reason/Reset_reason.ino b/examples/Peripherals/Registers/Reset_reason/Reset_reason.ino index c6e9356..15179d0 100644 --- a/examples/Peripherals/Registers/Reset_reason/Reset_reason.ino +++ b/examples/Peripherals/Registers/Reset_reason/Reset_reason.ino @@ -1,6 +1,3 @@ -#include -#include - /* Last Reset Reason Sketch * This sketch will determine what caused the last reset on the STM32 MCU. Most microcontrollers * have a register dedicated to storing the last reason of the chip, weather being from a @@ -12,6 +9,7 @@ #include "stm32yyxx_ll_rcc.h" #include "IWatchdog.h" +// #include "STM32LowPower.h" #define USER_BTN_PIN USER_BTN // Adjust this for your board @@ -36,6 +34,9 @@ static int default_button_state = LOW; void Reset_My_MCU() { // There are a few reset conditions. Keep the one you wish to use and comment out the others. + // Below is the WakeUp reset condition (needs STM32LowPower.h library) + // LowPower.shutdown(1000); + // Below is the Software reset condition // NVIC_SystemReset(); @@ -82,7 +83,7 @@ void setup() { #endif - // Clear reset flags + // Clear internal reset flags after they were captured LL_RCC_ClearResetFlags(); #if defined(PWR_SCR_CSBF) || defined(PWR_CR1_CSBF) || defined(PWR_PMCR_CSSF) || defined(PWR_SR_CSSF) #if defined(STM32U0xx) From 2869f14eff1f0daa1a66083b58266896b19b1661 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Tue, 14 Oct 2025 08:52:54 +0200 Subject: [PATCH 2/4] chore(example): add WL3 support to ADC internal channels Signed-off-by: Frederic Pillon --- .../Peripherals/ADC/Internal_channels/Internal_channels.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino b/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino index 73df14a..8f24d14 100644 --- a/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino +++ b/examples/Peripherals/ADC/Internal_channels/Internal_channels.ino @@ -89,7 +89,7 @@ static int32_t readTempSensor(int32_t VRef) { #ifdef __LL_ADC_CALC_TEMPERATURE #ifdef STM32U5xx temp = __LL_ADC_CALC_TEMPERATURE(ADC1, VRef, analogRead(ATEMP), LL_ADC_RESOLUTION); -#elif defined(STM32WB0x) +#elif defined(STM32WB0x) || defined(STM32WL3x) (void)VRef; temp = __LL_ADC_CALC_TEMPERATURE(analogRead(ATEMP), LL_ADC_DS_DATA_WIDTH_12_BIT); #else From 6c2cd1c5ad21953aead3689b26338b7606b28191 Mon Sep 17 00:00:00 2001 From: Aymane Bahssain Date: Mon, 2 Feb 2026 14:30:26 +0100 Subject: [PATCH 3/4] fix(RTC): RTC_Tests example for new STM32RTC prediv API (uint32_t) - use uint32_t for userPredA, userPredS and local prediv variables (a, s), - call rtc.getPrediv() and rtc.setPrediv() with uint32_t arguments, - use PREDIVA_MAX + 1 and PREDIVS_MAX + 1 to reset prescalers to computed values See: https://github.com/stm32duino/STM32RTC/commit/9d07ee5d5865488788aa32c2c2dd658fa4cda9f6 Signed-off-by: Aymane Bahssain --- examples/NonReg/RTC/RTC_Tests/RTC_Tests.ino | 24 +++++++++------------ 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/examples/NonReg/RTC/RTC_Tests/RTC_Tests.ino b/examples/NonReg/RTC/RTC_Tests/RTC_Tests.ino index d034413..61e7649 100644 --- a/examples/NonReg/RTC/RTC_Tests/RTC_Tests.ino +++ b/examples/NonReg/RTC/RTC_Tests/RTC_Tests.ino @@ -38,12 +38,8 @@ static const char* mytime = __TIME__; clk = RTCCLK / ((predA +1) * (predS +1)) clk = 1000000 / ((99 +1) * (9999+1)) = 1 Hz */ -#if defined(STM32F1xx) static uint32_t userPredA = 99; -#else -static int8_t userPredA = 99; -#endif /* STM32F1xx */ -static int16_t userPredS = 9999; +static uint32_t userPredS = 9999; /* */ static byte seconds = 0; @@ -112,35 +108,35 @@ void loop() #if defined(STM32F1xx) Serial.println("Testing only asynchronous prescaler setting"); - uint32_t a; #else Serial.println("Testing asynchronous and synchronous prescaler setting"); - int8_t a; #endif /* STM32F1xx */ - int16_t s = 0; + uint32_t a = 0; + uint32_t s = 0; + rtc.getPrediv(&a, &s); Serial.print("Async/Sync for default LSI clock: "); - Serial.printf("%i/%i\n", a, s); + Serial.printf("%u/%u\n", a, s); rtc_config(clkSource, rtc.HOUR_24, mydate, mytime); Serial.print("Async/Sync for selected clock: "); rtc.getPrediv(&a, &s); - Serial.printf("%i/%i\n", a, s); + Serial.printf("%u/%u\n", a, s); rtc.end(); if (clkSource == rtc.HSE_CLOCK) { - Serial.printf("User Async/Sync set to %i/%i:", userPredA, userPredS); + Serial.printf("User Async/Sync set to %u/%u:", userPredA, userPredS); rtc.setPrediv(userPredA, userPredS); rtc_config(clkSource, rtc.HOUR_24, mydate, mytime); rtc.getPrediv(&a, &s); - Serial.printf("%i/%i\n", a, s); + Serial.printf("%u/%u\n", a, s); printDateTime(10, 1000, false); } Serial.print("User Async/Sync reset to use the computed one: "); - rtc.setPrediv(-1, -1); + rtc.setPrediv(PREDIVA_MAX + 1, PREDIVS_MAX + 1); rtc_config(clkSource, rtc.HOUR_24, mydate, mytime); rtc.getPrediv(&a, &s); - Serial.printf("%i/%i\n", a, s); + Serial.printf("%u/%u\n", a, s); // Check date change Serial.println("Testing date and time"); From a64fb0e234ff4f7184eeb0d85e5d0ae53b0f72b0 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 11 Mar 2026 16:59:02 +0100 Subject: [PATCH 4/4] chore: bump version Signed-off-by: Frederic Pillon --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index be51ffb..837b88a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=STM32duino Examples -version=1.2.7 +version=1.2.8 author=several maintainer=stm32duino sentence=Provides several examples for the Arduino core for STM32 MCUs.