i have a problem with the calculation of the LDVAL0 trigger, in the reference manual is the equation:
LDVAL trigger = (period / clock period) - 1
what is exactly the clock period, is 8.3ns (120MHz) for this case or 20ns (50Mhz) because in the reference manual tells that the PIT clock has a frequency of 50Mhz.
i tried with both and the result is wrong.
this is my code..
SIM_SCGC6 |= SIM_SCGC6_PIT_MASK; // Turn on clock to to the PIT module
PIT_LDVAL0 = ????; // Timeout period = 500us
PIT_MCR = PIT_MCR_FRZ_MASK; // Enable clock for PIT, freeze PIT in debug mode
PIT_TCTRL0 = PIT_TCTRL_TIE_MASK | // Enable PIT interrupt
PIT_TCTRL_TEN_MASK; // and PIT