Hi! All:
I am using one of the K60 Flex Timer (FTM) modules to act as Input Capture,and the only setup for the FTM I do is:
void FTM_InputCapture_init( void )
{
SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;
PORTA_PCR4 |= PORT_PCR_MUX(0x3); //引脚PTA4设置为 FTM0_CH1功能
FTM0_C1SC &= ~FTM_CnSC_CHF_MASK;
FTM0_C1SC |= FTM_CnSC_CHIE_MASK;
FTM0_C1SC &= ~FTM_CnSC_MSB_MASK;
FTM0_C1SC &= ~FTM_CnSC_MSA_MASK;
FTM0_C1SC |= FTM_CnSC_ELSB_MASK; //下降沿触发
FTM0_C1SC &= ~FTM_CnSC_ELSA_MASK;
FTM0_SC |=FTM_SC_CLKS(0x01);
FTM0_SC |=FTM_SC_PS(2);
FTM0_MODE &= ~FTM_MODE_FTMEN_MASK;
FTM0_COMBINE=0; //DECAPEN=0,双边沿捕捉禁止,COMBINE=0,不级联
FTM0_C1SC &= ~FTM_CnSC_CHIE_MASK;
enable_irq (62);
}
However,it doesn't work;it is unable to enter the interrupt program.What am I doing wrong?
After a quick look,
Hellou guys,
i have problem with input capture.i have same MCU.
Interrupt work fine, but i cant rest FTM_CnV register to 0. In every interrupt in debug mode value in CnV register increase value by "10" .. e.g. 3423, 3433, 3443 etc. Input to PTA pin is stable 1kHz signal. Please where is wrong?
Hi Mark,
Are you having the same problem when is not in debug mode? I mean, maybe when an interrupt appears is because a rising or falling edge, and this edge will be lost when you read CnV register in debug mode.
Regards.