Skip to content

Conversation

alexceltare2
Copy link
Contributor

No description provided.

Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properly format comment to be inline with Arduino formatting.

@fpistm fpistm added this to the 1.2.8/1.3.0 milestone Sep 4, 2025
@github-project-automation github-project-automation bot moved this from In progress to Needs review in STM32duino libraries Sep 4, 2025
@alexceltare2
Copy link
Contributor Author

alexceltare2 commented Sep 4, 2025

From my tests, Lowpower.shutdown(1000); does not trigger a wakeup or standby flag as it should but instead a Brown-out Reset flag. Not sure if that was intended or is a misimplementation of LowPower library.

@github-project-automation github-project-automation bot moved this from Needs review to Reviewer approved in STM32duino libraries Sep 4, 2025
@fpistm fpistm merged commit 9dcda4e into stm32duino:main Sep 4, 2025
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in STM32duino libraries Sep 4, 2025
@fpistm
Copy link
Member

fpistm commented Sep 4, 2025

From my tests, Lowpower.shutdown(1000); does not trigger a wakeup or standby flag as it should but instead a Brown-out Reset flag. Not sure if that was intended or is a misimplementation of LowPower library.

Got this with a Nucleo F103RE
15:43:02.092 -> Last reset reason:
15:43:02.092 -> - Standby mode reset
15:43:02.092 -> - WakeUp flag reset (Pin or RTC)

@alexceltare2
Copy link
Contributor Author

On my F401RE:
Last reset reason:

  • Standby mode reset
  • WakeUp flag reset (Pin or RTC)

On my U385RG-Q:
Last reset reason:

  • Brown-out reset
  • Pin reset (NRST or software)

Something is not consistent here or is by design?

@alexceltare2
Copy link
Contributor Author

alexceltare2 commented Sep 5, 2025

Ok, i found the problem. U3 series use independent wakeup flags so a change is needed to accomodate the new architecture as such:

change this:

#if defined(PWR_CSR_WUF)
  if (LL_PWR_IsActiveFlag_WU()) last_reset_reason = (reset_reason)(last_reset_reason | WAKEUP);
#endif

to this:

#if defined(PWR_CSR_WUF)
  if (LL_PWR_IsActiveFlag_WU()) last_reset_reason = (reset_reason)(last_reset_reason | WAKEUP);
#elif defined (PWR_WUSR_WUF10)
  if (LL_PWR_IsActiveFlag_WU1()||LL_PWR_IsActiveFlag_WU2()||LL_PWR_IsActiveFlag_WU3()||LL_PWR_IsActiveFlag_WU4()||LL_PWR_IsActiveFlag_WU5()||LL_PWR_IsActiveFlag_WU6()||LL_PWR_IsActiveFlag_WU7()||LL_PWR_IsActiveFlag_WU8()||LL_PWR_IsActiveFlag_WU9()||LL_PWR_IsActiveFlag_WU10()) last_reset_reason = (reset_reason)(last_reset_reason | WAKEUP);
#endif

and this:

#if defined(PWR_CSR_WUF)
  LL_PWR_ClearFlag_WU();
#endif

to this:

#if defined(PWR_CSR_WUF)
  LL_PWR_ClearFlag_WU();
#elif defined (PWR_WUSR_WUF10)
  LL_PWR_ClearFlag_WU1();LL_PWR_ClearFlag_WU2();LL_PWR_ClearFlag_WU3();LL_PWR_ClearFlag_WU4();LL_PWR_ClearFlag_WU5();LL_PWR_ClearFlag_WU6();LL_PWR_ClearFlag_WU7();LL_PWR_ClearFlag_WU8();LL_PWR_ClearFlag_WU9();LL_PWR_ClearFlag_WU10();
#endif

But funnily enough, this still doesn't trigger the WAKEUP flag.

@fpistm
Copy link
Member

fpistm commented Sep 5, 2025

This is what I said here: #66 (comment)
Not all WUF managed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants