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

add option to customize stm32 time driver MIN_STOP_PAUSE via a env variable #2851

Closed
wants to merge 9 commits into from

Conversation

dragonnn
Copy link
Contributor

On my STM32F401RET6 for some reason the default 250ms MIN_STOP_PAUSE is really unstable, often timed wakeups or wakeups from EXTI GPIO are missed, they is some trace output when those happen but it isn't passed to the task waiting for those.
Changing the MIN_STOP_PAUSE to 2500ms complete fixes those issues.
I know that isn't a solution but more kind of workaround but that is how far I currently got and for my application that is a completely fine trade off. And I think having the ability to adjust that value might be for other user usable too.

@dragonnn
Copy link
Contributor Author

Forgot to add, it works by setting the env variable EMBASSY_STM32_TIME_DRIVER_MIN_STOP_PAUSE_MS to the desired value. Maybe a shorter name might be desired but I didn't want to hide from what crate it comes from.
I based this code by looking at DEFMT_RTT_BUFFER_SIZE from defmt-rtt. I think that is a better way then having a bunch of fixed values via some features. And it still defaults to 250ms if it is not set

@Dirbaio
Copy link
Member

Dirbaio commented Apr 26, 2024

This is a workaround. Missed wakeups should never happen, I would prefer if we found the root cause and fixed it.

@Dirbaio Dirbaio marked this pull request as draft April 26, 2024 20:23
@dragonnn
Copy link
Contributor Author

This is a workaround. Missed wakeups should never happen, I would prefer if we found the root cause and fixed it.

Yes, I know and I would like that too. I will try dig deeper into it to find what is causing that but I still that workaround can be useful for other people. Not even as a workaround, just something that can be nice to have to adjust, I suspect different MCU and different use cases can have different best value for the MIN_STOP_PAUSE so it can be nice to have an option to fine tune it instead of a fixed value.

@Dirbaio
Copy link
Member

Dirbaio commented Dec 2, 2024

i'm going to close this for now, hopefully someone can figure out what's the root cause of the issue 😢

@Dirbaio Dirbaio closed this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants