Skip to content

PWM timing off by 1 #343

@snakehand

Description

@snakehand

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions