Francois,
I think you should be able to do this but it's unclear from your comments which pin your square wave is ccoming in on.
I'll assume if your were capturing edges of your square wave that your signal went in the TPM2CH0 pin.
Maybe what you need to do is insert it into the square wave into TPM2CLK pin. (or TPM1CLK)
Setting the TPM2SC to external clock (TPM2SC=0x18) directs the clock source for timer 2 to come from that pin(TPM2CLK). Have a look at the diagram in the datasheet at the beginning on the Timer/PWM module section. It shows the optional external clock inputs coming from those pins for each of the timer modules
This also means that your accumulation duration timer has to come from one of the other timers (presumably timer module 1 which I guess whos source would be one of the internal clocks)
Then it is the TPM2CNTH and TPM2CNTL (timer module 2 counters) and not the channel timer/counter that increment on your external clock input.
Check the datasheet about this. Your external input synchonises i think with the bus clock, so i'm guessing your scenario will be fine but if your input signal is faster than the bus clock then your count wont be accurate.
Writing to either TPM2CNTH or TPM2CNTL clears the whole 16bit timer word. Maybe set a timer overflow interrupt on timer 2 so you know you've hit 65535 counts (if you have to "carry" your overall counter)
I think doing that you should be able to count clock pulses over a time period without so many interrupts.
Technically you wouldn't have to use any timer 2 compare channels, just the main timer/counter for module 2.
Flipping the scenario on its head, you could additionally also use a timer 2 channel output compare to measure the time taken for a given number of clock pulses, marking time using timer module 1. You could also do this without the timer 2 channel by setting the modulo register and using the timer 2 module overflow flag/interrupt. But it sounds like you just want to discover the frequency of your quare wave.
JD