Hello,
There seems to be a misunderstanding about the interrupt operation of the TPM module. For a TPM clock frequency of 1.048576 MHz (after pre-scaling), this will give a clock period of 0.954 us, however, interrupts do not occur at this rate. You have the choice of using an interrupt on each TPM module overflow (by default each 65536 TPM clock cycles), or setting up a TPM channel for output compare operation after each 100 us increment.
With the TPM clock you are using, an interrupt will need to occur each 105 TPM clock cycles (or 420 bus cycles). To use the TPM overflow method, you would need to change TPMxMOD to a value of 104. Alternatively, you could enable output compare operation for one of the TPM channels (software compare only), and then simply increment the current channel value by 105, on the occurrence of each output compare interrupt.
Personally, I would usually prefer the latter method because the TPMxMOD value is unaffected, therefore not disrupting the operation of the other channels for the TPM module. For either method, you will need to ensure that the interrupt processing code within lthe ISR occupies considerably less than 420 bus cycles to execute, and the allowable time is likely to be affected by any other interrupts that may also occur.
If you are attempting to provide an accurate real time clock, 100 us interrupts may not be the best choice. With the watch crystal you are using, the interrupt period will actually be 100.1358...us. A better choice might be 122.0703...us (1/8192 seconds).
Regards,
Mac