S32K 144 FTM Timer.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,953件の閲覧回数
kwakd_y
Contributor III

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);

1 解決策
1,477件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

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

元の投稿で解決策を見る

1 返信
1,478件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

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