Hi Derek
The FlexTimer (FTM) on Kinetis MCU is built upon a very simple timer, HCS08 Timer PWM Module (TPM), used for many years on Freescale 8-bit microcontrollers. The FTM extends the functionality of TPM to meet demands of motor control applications. A simple PWM code can be as simple as shown below:
/*Using FTM2_CH0 FTM2_CH1 output PWM with 90% high, 10% low wave*/
void FTM_EPWM(void)
{
PORTA_PCR10 = (0|PORT_PCR_MUX(3)); /* FTM2_CH0 enable on PTA10 */
PORTB_PCR18 = (0|PORT_PCR_MUX(3)); /* FTM2_CH0 enable on PTB18 */
PORTA_PCR11 = (0|PORT_PCR_MUX(3)); /* FTM2_CH1 enable on PTA11 */
PORTB_PCR19 = (0|PORT_PCR_MUX(3)); /* FTM2_CH1 enable on PTB19 */
FTM2_MOD = 0x0063; /* 0x0063 / 25MHz = 4uS PWM period */
/* Configure timers for edge aligned PWM High True Pulses */
printf("FTM2_ Edge_Aligned Test 1\r\n");
printf("Please check the waveform, 90% Hign Ture EPWM\r\n");
FTM2_C0SC = 0x28; /* No Interrupts; High True pulses on Edge Aligned PWM */
FTM2_C1SC = 0x28;
FTM2_C0V = 0x005A; /* 90% pulse width */
FTM2_C1V = 0x005A;
FTM2_SC = 0x08; /* Edge Aligned PWM running from BUSCLK / 1 */
}
Are you using MQX???
Have a great day,
Sol
--------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
------------------------------------------------------------------------------------------------------------------