Skip to content

HardwareTimer: pause() need to call HAL API to restore HAL state #1166

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

Merged
merged 1 commit into from
Sep 9, 2020

Conversation

ABOSTM
Copy link
Contributor

@ABOSTM ABOSTM commented Sep 9, 2020

Summary

HardwareTimer: pause() need to call HAL API to restore HAL state

Due to HAL Cube update (ex: for STM32L4 sha1 f41f10e)
it is now required to stop timer with HAL API
otherwise HAL state is not restored to HAL_TIM_STATE_READY,
and it is not possible to resume() a HardwareTimer after a pause().
Nevertheless it is not sufficient to guarantee that timer is stopped.
specially if some channels are still running.
So it is also necessary to keep also the call to LL_TIM_DisableCounter()

@ABOSTM ABOSTM force-pushed the HARDWARETIMER_PAUSE_RESTORE_STATE branch from 2a1ff77 to 9f15ada Compare September 9, 2020 11:52
@ABOSTM ABOSTM requested review from fpistm and cparata September 9, 2020 11:52
@ABOSTM
Copy link
Contributor Author

ABOSTM commented Sep 9, 2020

Tested on L476RG

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.

One typo to fix else LGTM

@fpistm fpistm added the fix 🩹 Bug fix label Sep 9, 2020
@fpistm fpistm added this to the 2.0.0 milestone Sep 9, 2020
Due to HAL Cube update (ex: for STM32L4 sha1 f41f10e)
it is now required to stop timer with HAL API
otherwise HAL state is not restored to HAL_TIM_STATE_READY,
and it is not possible to resume() a HardwareTimer after a pause().
Nevertheless it is not sufficient to guarantee that timer is stopped
specially if some channels are still running.
So it is also necessary to keep also the call to
LL_TIM_DisableCounter()

Signed-off-by: Alexandre Bourdiol <[email protected]>
@ABOSTM ABOSTM force-pushed the HARDWARETIMER_PAUSE_RESTORE_STATE branch from 9f15ada to f809e54 Compare September 9, 2020 12:24
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.

Thanks @ABOSTM

@fpistm fpistm merged commit 9d3b308 into stm32duino:master Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants