When I use FTM PWM driver application resets

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

When I use FTM PWM driver application resets

Jump to solution
818 Views
josephgundel
Contributor III

When I use the FTM PWM Hal Drivers my application resets.

I am using a K02.

I call a hardware init function which sets the pins

void configure_ftm_pins(uint32_t instance)

{

    switch(instance)

    {

        case 0:                         /*FTM0_CH0,1,4,5*/

            PORT_HAL_SetMuxMode(PORTD_BASE,0u,kPortMuxAlt4);

            PORT_HAL_SetMuxMode(PORTD_BASE,1u,kPortMuxAlt4);

            PORT_HAL_SetMuxMode(PORTD_BASE,4u,kPortMuxAlt4);

            PORT_HAL_SetMuxMode(PORTD_BASE,5u,kPortMuxAlt4);

            break;

        default:

            break;

    }

}

I then I do the following.

ftm_pwm_param_t ftmParam = {

          .mode                   = kFtmEdgeAlignedPWM,

          .edgeMode               = kFtmLowTrue,

          .uFrequencyHZ           = 240000,

          .uDutyCyclePercent      = 0,

          .uFirstEdgeDelayPercent = 0,

      };

      ftm_user_config_t ftmInfo;

      memset(&ftmInfo, 0, sizeof(ftmInfo));

      ftmInfo.syncMethod = kFtmUseSoftwareTrig;

       FTM_DRV_Init(FTM_INSTANCE, &ftmInfo);

       FTM_DRV_PwmStart(FTM_INSTANCE, &ftmParam, 0);

              // Issue a software trigger to update registers

       FTM_HAL_SetSoftwareTriggerCmd(g_ftmBaseAddr[FTM_INSTANCE], true);

My App imediately goes into reset.

Am I forgeting anything.

Labels (1)
Tags (3)
0 Kudos
Reply
1 Solution
637 Views
josephgundel
Contributor III

Turns out I had the pin MUX set incorrectly.

All working now. Thanks

View solution in original post

0 Kudos
Reply
2 Replies
637 Views
EarlOrlando
Senior Contributor II

Hi Joseph,

I recommend to follow one example provided by KSDK (C:\Freescale\KSDK_1.2.0\examples\twrk64f120m\driver_examples\ftm) where is needed to set the clock too.

Regards,

Earl.

0 Kudos
Reply
638 Views
josephgundel
Contributor III

Turns out I had the pin MUX set incorrectly.

All working now. Thanks

0 Kudos
Reply