# FreeRTOS, uxNumberOfItems of  pxReadyTasksLists\[ uxTopPriority \] becomes "0" randomly

**URL:** <https://forums.freertos.org/t/freertos-uxnumberofitems-of-pxreadytaskslists-uxtoppriority-becomes-0-randomly/1298>\
**Category:** Kernel\
**Created:** [December 18, 2014, 6:53am UTC](https://forums.freertos.org/t/freertos-uxnumberofitems-of-pxreadytaskslists-uxtoppriority-becomes-0-randomly/1298 "2014-12-18T06:53:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 18, 2014, 6:53am UTC](https://forums.freertos.org/t/freertos-uxnumberofitems-of-pxreadytaskslists-uxtoppriority-becomes-0-randomly/1298/1 "2014-12-18T06:53:24Z")

</div>

**[tarun-patel](https://sourceforge.net/u/tarun-patel/)** wrote on [Thursday, December 18, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/3b79175a/#dd00):

Hi,

First of all, as an embedded developer, I want thank FreeRTOS to make my life easier.

* * *

I am using FreeRTOS V8.1.2 on custom board using STM32L151 uC. My applications run smooth most of the time. however, sometimes within 1 minute after power ON or sometimes after few hours, freeRTOS calls configASSERT function and execution get stopped (as I have written configASSERT function to stop execution).

In configASSERT function, debugger shows error is in “tasks.c” file and line number which cause error is “2160”.

After some debugging, I found that uxNumberOfItems of pxReadyTasksLists[uxTopPriority] becomes “0” due to that configASSERT been called.

I am using configUSE\_PORT\_OPTIMISED\_TASK\_SELECTION. However, I have tried with disabling “port optimized task selection” with no luck.

I have provided more than sufficient stack to every tasks and set every interrupt priority to configLIBRARY\_LOWEST\_INTERRUPT\_PRIORITY. Yes, I am using “FromISR” functions from ISR.

I have also called “NVIC\_PriorityGroupConfig(NVIC\_PriorityGroup\_4);” in main after system initialization.

I have tried hard to solve this issue but till data not find any solution.

I am requesting you all to help me to get rid on this issue.

Thanks in Advance.  
Tarun

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [December 18, 2014, 9:12am UTC](https://forums.freertos.org/t/freertos-uxnumberofitems-of-pxreadytaskslists-uxtoppriority-becomes-0-randomly/1298/2 "2014-12-18T09:12:45Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, December 18, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/3b79175a/#e13c):

It sounds like you are doing all the right things. Do you also have stack overflow and malloc failed hook functions defined? ([http://www.freertos.org/a00016.html](http://www.freertos.org/a00016.html)).

Is it possible you are experiencing a simple data corruption somewhere, for example, writing off the end of a buffer, or using a pointer that has become corrupt?

We have had an idea for a while to add some [optional] ‘check values’ into the code that place known values at the start and end of structures to make it easier to see if a structure has simply been over written by something that should not have done.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 18, 2014, 12:54pm UTC](https://forums.freertos.org/t/freertos-uxnumberofitems-of-pxreadytaskslists-uxtoppriority-becomes-0-randomly/1298/3 "2014-12-18T12:54:34Z")

</div>

**[tarun-patel](https://sourceforge.net/u/tarun-patel/)** wrote on [Thursday, December 18, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/3b79175a/#e13c/dc51):

Thanks for quick response.

Yes, both stack overflow and malloc failed hook functions defined. I am not getting any call of both function. So that should not be a issue.

BTW, I like your idea about ‘check values’. I will implement it in my code.

However, if you find any other solution, please post it to me.

Thanks,  
Tarun
