AnsweredAssumed Answered

LDVAL0 trigger calculation FRDM-K64F.

Question asked by Jose Alonso Vallejo Rios on May 2, 2015
Latest reply on May 3, 2015 by Hui_Ma

Hi everyone,

 

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..

 

//PIT initialization

  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

Outcomes