AnsweredAssumed Answered

FTM0 clock configuration problem

Question asked by Leandro Fabián Rocco on Mar 23, 2019
Latest reply on Mar 27, 2019 by Alice_Yang

Hi, I am using MCUXpresso IDE and FRDM-K64F board.

 

I am trying to configure four PWM channels using FTM0 at a frequency of 50hz. My definitions are the following:

 

#define FTM_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_McgFixedFreqClk)

#define FTM_MODULE FTM0
#define PWM_CH0 0U
#define PWM_CH1 1U
#define PWM_CH2 2U
#define PWM_CH3 3U

 

And my configuration code is the following:

 

    ftm_config_t ftmInfo;
    ftm_chnl_pwm_signal_param_t ftmParam[4];

 

    ftmParam[0].chnlNumber = (ftm_chnl_t)PWM_CH0;
    ftmParam[0].level = kFTM_HighTrue;
    ftmParam[0].dutyCyclePercent = 5U;
    ftmParam[0].firstEdgeDelayPercent = 0U;

 

    ftmParam[1].chnlNumber = (ftm_chnl_t)PWM_CH1;
    ftmParam[1].level = kFTM_HighTrue;
    ftmParam[1].dutyCyclePercent = 5U;
    ftmParam[1].firstEdgeDelayPercent = 0U;

 

    ftmParam[2].chnlNumber = (ftm_chnl_t)PWM_CH2;
    ftmParam[2].level = kFTM_HighTrue;
    ftmParam[2].dutyCyclePercent = 5U;
    ftmParam[2].firstEdgeDelayPercent = 0U;

 

    ftmParam[3].chnlNumber = (ftm_chnl_t)PWM_CH3;
    ftmParam[3].level = kFTM_HighTrue;
    ftmParam[3].dutyCyclePercent = 5U;
    ftmParam[3].firstEdgeDelayPercent = 0U;

 

    FTM_GetDefaultConfig(&ftmInfo);
    FTM_Init(FTM_MODULE, &ftmInfo);
    FTM_SetupPwm(FTM_MODULE, ftmParam, 4U, kFTM_EdgeAlignedPwm, 50U, FTM_SOURCE_CLOCK);
    FTM_StartTimer(FTM_MODULE, kFTM_FixedClock);

 

My problem is that the definition FTM_SOURCE_CLOCK is equal to 32552, but looking at my clock settings, the value of FTM_SOURCE_CLOCK should be 390625.

 

Below, is my clocks configurations.  Can you help me with this problem?

 

Thanks.

 

 

Outcomes