Hello,
I'm trying to use STM as timer. I configured as below and found the Count(CNT) increased by 1000 in 1 ms.
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.
Solved! Go to Solution.
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
To configure the compare channel
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!
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
To configure the compare channel
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!
Thanks for you reply.
Could you tell me the difference between GptStmPrescaler and GptStmAlternatePrescaler?
Thanks.
The alternate prescaler is optional and it’s for dual-clock mode.