S32K311 EMIOS GPT

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

S32K311 EMIOS GPT

Jump to solution
3,659 Views
nirmal_masilamani
Contributor IV

Hi,

I am trying to configure timer for 500ms usin EMIOS GPT. How to calculate the compareValue ?

Is there any documents available?

Tags (3)
0 Kudos
Reply
1 Solution
3,622 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

There is the S32K3 RTD Training eMIOS presentation (attached).

On the other hand, for GPT frequency of 2Hz (500ms) with eMIOS clock frequency of 120MHz you need 60,000,000 ticks:

1s -> 120MHz (120,000,000 ticks)
2Hz = (1/2)s
->120,000,000 *(1/2) = 60,000,000 ticks
But max ticks are 65,534 (16 bits).

Using Global Prescaler = 256 (in Emios_Mcl_Ip driver) and Gpt Emios Prescaler = 15 (in Emios_Gpt driver):

1s -> 120MHz/256/15 (31,250 ticks)
2Hz = (1/2)s
->31,250 *(1/2) = 15,625 ticks

Please find attached project.

This example implement a General Purpose Timer (GPT) with eMIOS (CH_0), such timer generates an interrupt when it reaches to its defined compare value and its respective notification function toggles the on-board blue LED (PTB8).

S32DS 3.6 + RTD 5.0.0 (S32K31XEVB-Q100)

_Leo__1-1742333753262.png

Hope it helps you.

Have a nice day!

 

View solution in original post

0 Kudos
Reply
2 Replies
3,623 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

There is the S32K3 RTD Training eMIOS presentation (attached).

On the other hand, for GPT frequency of 2Hz (500ms) with eMIOS clock frequency of 120MHz you need 60,000,000 ticks:

1s -> 120MHz (120,000,000 ticks)
2Hz = (1/2)s
->120,000,000 *(1/2) = 60,000,000 ticks
But max ticks are 65,534 (16 bits).

Using Global Prescaler = 256 (in Emios_Mcl_Ip driver) and Gpt Emios Prescaler = 15 (in Emios_Gpt driver):

1s -> 120MHz/256/15 (31,250 ticks)
2Hz = (1/2)s
->31,250 *(1/2) = 15,625 ticks

Please find attached project.

This example implement a General Purpose Timer (GPT) with eMIOS (CH_0), such timer generates an interrupt when it reaches to its defined compare value and its respective notification function toggles the on-board blue LED (PTB8).

S32DS 3.6 + RTD 5.0.0 (S32K31XEVB-Q100)

_Leo__1-1742333753262.png

Hope it helps you.

Have a nice day!

 

0 Kudos
Reply
3,603 Views
nirmal_masilamani
Contributor IV

Hi @_Leo_ ,

Thank you for your support.

Small doubt, how to derive this 1s -> 120MHz (120,000,000 ticks)?

Tags (3)
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2063799%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K311%20EMIOS%20GPT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2063799%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20configure%20timer%20for%20500ms%20usin%20EMIOS%20GPT.%20How%20to%20calculate%20the%20compareValue%20%3F%3C%2FP%3E%3CP%3EIs%20there%20any%20documents%20available%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2064580%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K311%20EMIOS%20GPT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2064580%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F199320%22%20target%3D%22_blank%22%3E%40_Leo_%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20support.%3C%2FP%3E%3CP%3ESmall%20doubt%2C%20how%20to%20derive%20this%26nbsp%3B%3CSPAN%3E1s%20-%26gt%3B%20120MHz%20(120%2C000%2C000%20ticks)%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2064084%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K311%20EMIOS%20GPT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2064084%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20so%20much%20for%20your%20interest%20in%20our%20products%20and%20for%20using%20our%20community.%3C%2FP%3E%0A%3CP%3EThere%20is%20the%20%3CEM%3ES32K3%20RTD%20Training%20eMIOS%3C%2FEM%3E%20presentation%20(attached).%3C%2FP%3E%0A%3CP%3EOn%20the%20other%20hand%2C%20for%20GPT%20frequency%20of%202Hz%20(500ms)%20with%20eMIOS%20clock%20frequency%20of%20120MHz%20you%20need%2060%2C000%2C000%20ticks%3A%3C%2FP%3E%0A%3CP%3E1s%20-%26gt%3B%20120MHz%20(120%2C000%2C000%20ticks)%3CBR%20%2F%3E2Hz%20%3D%20(1%2F2)s%3CBR%20%2F%3E-%26gt%3B120%2C000%2C000%20*(1%2F2)%20%3D%2060%2C000%2C000%20ticks%3CBR%20%2F%3EBut%20max%20ticks%20are%2065%2C534%20(16%20bits).%3C%2FP%3E%0A%3CP%3EUsing%20%3CEM%3EGlobal%20Prescaler%20%3D%20256%3C%2FEM%3E%20(in%20%3CEM%3EEmios_Mcl_Ip%3C%2FEM%3E%20driver)%20and%20%3CEM%3EGpt%20Emios%20Prescaler%20%3D%2015%3C%2FEM%3E%20(in%20%3CEM%3EEmios_Gpt%3C%2FEM%3E%20driver)%3A%3C%2FP%3E%0A%3CP%3E1s%20-%26gt%3B%20120MHz%2F256%2F15%20(31%2C250%20ticks)%3CBR%20%2F%3E2Hz%20%3D%20(1%2F2)s%3CBR%20%2F%3E-%26gt%3B31%2C250%20*(1%2F2)%20%3D%2015%2C625%20ticks%3C%2FP%3E%0A%3CP%3EPlease%20find%20attached%20project.%3C%2FP%3E%0A%3CP%3EThis%20example%20implement%20a%20%3CEM%3EGeneral%20Purpose%20Timer%20(GPT)%3C%2FEM%3E%20with%20eMIOS%20(%3CEM%3ECH_0%3C%2FEM%3E)%2C%20such%20timer%20generates%20an%20interrupt%20when%20it%20reaches%20to%20its%20defined%20compare%20value%20and%20its%20respective%20notification%20function%20toggles%20the%20on-board%20blue%20LED%20(%3CEM%3EPTB8%3C%2FEM%3E).%3C%2FP%3E%0A%3CP%3ES32DS%203.6%20%2B%20RTD%205.0.0%20(S32K31XEVB-Q100)%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22_Leo__1-1742333753262.png%22%20style%3D%22width%3A%20898px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Leo__1-1742333753262.png%22%20style%3D%22width%3A%20898px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F328670i71CA76B526797084%2Fimage-dimensions%2F898x138%3Fv%3Dv2%22%20width%3D%22898%22%20height%3D%22138%22%20role%3D%22button%22%20title%3D%22_Leo__1-1742333753262.png%22%20alt%3D%22_Leo__1-1742333753262.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EHope%20it%20helps%20you.%3C%2FP%3E%0A%3CP%3EHave%20a%20nice%20day!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%E2%80%83%3C%2FP%3E%0A%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E