Skip to content

drivers: mcpwm: esp32: Fix duty rounding #94880

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raffarost
Copy link

Duty value in the driver is calculated from timer cycles, which can introduce precision loss when converting from pwm_set() to pwm_set_cycles(). To avoid truncating values with a fractional part ≥ 0.5 and further drifting the effective duty, round the computed duty to the nearest integer.

Duty value in the driver is calculated from timer cycles, which
can introduce precision loss when converting from pwm_set() to
pwm_set_cycles(). To avoid truncating values with a fractional
part ≥ 0.5 and further drifting the effective duty, round the
computed duty to the nearest integer.

Signed-off-by: Raffael Rostagno <[email protected]>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: PWM Pulse Width Modulation platform: ESP32 Espressif ESP32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants