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

Bugfix: CounterHz and Counter wait #449

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

AndreySmirnov81
Copy link
Contributor

CounterHz and Counter do not wait properly after the second and subsequent start.

@burrbull
Copy link
Member

burrbull commented Oct 7, 2022

It is strange. trigger_update should not cause interrupt.

stm32f1xx-hal/src/timer.rs

Lines 374 to 379 in cafbac1

fn trigger_update(&mut self) {
// Sets the URS bit to prevent an interrupt from being triggered by
// the UG bit
self.cr1.modify(|_, w| w.urs().set_bit());
self.egr.write(|w| w.ug().set_bit());
self.cr1.modify(|_, w| w.urs().clear_bit());

Maybe wait doesn't clear flag correctly?

@AndreySmirnov81
Copy link
Contributor Author

wait clears the flag correctly, however, the timer does not stop and works cyclically, which leads to the fact that the TIMx_SR.UIF flag is constantly set.

@burrbull
Copy link
Member

burrbull commented Oct 7, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 7, 2022

@bors bors bot merged commit 5f0a53f into stm32-rs:master Oct 7, 2022
@AndreySmirnov81 AndreySmirnov81 deleted the timer_fix branch October 7, 2022 17:05
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