drivers: pwm: pwm_mcux_sctimer: Fix stopping PWM

By Starting the timer when period was set to 0, the SCTimer was giving
control of the pin back to the timer and over-riding the value written
to base->OUTPUT register. Consequently, the PWM timer was never
stopped and still using the previously configured period.

The PWM now correctly stops when setting the period to 0.

Signed-off-by: Guy Morand <guy.morand@bytesatwork.ch>
This commit is contained in:
Guy Morand 2022-11-07 08:44:07 +01:00 committed by Mahesh Mahadevan
parent 4bae4f426f
commit 2419505e35
1 changed files with 0 additions and 5 deletions

View File

@ -73,11 +73,6 @@ static int mcux_sctimer_pwm_set_cycles(const struct device *dev,
base->OUTPUT |= (1UL << channel);
}
/* Make sure the PWM is setup */
if (data->period_cycles[channel] != 0) {
SCTIMER_StartTimer(config->base, kSCTIMER_Counter_U);
}
return 0;
}