AnsweredAssumed Answered

FTM PWM Questions

Question asked by Derek Cook on Jul 19, 2018
Latest reply on Jul 23, 2018 by Derek Cook



I have a couple of questions about the FTMs. 


1) Is it possible to set one FTM channel to be one frequency, and another FTM channel to be a different frequency? This does not work for me. I am trying to set channel 0 to run at 25kHz on FTM2, and channel 1 to run at 1kHz. When I do this, both channels run at 1kHz: 


Here is my init function:


/* Configure ftm params with frequency 25kHZ */
ftm_u_pwmParam.chnlNumber = FTM_U_PWM_CHANNEL;
ftm_u_pwmParam.level = u_pwmLevel;
ftm_u_pwmParam.dutyCyclePercent = u_pwm_dutyCycle;
ftm_u_pwmParam.firstEdgeDelayPercent = 0U;

ftm_brake_pwmParam.chnlNumber = FTM_BRAKE_PWM_CHANNEL;
ftm_brake_pwmParam.level = brake_pwmLevel;
ftm_brake_pwmParam.dutyCyclePercent = brake_pwm_dutyCycle;
ftm_brake_pwmParam.firstEdgeDelayPercent = 0U;


/* Initialize FTM module */
FTM_Init(FTM2_BASEADDR, &ftm2_pwmInfo);

FTM_SetupPwm(FTM2_BASEADDR, &ftm_u_pwmParam, 1U, kFTM_CenterAlignedPwm, 25000U, FTM_SOURCE_CLOCK);
FTM_SetupPwm(FTM2_BASEADDR, &ftm_brake_pwmParam, 1U, kFTM_CenterAlignedPwm, 1000U, FTM_SOURCE_CLOCK);

/* Enable channel interrupt flag.*/

/* Enable at the NVIC */

FTM_StartTimer(FTM2_BASEADDR, kFTM_SystemClock);


2) Can I get a frequency less that 1kHz out of an FTM Channel? Looking at the different clocks, this should be my minimum edge aligned PWM frequency, however anything I set less than 1kHz comes out as 1kHz: 

kCLOCK_CoreSysClk 120000000 – Min = 500Hz

kCLOCK_PlatClk 120000000 – Min = 500Hz

kCLOCK_BusClk 60000000 – Min = 250Hz

kCLOCK_FlexBusClk 30000000 – Min = 125Hz

kCLOCK_FlashClk 24000000 – Min = 100Hz


3) When I try to use a clock slower than the kCLOCK_BusClk, such as the kCLOCK_FlexBusClk and kCLOCK_FlashClk my output PWM is double of what I set? Why would this be? It is double for both the Edge and Center Aligned PWM.


4) I can't see any difference between a center and edge aligned PWM. Reading online it seems the center aligned PWM period should be double the edge aligned since the counter has to count up and then back down, but when I set center or edge aligned both of the periods are equal.