Hello @nirmal_masilamani,
Input capture supports 3 modes:
- Capture on Rising Edge Only -> period only
- Capture on Falling Edge Only -> period only
- Capture on Rising or Falling Edge -> Need to read the level status through GPIO or CnSC [CHIS] bit to know the high-level pulse width or the low-level pulse width.
NOTE: The CHIS bit should be ignored when the channel (n) is not in an input mode.
NOTE: When the pair channels is on dual edge mode, the channel (n+1) CHIS bit is the channel (n+1) input value and not the channel (n) input value (this signal is the input signal used by the dual edge mode).
For PWM duty cycle capture, you should use dual edge capture. Otherwise, you will only get the period of high level or low level. In the dual edge capture mode, only channel (n) input is used and channel (n+1) input is ignored.
Julin_AragnM_0-1788457862022.png
IC_GetMeasurement will return the pulse width in ticks, which you can then use to calculate signal frequency:
/* Get the latest value */
inputCaptureMeas = IC_GetMeasurement(&ic_pal_1_instanceConfig, channel);
/* Calculate the signal frequency using recorded data*/
inputCaptureMeas = frequency / (inputCaptureMeas);
Best regards,
Julián