Hi, Animesh,
Pls refer to section 44.1.8 FTM Hall sensor support in RM of KV58, I copied it here.
The KV58 has an internal EOR circuit, which can EOR of FTM2_CH0/1 and FTM1_CH1 and connect the EOR circuit output to the FTM2_CH1. If SIM_SOPT9[FTM1ICH1SRC]=0, FTM1_CH1 piad signal is the capture signal, if SIM_SOPT9[FTM1ICH1SRC]=1, exclusive OR of FTM2_CH0,FTM2_CH1, and FTM1_CH1 is the capture signal.
Regarding the question how to configure the pin FTM2_CHx as capture function, this is the procedure, for example
PTB19/CAN0_RX FTM2_CH1 FTM3_CH3 FLEXPWM1_B1/FTM2_QD_PHB/FB_OE_b
1)Enable PTB port gated clock
SIM_SCGC5|=0x01<<10;
2)configure as PTB19 as FTM2_CH1 function
PORTB_PCR19|=0x03<<8;
3)SIM_SOPT9|=0x01<<10; //set FTM2ICH1SRC bit
4)enable FTM2 gated clock
SIM_SCGC6|0x01<<26;
5)configure the FTM2_CH1 as capture function.
FTM2_C1SC[MSnB:MSnA]=2b'00;
FTM2_C1SC[ELSnB:ELSnA]=2b'11; //Capture onRising or FallingEdge
Pls refer to 44.4.6 Channel (n) Status And Control (FTMx_CnSC)
6You can read the GPIOB19 input register to get the logic level of PTB19 pin at the reading time even the pin is configured as FTM2_CH1 function.
Hope it can help you
BR
Xiangjun Rong
