AnsweredAssumed Answered

FTM counter reset / start couting on external trigger event?

Question asked by Florian Harmuth on Nov 21, 2016
Latest reply on Nov 24, 2016 by Florian Harmuth

Hello all,

currently I'm trying to port an application from a MC56F847 controller to a Kinetis V4x controller. Therefore I need and an FTM counter to start counting based on an the beginning of an PWM cycle / signal. After two configureable delays I need to enable two outputs (independently).

So here is my concept so far:

- PWM generation: PWMA_0A -> PWMA0_TRG0

- Connection between PWM & FTM component: PWMA_A0_TRG0 -> over xbar -> FTM0_TRIG2

- Two channels as output compar mode: FTM0_CH0 & FTM0_CH1


I use the following code o initializ the timer component:


ftmConfig.extTriggers =kFTM_Chnl0Trigger;
ftmConfig.chnlInitState =0;
ftmConfig.pwmSyncMode =kFTM_HardwareTrigger_2;
if (FTM_Init(FTM0, &ftmConfig) != kStatus_Success)
    return false;



FTM_SetupOutputCompare(FTM0, kFTM_Chnl_0, kFTM_SetOnMatch, 1000);

FTM0->SYNC |= (1<<2);    // reinit


And here the problem begins. If I now enable the timer via FTM_StartTimer(...) it starts counting and the channel 0 output will be set after a while. Is it possible start the counting when the signal TRIG2 occurs? The other problem is, that the counter currently just overflows and starts counting from zero again - but it should stop counting and reset the outputs to their initial values - is that possible?


Best Regards,