AnsweredAssumed Answered

FTM not working unless COMBINE=1 on MK20DX128

Question asked by Stefan Burstrom on Sep 18, 2016
Latest reply on Sep 18, 2016 by xiangjun.rong

I am trying to generate 6 independent edge aligned PWM signals (with the same time base) using a MK20DX128 and I cannot get the PWMs to run. All examples that I have found are setting COMBINE=1 for the channels which gives me 4 combined channels, but I need to use them individually and I dont need the inverted version of the signal. If I clear FTM_ENABLE in FTM_MODE, then I get the channels running, but as soon as FTM_ENABLE is 1, then the channels are silent if I dont configure them to be combined.

According to the docs, it should be possible to run the channels with COMBINE=0, but I am not sure what I am missing when I set up the channels. What is the purpose of FTM_ENABLE?

 

This is how I configure the FTM:

FTM0_MODE = FTM_MODE_FTMEN_MASK | FTM_MODE_WPDIS_MASK;

FTM0_SC = FTM_SC_PS(1) | FTM_SC_CLKS(1);

FTM_CnSC_REG(FTM0_BASE_PTR,channel) = FTM_CnSC_MSB_MASK | FTM_CnSC_ELSA_MASK;

FTM0_MOD = period;

FTM_CnV_REG(FTM0_BASE_PTR,channel) = low_time;

FTM0_PWMLOAD = FTM_PWMLOAD_LDOK_MASK | 0xff;

 

What am I missing? Or should I simply run the FTM with FTM_ENABLE = 0 (this seems odd to me, but FTM_ENABLE is not really documented so it is not clear what functionality that will be missed)

 

Thanks!

/Stefan

Outcomes