LDVAL0 trigger calculation FRDM-K64F.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LDVAL0 trigger calculation FRDM-K64F.

Jump to solution
1,014 Views
josealonsovalle
Contributor III

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

0 Kudos
Reply
1 Solution
660 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

PIT module reference clock is bus clock, which could up to 60MHz of K64 product.

The K64 reference manual has an example at chapter  41.5 Initialization and application information.

At the example, bus clock is 50MHz and want to get 5.12ms interrupt, the LDVAL1 register value is 255999.

Customer need to check the K64 bus clock frequency, if the bus clock frequency is 60MHz, the PIT clock period is 16.67ns.

If customer want to generate period 500us interrupt, the LDVAL0 register value is:

(500000/16.67) - 1 =  29993

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
1 Reply
661 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

PIT module reference clock is bus clock, which could up to 60MHz of K64 product.

The K64 reference manual has an example at chapter  41.5 Initialization and application information.

At the example, bus clock is 50MHz and want to get 5.12ms interrupt, the LDVAL1 register value is 255999.

Customer need to check the K64 bus clock frequency, if the bus clock frequency is 60MHz, the PIT clock period is 16.67ns.

If customer want to generate period 500us interrupt, the LDVAL0 register value is:

(500000/16.67) - 1 =  29993

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply