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 lptim driver sleeping forever depends on SYSTEM_CLOCK_SLOPPY_IDLE #67390

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented Jan 9, 2024

The stm32 lptim driver is called by the application which wants to sleep forever.
It calls the k_msleep function with a int32_t ticks parameter meaning either never wakeUp or wakeUp on max possible timeout. This meaning depends on the the SYSTEM_CLOCK_SLOPPY_IDLE

  • when CONFIG_SYSTEM_CLOCK_SLOPPY_IDLE is set, then application is supposed to call k_msleep(K_TICKS_FOREVER); will stop lptim counting

  • when CONFIG_SYSTEM_CLOCK_SLOPPY_IDLE is not set, then application is supposed to call k_msleep(INT_MAX); and lptim will wakeUp the system at its max possible timeout value.

This PR just add comment to clarify this meaning.

Fixes #65008

@FRASTM FRASTM added the platform: STM32 ST Micro STM32 label Jan 9, 2024
@FRASTM FRASTM force-pushed the issue65008 branch 6 times, most recently from 47a4fde to ca619cb Compare January 9, 2024 16:27
@erwango
Copy link
Member

erwango commented Jan 11, 2024

@r2r0 Is that fine with you ?

@r2r0
Copy link
Member

r2r0 commented Jan 11, 2024

@erwango It's Ok.

When CONFIG_SYSTEM_SLOPPY_IDLE is not set, then system
can sleep for -1 means waking Up at the max possible
counter value (INT_MAX)
When CONFIG_SYSTEM_SLOPPY_IDLE is set sleeping K_TICKS_FOREVER
means never wakingUp

Signed-off-by: Francois Ramu <francois.ramu@st.com>
@FRASTM
Copy link
Collaborator Author

FRASTM commented Feb 6, 2024

rebase on d7328ea

To sleep forever, call the k_msleep()

  • with INT_MAX when CONFIG_SYSTEM_CLOCK_SLOPPY_IDLE is not set
  • with K_TICKS_FOREVER when CONFIG_SYSTEM_CLOCK_SLOPPY_IDLE is set

@FRASTM FRASTM marked this pull request as ready for review February 6, 2024 14:18
@zephyrbot zephyrbot added the area: Timer Timer label Feb 6, 2024
@henrikbrixandersen henrikbrixandersen added this to the v3.7.0 milestone Feb 20, 2024
@aescolar aescolar merged commit 62e7b78 into zephyrproject-rtos:main Feb 26, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Timer Timer platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stm32: a single LPTIMER interrupt triggered in tickless mode after system is switched to SUSPEND_TO_IDLE state
7 participants