Keil Logo

CMSIS: OS Timer callback queue overflow


Information in this knowledgebase article applies to:

  • MDK v5.x
  • CMSIS RTOS v2 (RTX v5.x)
  • CMSIS RTOS v1 (RTX v4.x)

SYMPTOM

Occasionally my program running CMSIS RTOS v2 (RTX v5.x) will end up in the function osRtxErrorNotify() with the error code osRtxErrorTimerQueueOverflow. What can cause such an error with osRtxErrorTimerQueueOverflow? How can I resolve it?

CAUSE

Items are put into this OS timer callback queue every time when a timer expires. These items are removed from this queue by the "Timer thread", which is running at the thread priority defined in RTX_Config.h. Before the current timer callback completes, no other callback items are removed from the queue. If items are put into the timer callback queue faster than they can be processed, when the number of items in the queue is more than the max size of the queue, such an timer callback queue overflow error will occur.

RESOLUTION

Here are some possible solutions to resolve this issue:

  1. Write short code in your timer callbacks, so that they can finish faster.
  2. The default size of OS Timer Callback Queue "OS_TIMER_CB_QUEUE" is defined in RTX_Config.h. Increasing this Timer Callback Queue size to be enough to hold the maximum number of possible active callback functions in your program. 
  3. Avoid using unnecessary periodic timers. Making times be periodic can cause an unexpected number of callbacks to be put into the queue. A periodic timer is rescheduled as soon as it is put into the queue, which means in this case another item may be put into the queue even before the callback starts to execute.  
  4. The "Timer thread" is blocked by other threads with a higher priority for too long time, so that the items in the timer callback queue cannot be processed in time.

STATUS

The cause of such a OS Timer callback queue overflow issue and the possible solutions mentioned above also apply to CMSIS RTOS v1 (RTX v4.x).

MORE INFORMATION

Last Reviewed: Friday, September 28, 2018


Did this article provide the answer you needed?
 
Yes
No
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.