STM questions

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

STM questions

Jump to solution
2,037 Views
jetty_1012
Contributor II

Hello,

I'm trying to use STM as timer. I configured as below and found the Count(CNT) increased by 1000 in 1 ms.

jetty_1012_0-1690453542933.png

jetty_1012_1-1690454093338.png

My questions are

1. Which clock does STM use?

2. The CNT increased by 1000 in 1ms only when I set GptStmPrescaler to 48, so what is the relationship between clock and GptStmPrescaler?

3. I use this API Stm_Ip_GetCounterValue to read CNT. And there's another API Stm_Ip_GetCompareValue which is related to Channel Compare (CMP0 - CMP3), what is this API used for?

 

Thanks.

0 Kudos
Reply
1 Solution
2,004 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

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

Regarding your questions:

1. The STM counter can be driven by AIPS_PLAT_CLK, FXOSC_CLK or FIRC_CLK.
2. For example:
     Assuming STM0_CLK source clock is AIPS_PLAT_CLK @24MHz.
     To configure the timer

nxf86756_0-1690838830325.png

     To configure the compare channel

nxf86756_0-1690838908344.png

3. The Stm_Ip_GetCompareValue() function gets the compare value for selected channel, it could be useful for redundancy or if you have two task, one sets the CMPx an the other can gets the value if necessary.

Hope it helps you. 

Have a nice day!

View solution in original post

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

Hi,

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

Regarding your questions:

1. The STM counter can be driven by AIPS_PLAT_CLK, FXOSC_CLK or FIRC_CLK.
2. For example:
     Assuming STM0_CLK source clock is AIPS_PLAT_CLK @24MHz.
     To configure the timer

nxf86756_0-1690838830325.png

     To configure the compare channel

nxf86756_0-1690838908344.png

3. The Stm_Ip_GetCompareValue() function gets the compare value for selected channel, it could be useful for redundancy or if you have two task, one sets the CMPx an the other can gets the value if necessary.

Hope it helps you. 

Have a nice day!

0 Kudos
Reply
1,981 Views
jetty_1012
Contributor II

@_Leo_ 

Thanks for you reply.

Could you tell me the difference between GptStmPrescaler and GptStmAlternatePrescaler?

jetty_1012_0-1690957453782.jpeg

Thanks.

 

0 Kudos
Reply
1,964 Views
_Leo_
NXP TechSupport
NXP TechSupport

The alternate prescaler is optional and it’s for dual-clock mode.