LDVAL0 trigger calculation FRDM-K64F.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LDVAL0 trigger calculation FRDM-K64F.

ソリューションへジャンプ
889件の閲覧回数
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

ラベル(2)
0 件の賞賛
返信
1 解決策
535件の閲覧回数
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 返信
536件の閲覧回数
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 件の賞賛
返信