diff --git a/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c b/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c index 96c1e6791f9..309b1b632ed 100644 --- a/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c +++ b/Libraries/PeriphDrivers/Source/TMR/tmr_revb.c @@ -278,12 +278,12 @@ int MXC_TMR_RevB_SetPWM(mxc_tmr_revb_regs_t *tmr, uint32_t pwm) MXC_TMR_RevB_ClearFlags(tmr); // Clear flags so we can catch the next one while (!MXC_TMR_RevB_GetFlags(tmr)) {} // Wait for next PWM transition MXC_TMR_RevB_Stop(tmr); // Pause timer - MXC_TMR_RevB_SetCount(tmr, 0); // Reset the count + MXC_TMR_RevB_SetCount(tmr, 1); // Reset the count MXC_TMR_RevB_ClearFlags( tmr); // Clear flags since app code wants the new PWM transitions set by this function } - tmr->pwm = pwm; + tmr->pwm = pwm ? pwm : 1; while (!(tmr->intfl & MXC_F_TMR_REVB_INTFL_WRDONE_A)) {} if (timera_is_running) {