diff --git a/drivers/pwm/pwm_mcux.c b/drivers/pwm/pwm_mcux.c index bb654737aac..7405800b244 100644 --- a/drivers/pwm/pwm_mcux.c +++ b/drivers/pwm/pwm_mcux.c @@ -88,7 +88,7 @@ static int mcux_pwm_set_cycles(const struct device *dev, uint32_t channel, return -EINVAL; } - pwm_freq = (clock_freq >> config->prescale) / period_cycles; + pwm_freq = DIV_ROUND_UP(clock_freq >> config->prescale, period_cycles); if (pwm_freq == 0) { LOG_ERR("Could not set up pwm_freq=%d", pwm_freq);