I create a new project with MCU is K60 in CodeWarrior and I choose Device Initialization at final step of that wizard. Then I configure FTM0 to generate PWM in Processor Expert and generated MCUInit.c and MCUInit.h. However, there are no PWM generated, and I read this code snip in MCUInit.c:
SIM_SCGC6 |= 0x01000000UL; /* FTM0_C0SC: ELSB=1 */FTM0_C0SC |= 0x08UL; /* FTM0_C0V: VAL=0x07D0 */FTM0_C0V = 0x07D0UL; /* FTM0_FILTER: CH0FVAL=0 */FTM0_FILTER &= (unsigned long int)~0x0FUL; /* FTM0_MOD: MOD|=0x0FA0 */FTM0_MOD |= 0x0FA0UL; /* FTM0_SC: CPWMS=1,CLKS|=1 */FTM0_SC |= 0x28UL;
In fact, FTM0_SC have to be setted BEFORE FTM0_C0SC, or PWM will not be generated.
Is this a bug? Thanks.