Keil Logo

CMSIS: How to retrieve RTX timer tick counter

Information in this knowledgebase article applies to:

  • MDK-ARM v5.x and newer versions


In my project I'm using RTX v4.x, namely CMSIS RTOS v1 APIs. I modified the RTX timer tick interval value OS_TICK defined in RTX_Conf_CM.c from the default value 1ms to 100us. Is there any way to retrieve the RTX timer tick counter with the resolution of this 100us tick interval?


In the CMSIS RTOS source code folder, e.g. C:\Keil\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\RTOS\RTX\SRC, you can find a global variable os_time defined in rt_Time.c file, which is the RTX system timer tick counter based on the resolution of RTX Timer tick interval value OS_TICK. Additionally there is a function rt_time_get() defined in rt_Time.c you can use to retrieve this RTX system timer tick counter os_time.

In order to use the function rt_time_get() in your project, you can include the header file rt_Time.h into your project, and add e.g. "C:\Keil\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\RTOS\RTX\SRC" to "Options for target - C/C++ - Include Paths" in µVision.

Last Reviewed: Wednesday, February 22, 2017

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.