S32K144 EVB FTM0CH3 PWM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 EVB FTM0CH3 PWM

583 Views
AjRj14
Contributor III

Hi, I am trying to generate PWM in PTD1 pin using the FTM0 CH3.

But I am unable to get any output. But when I am configuring the PTD1 to FTM2 CH1(Alternative 4), I am able to get PWM output. Please find the configuration settings below for FTM0 CH3.

void FTM0_PWM_MODE()
{
PCC->PCCn[PCC_FLEXTMR0_INDEX] = PCC_PCCn_PCS(6) | PCC_PCCn_CGC_MASK; /* Enable clock for FTM2 */
PCC->PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK; /* Enable clock for PORTD */
PORTD->PCR[1] = PORT_PCR_MUX(2);                                       // Set PTD1 for FTM1 – Channel1
FTM0->MODE = 0x07; /                                                                    /FTM_MODE_FTMEN_MASK;
FTM0->SYNCONF = 0x00000280;
FTM0->CONTROLS[3].CnSC=FTM_CnSC_MSB_MASK|FTM_CnSC_ELSB_MASK; // Select high-true pulses
FTM0->COMBINE =0x00000020;
FTM0->CNTIN = FTM_CNTIN_INIT(0);
FTM0->SC = 0x00FF000C;
FTM0->MOD = 50000 - 1;
FTM0->CONTROLS[3].CnV=FTM_CnV_VAL(25000);
}

FTM Counter frequency is  80Mhz/16(presacale). Could you please check and tell me why I am not able to use FTM0 CH3 for PTD1.

0 Kudos
1 Reply

560 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if you update MOD/CnV after CLKS[1:0] ≠ 0:0 and FTMEN = 1 then trigger must be done (SW trigger in your case). It is not seen in your code, but probably you have it.
Also SYNCEN1 must be set to allow synchronization of pairs 2/3. But you have set SYNCEN0 only. Try to use 
FTM0->COMBINE =0x00002000;

BR, Petr

0 Kudos