AnsweredAssumed Answered

Generate PWM using FTM on GW64

Question asked by Designer11 on Mar 18, 2016
Latest reply on Mar 28, 2016 by vicentegomez

Hi All,

I'm using the Flextimer Module on the GW64 micro-controller to generate PWM on channel 0, but without any luck. Below is the initialization code. The objective is to generate a 10Khz

void Init_FTM(void) {   SCGC4_FTM = 0x01; //Enable FlexTimer Module clock for PWM   /*==========================   * Set up Port pin function   * =========================*/   PTCPF3_C4 = 0b001; //Configure port C4 as FTMCH0   PTCPF3_C5 = 0b001; //Configure port C5 as FTMCH1   /*FTM Clock Source Selection*/   FTMSC_CLKSx = 0b01;    FTMSC_PS = 0b011; //Pre-scale Factor Selection*/   FTMSC_CPWMS = 0b0; //Edge-aligned PWM select:    FTMC0SC_MS0B = 0b1;   //FTMC0SC_ELS0x = 0b10;   FTMC0SC_ELS0A = 0b0;   FTMC0SC_ELS0B = 0b1;    FTMMODH = 0x0008; //PWM period   FTMC0VH = 0x0005; //Pulse width (duty cycle)   FTMC0SC_CH0IE = 0x00; //Polling } interrupt VectorNumber_Vftmch0 void FTMCH0_Isr(void) {   FTMC0SC_CH0F = 0; }

 

Could anyone show me what I'm doing wrong ?

 

BR,

Vu

Outcomes