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 timing off by 1 #343

Open
snakehand opened this issue Oct 20, 2023 · 0 comments
Open

PWM timing off by 1 #343

snakehand opened this issue Oct 20, 2023 · 0 comments

Comments

@snakehand
Copy link

I was trying to generate a 512kHz PWM signal from a 64MHz AHB clock, but when verifying the signal in the laboratory,
I found that the frequency was off, in a way consistent with the the ARR being off by one.

// maybe this is all u32? also, why no `- 1` vs `timer.rs`?

This situation is also alluded to in the linked comment.

Changing line 200 to :

let ticks = clk / freq - 1;

Gave me the correct output frequency. I intend to make a PR linked to this issue.

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