STM questions

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,113件の閲覧回数
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,080件の閲覧回数
_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,081件の閲覧回数
_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 件の賞賛
返信
2,057件の閲覧回数
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 件の賞賛
返信
2,040件の閲覧回数
_Leo_
NXP TechSupport
NXP TechSupport

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