PWM timer problem with HCS08 - freescale
I can't get the math to work out to either 1.25 ms or 3.75 ms.

If your TPM is using the bus clock and the bus clock is at 4.3 MHz then each tick is:

$$\frac{1}{4.3\times10^6} = 232.56\,\mathrm{ns}$$

If you have modulo_value set to 4309 (decimal), then a rollover occurs every:

$$232.56\,\mathrm{ns}\times4309 = 1\,\mathrm{ms}$$

So if you're checking for 40 occurrences of TPM1SC_TOF, then output should toggle every 40 ms.

If you have modulo_value set to 4309 (hexadecimal), then a rollover occurs every:

$$232.56\,\mathrm{ns}\times17,161 = 3.99\,\mathrm{ms}$$

In which case output should toggle every 159.64 ms.

Try using the debugger to see what TPM1MODH and TPM1MODL are actually being set to. Determine the proper radix (probably hexadecimal in the debugger) and use the calculations above to see if you can get the numbers to work out to what you're seeing.

Also of note from page 357 of the Reference Manual:


  Clear TOF by reading the TPM status and control register when TOF is
  set and then writing a logic 0 to TOF. If another TPM overflow occurs
  before the clearing sequence is completed, the sequence is reset so
  TOF remains set after the clear sequence was completed for the earlier
  TOF.


Which you are not doing in your loop.