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

PWM: start_pwm resets ARPE bit in counter control register #501

Closed
TorstenStrunk opened this issue Jul 4, 2022 · 1 comment
Closed

PWM: start_pwm resets ARPE bit in counter control register #501

TorstenStrunk opened this issue Jul 4, 2022 · 1 comment

Comments

@TorstenStrunk
Copy link
Contributor

While using PWM output with different periods and duty cycles I observed glitches in the generated output signals. Even though the pwm and pwm_hz methods first enable auto reload preloads in CR1, the final call of self.tim.start_pwm() uses a write to CR1, which clears the ARPE bit again!

TorstenStrunk added a commit to TorstenStrunk/stm32f4xx-hal that referenced this issue Aug 13, 2022
Use register.modify instead of register.write method to start timer
(i.e. do same like calling timer.enable_counter()).
This avoids touching bits like ARPE (or DIR,..) which may have been set before
and should stay intact.
TorstenStrunk added a commit to TorstenStrunk/stm32f4xx-hal that referenced this issue Aug 13, 2022
Use register.modify instead of register.write method to start timer
(i.e. do same like calling timer.enable_counter()).
This avoids touching bits like ARPE (or DIR,..) which may have been set before
and should stay intact.
bors bot added a commit that referenced this issue Aug 14, 2022
513: Addressing issue #501 with start_pwm r=burrbull a=ganzalt

Second try to get issue #501 fixed.

Co-authored-by: ganzalt <torsten.strunk@gmx.de>
@TorstenStrunk
Copy link
Contributor Author

This has been solved with #513

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

No branches or pull requests

1 participant