Hello Eduardo,
The use of TPM input capture mode is usually applicable to when the period between input pulses needs to be measured. However, it would seem that your specific requirement is to measure the number of incoming pulses only. You would therefore need to separately count the number of input capture events occurring using a separate counter global variable. For each input capture interrupt, the counter would be incremented within the ISR. The TPM channel register does not provide useful information for your specific requirement.
An alternative approach would be to feed the input pulses to the TCLK input of the TPM module. For this case, the TPM counter register would provide a count of the number of pulses received since the register was last zeroed. It is simply a matter of reading the register - the channels associated with the particular TPM module are not used. With this method interrupts are not necessary unless you require to handle large count values where TPM overflow can occur. Of course, the prescale divider for the TPM will need to be set for divide by one.
Either approach can be made to work. If you require to make use of other channels associated with the TPM module, you would use the input capture count method. If not, using the external clock input would be simpler, and requires fewer interrupts, if any.
Regards,
Mac