PaulStoffregen / TimerOne

TimerOne Library with optimization and expanded hardware support
http://www.pjrc.com/teensy/td_libs_TimerOne.html
470 stars 209 forks source link

Race Condition with frequent updates to setPeriod() #13

Closed FrankBoesing closed 5 years ago

FrankBoesing commented 8 years ago

A fix is to set:

FTM1_CNT =FTM1_CNT;

FTM1_MOD = pwmPeriod;

FTM1_SC = FTM_SC_CLKS(1) | clockSelectBits | (sc & FTM_SC_TOIE);

in setPeriod() See: https://forum.pjrc.com/threads/34936-TimerOne-setPeriod-not-working-inside-ISR-function-Teensy-3-2