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.
Solved! Go to Solution.
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.
Turns out I had the pin MUX set incorrectly.
All working now. Thanks