Dear Petr,
If I do not set CnSC[ICRST] bit on channel configured for Input Capture mode then Input Capture is not working as expected.
Following are my observations:
* I'm using FTM0 module Channel 5 PWM Output and Channel 6 for Input Capture.
* Scenario 1: FTM_C6SC[ICRST] = 0 (RESET)
-> Signal of 100Hz is given to Channel 6 for Input Capture.
CASE A:
-> PWM Output is generating 50Hz signal which is lesser than the frequency received for Input Capture.
-> Captured FTM counter values (10 Samples) for Channel 6 through Input Capture mode are:
{2429, 8679, 4513, 347, 6598, 2432, 8682, 4516, 350, 6595}
-> For 100Hz signal captured, FTM counter value should be 6250.
It's capturing variable counts however I can see that the difference between first two samples (8679-2429 = 6250) is exact as desired.
But differences between other consecutive samples are not as desired (6250 to be precise).
CASE B:
-> Now, PWM Output is generating 200Hz signal which is greater than the frequency received for Input Capture.
-> Captured FTM counter values (10 Samples) for Channel 6 through Input Capture mode are:
{518, 518, 518, 518, 518, 518, 518, 518, 518, 518}
-> For 100Hz signal captured, FTM counter value should be 6250. After some time it's giving following values:
{637, 637, 637, 637, 637, 637, 637, 637, 637, 637}
-> It's capturing constant values however not at all desired (6250 to be precise). Even counter values are increasing gradually (from 518 to 637).
* Scenario 2: FTM_C6SC[ICRST] = 1 (SET)
-> Signal of 100Hz is given to Channel 6 for Input Capture.
CASE A:
-> PWM Output is generating 50Hz signal which is lesser than the frequency received for Input Capture.
-> Captured FTM counter values (10 Samples) for Channel 6 through Input Capture mode are:
{6250, 6250, 6250, 6250, 6250, 6250, 6250, 6250, 6250, 6250}
-> Captured FTM counter values are as desired but PWM Output is not as desired.
CASE B:
-> Now, PWM Output is generating 200Hz signal which is greater than the frequency received for Input Capture.
-> PWM Output is as expected but Input Capture is not as desired.
* Are these all observations are because of common counter available for entire FTM module ? Please review above findings and let me know whether it's a hardware limitation that one FTM module can not be used for PWM Output and Input Capture simultaneously. Looking forward for your response
BR,
Nitin verma