I am running a timer interrupt using FTM Timer.
I set the interrupt in 1ms cycle.
But I want to clear the FTM timer count before the 1ms interrupt is called, so that the interrupt is not called.
I set the interrupt to be called when FTM2.cnt is 8000.
How does FTM2.Cnt clear before it reaches 8000?
void FTM2_init(void)
{
PCC->PCCn[PCC_FTM2_INDEX] &= ~PCC_PCCn_CGC_MASK; /* Ensure clk disabled for config */
PCC->PCCn[PCC_FTM2_INDEX] |= PCC_PCCn_PCS(0b001) /* Clock Src=1, 8 MHz SOSCDIV1_CLK */
| PCC_PCCn_CGC_MASK; /* Enable clock for FTM regs */
FTM2->MODE |= FTM_MODE_WPDIS_MASK; /* Write protect to registers disabled (default) */
FTM2->SC = 0x00000100; /* TOIE (Timer Overflow Interrupt Ena) = 1 (default) */
/* PS (Prescaler factor) = 3. Prescaler = 1 */
FTM2->COMBINE = 0x00000000; /* FTM mode settings used: DECAPENx, MCOMBINEx, COMBINEx=0 */
FTM2->MOD = 8000-1; // 1ms
}
INT_SYS_InstallHandler(FTM2_Ovf_Reload_IRQn, &ClearFtm2Int, (isr_t *)0);
Solved! Go to Solution.
Hi,
Writing any value to CNT[COUNT] updates the counter with its initial value, CNTIN.
Section 45.4.3.3m RM r.7.
Regards,
Daniel
Hi,
Writing any value to CNT[COUNT] updates the counter with its initial value, CNTIN.
Section 45.4.3.3m RM r.7.
Regards,
Daniel