Problem with signal multiplexing FTM0 CH2

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with signal multiplexing FTM0 CH2

Jump to solution
195 Views
rev
Contributor III

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);

0 Kudos
1 Solution
96 Views
rev
Contributor III

I have a solution but not an explanation. 

If I set the FTMEN bit in the MODE register, then all FTM channels are available as PWM signals. Since I was not using any advanced FTM functions, I assumed TPM compatibility (FTMEN=0) would be OK. 

Incidentally, without FTMEN set there are strange effects on certain other FTM channels.  For example, FTM0 CH0 has glitches in the PWM output.  These go away when FTMEN=1.

I've been using TPM legacy mode on other Kinetis devices for more than 1 year with this same motor control code.  I wonder if something changed in the latest silicon revision for this part?  It sure looks like silicon issue.  Moving on with my work-around.

View solution in original post

0 Kudos
1 Reply
97 Views
rev
Contributor III

I have a solution but not an explanation. 

If I set the FTMEN bit in the MODE register, then all FTM channels are available as PWM signals. Since I was not using any advanced FTM functions, I assumed TPM compatibility (FTMEN=0) would be OK. 

Incidentally, without FTMEN set there are strange effects on certain other FTM channels.  For example, FTM0 CH0 has glitches in the PWM output.  These go away when FTMEN=1.

I've been using TPM legacy mode on other Kinetis devices for more than 1 year with this same motor control code.  I wonder if something changed in the latest silicon revision for this part?  It sure looks like silicon issue.  Moving on with my work-around.

View solution in original post

0 Kudos