AnsweredAssumed Answered

FTM PWM - no output

Question asked by Tomáš Pilný on May 4, 2015
Latest reply on May 4, 2015 by xiangjun.rong

Hello everone,


I'am using MK60N512VMD100 on custom board, with CW v10.6.


I'm having problems with FTM PWM output. At this stage I'm just trying to figure out what will work for me and how to set everything properly. With the code given below I'm not getting any output on expected pin. I've just hooked it up to LED with resistor just to see if it outputs ANYTHING - and it doesn't. At this moment I'm in school measuring the output and it seems to be the same for any combination of MOD, CnV and PS:

MODCnVPSperiodpulse width
FFFFFFFF020 ms10 ms
FFFFF020 ms10 ms
FFFFF720 ms10 ms

And so on. My conclusion is that the PWM signal is not getting through. Can you see where the problem might be ? What have I forgot ?





SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; // enable clock for PTA
SIM_SCGC6 |= SIM_SCGC6_FTM0_MASK; // enable clock for FTM0
//Edit registers when no clock is fed to timer so the MOD value, gets pushed in immediately
FTM0_SC = 0; // Make sure its Off!
PORTA_PCR6 |= PORT_PCR_MUX(3); // FTM0 CH3 minerva 25
GPIOA_PDDR |= (1 << 6); // set as output


FTM0_MODE |= FTM_MODE_WPDIS_MASK; // disable write protection
FTM0_CNT = 0; // counter initialization


FTM0_C3SC = 0x20; // edge aligned PWM MSB = 1


FTM0_C3V = 0xFFFF; // when the CNT reaches this value -> FTM does what CnSC tells (clear)


FTM0_CONF |= FTM_CONF_BDMMODE(3); // run in debug mode


FTM0_SC |= FTM_SC_CLKS(0x01); // Select the system clock => turn on the FTM