I see you are using ftm_dual_edge_capture example from the SDK as a starting point. Is there an issue if you run example code with no modifications?
Ans: no problem
Could you please provide what did you modify in the example?
Ans: Modify in the exapmle


while(1)
{
// while (ftmFirstChannelInterruptFlag_PITCH != true)
//{
//}
// while (ftmSecondChannelInterruptFlag_PITCH != true)
// {
// }
#if 1
if ((ftmFirstChannelInterruptFlag_PITCH == true) && (ftmSecondChannelInterruptFlag_PITCH == true))
{
ftmFirstChannelInterruptFlag_PITCH = false;
ftmSecondChannelInterruptFlag_PITCH = false;
/* Clear first channel interrupt flag after the second edge is detected.*/
FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, FTM_FIRST_CHANNEL_PITCH_FLAG);
/* Clear overflow interrupt flag.*/
FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, kFTM_TimeOverflowFlag);
/* Disable overflow interrupt.*/
FTM_DisableInterrupts(DEMO_FTM_BASEADDR, kFTM_TimeOverflowInterruptEnable);
capture1Val_pitch = DEMO_FTM_BASEADDR->CONTROLS[BOARD_FTM_INPUT_CAPTURE_CHANNEL_PAIR_PITCH * 2].CnV;
capture2Val_pitch = DEMO_FTM_BASEADDR->CONTROLS[(BOARD_FTM_INPUT_CAPTURE_CHANNEL_PAIR_PITCH * 2) + 1].CnV;
/* FTM clock source is not prescaled and is
* divided by 1000000 as the output is printed in microseconds
*/
if(capture2Val_pitch > capture1Val_pitch)
{
//PRINTF("\r\nCapture value PITCH C(n)V=%x\r\n", capture1Val_pitch);
//PRINTF("\r\nCapture value PITCH C(n+1)V=%x\r\n", capture2Val_pitch);
pulseWidth_pitch =
(float)(((g_secondChannelOverflowCount_PITCH - g_firstChannelOverflowCount_PITCH) * 65536 + capture2Val_pitch - capture1Val_pitch) +
1) /
((float)FTM_SOURCE_CLOCK / 1000000);
//PRINTF("\r\nInput signals frequency = %f hz\r\n", 1/(pulseWidth_pitch*2)*1000000);
PRINTF("\r\nInput signals PITCH pulse width = %f us\r\n", pulseWidth_pitch);
}
g_secondChannelOverflowCount_PITCH = 0;
g_firstChannelOverflowCount_PITCH = 0;
/* Enable first channel interrupt */
FTM_EnableInterrupts(DEMO_FTM_BASEADDR, FTM_FIRST_CHANNEL_INTERRUPT_ENABLE_PITCH);
/* Enable second channel interrupt when the second edge is detected */
FTM_EnableInterrupts(DEMO_FTM_BASEADDR, FTM_SECOND_CHANNEL_INTERRUPT_ENABLE_PITCH);
/* Enable overflow interrupt */
FTM_EnableInterrupts(DEMO_FTM_BASEADDR, kFTM_TimeOverflowInterruptEnable);
}
#endif
if ((ftmFirstChannelInterruptFlag_YAW == true) && (ftmSecondChannelInterruptFlag_YAW == true))
{
ftmFirstChannelInterruptFlag_YAW = false;
ftmSecondChannelInterruptFlag_YAW = false;
/* Clear first channel interrupt flag after the second edge is detected.*/
FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, FTM_FIRST_CHANNEL_YAW_FLAG);
/* Clear overflow interrupt flag.*/
FTM_ClearStatusFlags(DEMO_FTM_BASEADDR, kFTM_TimeOverflowFlag);
/* Disable overflow interrupt.*/
FTM_DisableInterrupts(DEMO_FTM_BASEADDR, kFTM_TimeOverflowInterruptEnable);
capture1Val_yaw = DEMO_FTM_BASEADDR->CONTROLS[BOARD_FTM_INPUT_CAPTURE_CHANNEL_PAIR_YAW * 2].CnV;
capture2Val_yaw = DEMO_FTM_BASEADDR->CONTROLS[(BOARD_FTM_INPUT_CAPTURE_CHANNEL_PAIR_YAW * 2) + 1].CnV;
/* FTM clock source is not prescaled and is
* divided by 1000000 as the output is printed in microseconds
*/
if(capture2Val_yaw > capture1Val_yaw)
{
//PRINTF("\r\nCapture value YAW C(n)V=%x\r\n", capture1Val_yaw);
//PRINTF("\r\nCapture value YAW C(n+1)V=%x\r\n", capture2Val_yaw);
pulseWidth_yaw =
(float)(((g_secondChannelOverflowCount_YAW - g_firstChannelOverflowCount_YAW) * 65536 + capture2Val_yaw - capture1Val_yaw) +
1) /
((float)FTM_SOURCE_CLOCK / 1000000);
//PRINTF("\r\nInput signals frequency = %f hz\r\n", 1/(pulseWidth_pitch*2)*1000000);
PRINTF("\r\nInput signals YAW pulse width = %f us\r\n", pulseWidth_yaw);
}
g_secondChannelOverflowCount_YAW = 0;
g_firstChannelOverflowCount_YAW = 0;
/* Enable first channel interrupt */
FTM_EnableInterrupts(DEMO_FTM_BASEADDR, FTM_FIRST_CHANNEL_INTERRUPT_ENABLE_YAW);
/* Enable second channel interrupt when the second edge is detected */
FTM_EnableInterrupts(DEMO_FTM_BASEADDR, FTM_SECOND_CHANNEL_INTERRUPT_ENABLE_YAW);
/* Enable overflow interrupt */
FTM_EnableInterrupts(DEMO_FTM_BASEADDR, kFTM_TimeOverflowInterruptEnable);
}
}
Additionally, could you please let me know what specific line of your code is the MCU halting?
Ans: Halting
