Hello,
I use KSDK2.0 with IAR Workbench on Target K64.
With FTM-Modul I want to generate triac firing pulses for phase angle Modulation.
So I use the following sequence.
#define BOARD_PWM_INSTANCE_50HZ FTM3
// PWM-Modul Init 50Hz
FTM_GetDefaultConfig(&ftmInfo);
// Initializes the FTM module.
ftmInfo.prescale = kFTM_Prescale_Divide_8;
FTM_Init(BOARD_PWM_INSTANCE_50HZ, &ftmInfo);
FTM_SetupOutputCompare( BOARD_PWM_INSTANCE_50HZ, BOARD_PWM_TRIAC1_CH, kFTM_NoOutputSignal, 0 );
FTM_StartTimer(BOARD_PWM_INSTANCE_50HZ, kFTM_SystemClock);
After that sequence the FTM-module does not count.
I have to write a value (0xffff --> to have a free running Counter) to "MOD" register.
BOARD_PWM_INSTANCE_50HZ->MOD = 0xffff;
The reason is written in "K64 Sub-Family Reference Manual, Rev. 2, January 2014" on page 1007.
"...
• When MOD = 0x0000, CNTIN = 0x0000, for example
after reset, and FTMEN = 1, the FTM counter remains
stopped at 0x0000 until a non-zero value is written into the
MOD or CNTIN registers.
..."
The Function FTM_StartTimer() works, when the timer is used in PWM-mode with FTM_SetupPwm() because the "MOD" register is written in this function to adjust the PWM frequency.
Best Regards
Manfred