AnsweredAssumed Answered

FTM0_CnV and FTM0_C(n+1)V not correctly loaded in KSKD "FTM_SetupPwm" function

Question asked by Marco Aurelio P. Coelho on Jul 15, 2016
Latest reply on Jul 27, 2016 by Marco Aurelio P. Coelho

Hello,

 

I'm trying to help a customer generate PWM signals (complementary and de-phased pairs) in a Kinetis, with KSDK v2.

 

In my test code (for FRDM-K64F), I configured:

    ftmParam[0].chnlNumber = 2;
     ftmParam[0].level = kFTM_LowTrue;
     ftmParam[0].dutyCyclePercent = 50U;
     ftmParam[0].firstEdgeDelayPercent = 0U;

     ftmParam[1].chnlNumber = 3;
     ftmParam[1].level = kFTM_LowTrue;
     ftmParam[1].dutyCyclePercent = 50U;
     ftmParam[1].firstEdgeDelayPercent = 75U;

So, in my example, FTM0_CH6 and FTM0_CH7 have to be de-phased by 75% of period from FTM0_CH4 and FTM0_CH5.

Since my scope is analog, I can't see the de-phasing and will have to ask the customer to make a test. But, before that, I'd like to make sure that FTM registers were configured according to desired.

In debugger, going into "FTM_SetupPwm" function, and executing those two lines as highlighted on the screenshot bellow, the values loaded into FTM0_C6V and FTM0_C7V should respectively be 0x28E and 0x442, but are "0", instead:

 

 

 

That doesn't make any sense at all! How can we fix that?

Have attached my code for your reference. You can perfectly reproduce the same problem on your side with my code on a FRDM-K64F

Anybody can help us on that please?

 

 

Marco Coelho

Applications Engineer

Siletec Eletronica

Original Attachment has been moved to: novo_projeto_k64f.zip

Outcomes