Hello Team,
Is there any example available for PWM reading in S32K142 using FTM input capture?
If yes, please share the example.
Hello @Julián_AragónM ,
Thank you so much for quick reply.
One small doubt, can i use single CH to measure both duty cycle and period?
If i set input capture mode as DETECT BOTH EDGE. What measurement value i will get from IC_GetMeasurement?
Hello @nirmal_masilamani,
You can refer to:
You can also refer to some community posts:
Hope this helps.
Best regards,
Julián
Hello @nirmal_masilamani,
Input capture supports 3 modes:
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.pngJulin_AragnM_0-1788457862022.pngJulin_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
Hello @Julián_AragónM ,
Thank you for reply.
I am still little confused.
To measure PWM signal, how many pins i need?
I am using IC_PAL for measuring. But i am unable to measure PWM using signal pin and single ch.
RTD used V4.0.0