# Code is hanging at xResult = xTimerGenericCommand?

**URL:** <https://forums.freertos.org/t/code-is-hanging-at-xresult-xtimergenericcommand/18003>\
**Category:** NXP\
**Tags:** debug\
**Created:** [August 16, 2023, 1:04pm UTC](https://forums.freertos.org/t/code-is-hanging-at-xresult-xtimergenericcommand/18003 "2023-08-16T13:04:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![s-igren](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/s-igren/32/3460_2.png) [@s-igren](https://forums.freertos.org/u/s-igren)\
**Post date:** [August 16, 2023, 1:04pm UTC](https://forums.freertos.org/t/code-is-hanging-at-xresult-xtimergenericcommand/18003/1 "2023-08-16T13:04:13Z")

</div>

So i have used Freertos timers before, and in this project i have used 3 freertos timer. it was running smoothly earlier. but ad task increased i have notice the code gets hang at

```auto
							xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY );
							configASSERT( xResult );

```

in timers.c

For troubleshooting i disabled one freertos timer but than it started Hanging at assert for another timer. this is timer related issue but i am unable to pinpoint what is causing it?

Timer task Stack depth is 256  
Timer task priority is 3  
Timer queue length is 10

---

<div class="post-metadata">

**Author:** ![jefftenney](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/jefftenney/32/1314_2.png) [@jefftenney](https://forums.freertos.org/u/jefftenney)\
**Post date:** [August 16, 2023, 2:38pm UTC](https://forums.freertos.org/t/code-is-hanging-at-xresult-xtimergenericcommand/18003/2 "2023-08-16T14:38:23Z")

</div>

Is the code actually stuck on the configASSERT() statement? A very common implementation of configASSERT() is to loop forever so that a developer can identify a problem and inspect the cause.

What is the return value in xResult?

---

<div class="post-metadata">

**Author:** ![s-igren](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/s-igren/32/3460_2.png) [@s-igren](https://forums.freertos.org/u/s-igren)\
**Post date:** [August 16, 2023, 4:46pm UTC](https://forums.freertos.org/t/code-is-hanging-at-xresult-xtimergenericcommand/18003/3 "2023-08-16T16:46:33Z")

</div>

Hi Jefftenney,  
Thanks for reply, the xResult is 0. It just started happening randomly.

---

<div class="post-metadata">

**Author:** ![jefftenney](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/jefftenney/32/1314_2.png) [@jefftenney](https://forums.freertos.org/u/jefftenney)\
**Post date:** [August 16, 2023, 9:34pm UTC](https://forums.freertos.org/t/code-is-hanging-at-xresult-xtimergenericcommand/18003/4 "2023-08-16T21:34:12Z")

</div>

I’m assuming you found that xResult is zero _after_ the call the xTimerGenericCommand(). And I’m also assuming your configASSERT() is defined to loop forever and do nothing when an assertion fails. Will you please use a debugger to verify these two assumptions?

Assuming the above, the timer command queue is likely full. Can you try increasing the queue length from 10 to 15?

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [August 17, 2023, 5:14am UTC](https://forums.freertos.org/t/code-is-hanging-at-xresult-xtimergenericcommand/18003/5 "2023-08-17T05:14:18Z")

</div>

Also, is the timer task highest priority? Is it possible that other lower priority tasks are starving timer task?
