AnsweredAssumed Answered

Problem with signal multiplexing FTM0 CH2

Question asked by Jonathan Guy on Nov 5, 2015
Latest reply on Nov 5, 2015 by Jonathan Guy

I'm having trouble with the pin signal multiplexing for FTM0 CH2 on a MK22FX512AVLL device. My board uses a lot of FTM channels for PWM functions and I'm able to successfully route all other FTM signals to pins.  For some reason FTM0 CH2 is problematic.  Regardless of the PORT settings, the output pin remains floating (undriven) by the FTM channel.

 

A simple test case is below.  This code works for other FTM channels, but not for FTM0 CH2.  I've tried routing to PTA5, PTC3 and PTC5 with similar results.

 

// Set up Timer 0 for simple edge-aligned PWM

// Enable the Clock to the FTM0 Module

SIM->SCGC6 |= SIM_SCGC6_FTM0_MASK;

 

// Route FTM0_CH2 to PTA5,

PORTA->PCR[5] = PORT_PCR_MUX(3);

 

// Disable FTM write protection

FTM0->MODE |= FTM_MODE_WPDIS_MASK;

 

//FTM Counter Value - reset counter to zero

FTM0->CNT = 0x0;

 

// Set modulo count

FTM0->MOD = sysclk / (8 * FTM0_PWM_FREQUENCY);

 

//Set the Counter Initial Value to 0

FTM0->CNTIN = 0;

 

// Configure for edge aligned PWM

FTM0->CONTROLS[1].CnSC = (FTM_CnSC_ELSB_MASK | FTM_CnSC_MSB_MASK);

 

// Set PWM to ~50%

FTM0->CONTROLS[1].CnV = 500;

 

 

// Set clock prescaler to SYSCLK divided by 2

FTM0->SC =  FTM_SC_CLKS(1) | FTM_SC_PS(1);

 

while (1);

Outcomes