LDVAL0 trigger calculation FRDM-K64F.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LDVAL0 trigger calculation FRDM-K64F.

跳至解决方案
850 次查看
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 项奖励
1 解答
496 次查看
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 项奖励
1 回复
497 次查看
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 项奖励