diff --git a/drivers/pwm/pwm_wch_gptm.c b/drivers/pwm/pwm_wch_gptm.c index 26f70a9af7e..46fa4b52a9e 100644 --- a/drivers/pwm/pwm_wch_gptm.c +++ b/drivers/pwm/pwm_wch_gptm.c @@ -94,7 +94,11 @@ static int pwm_wch_gptm_set_cycles(const struct device *dev, uint32_t channel, } if (period_cycles != 0) { - regs->ATRLR = period_cycles; + /* + * Note that the period is ATRLR+1. The earlier checks handle the case where + * pulse_cycles is zero or equal to period_cycles. + */ + regs->ATRLR = period_cycles - 1; } /* Set the polarity and enable */