AnsweredAssumed Answered

Problem resetting FTM timers, what is the correct way to do it?

Question asked by Oskar Örnvall on Nov 29, 2011
Latest reply on Nov 30, 2011 by Oskar Örnvall

I am using the ftm timer to measure rtos performance, I'm not using systick because it is reserved for the rtos.


The FTM timer is setup to use the core clock but the counter will overflow if performing multiple tests or doing stuff between tests. Therefore I want to reset it between tests.


If the clock overflows the counter stops, why doesn't it start over from 0?

If I try to reset the counter by using reset_ftm_timer() it stops.

If i run setup_ftm_timer twice, the counter stops.


What am I doing wrong?




#include "MK60N512MD100.h"


void setup_ftm_timer()

    FTM0->SC = 0x0;
    FTM0->CNT = 0x0;
    FTM0->CNTIN = 0;
    FTM0->SC = FTM_SC_CLKS(1);


void reset_ftm_timer() {
    FTM0->CNT = 0x0;


All input and feedback is appreciated