STM questions

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

STM questions

跳至解决方案
2,050 次查看
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 项奖励
回复
1 解答
2,017 次查看
_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 项奖励
回复
3 回复数
2,018 次查看
_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 项奖励
回复
1,994 次查看
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 项奖励
回复
1,977 次查看
_Leo_
NXP TechSupport
NXP TechSupport

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