Thanks for reply Diana,
I set FTM2 as quadrature decoder mode as below:
FSL_NVIC->ISER[111 / 32] |= (1 << (111 % 32));
/* Encoder simulated with totally 36 rising/falling edges */
FTM2->MOD = FTM_MOD_MOD(36);
FTM2->CNTIN = FTM_CNTIN_INIT(0);
FTM2->QDCTRL= FTM_QDCTRL_QUADEN_MASK;
FTM2->CNT = 0;
/* Select clock */
FTM2->SC = FTM_SC_CLKS(1) | FTM_SC_TOIE_MASK;
void FTM2_Ch0_Ch1_IRQHandler()//this interrupt is shared by ch0&1
{
PTC->PTOR |= 1<<9; // Toggle
FTM2->SC &= ~FTM_SC_TOF_MASK;
Hall_AB_Angle = FTM2->CNT;
}
I cannot saw a toggle wave on my oscilloscope from pin C9. I guess interrupt didn't work.
Can you let me know what is wrong in my settings?
Thank you.
Hao