uxSchedulerSuspended

ale82t wrote on Wednesday, March 31, 2010:

Hi to all,
I have a problem with multitask in freeRTOS 6.0.4. The problem is after some time all tasks are suspended without any apparent reason. FreeRTOS isn’t in a fault situation,but when i controlled the value of the variable uxSchedulerSuspended in task.c i found a very big value (5a5a5a5a5a6). What is the possible cause? Is it possible a task writes something in the memory region where this variable is placed?

rtel wrote on Thursday, April 01, 2010:

That definitely looks like a memory corruption, I suspect the number you see starts a5, rather than 5a, as this is the value that task stacks are filled with before the task starts.

You don’t give enough information to offer an opinion on what the possible cause could be.

matita87 wrote on Thursday, August 03, 2017:

Hi to all
I have a similar problem related to uxSchedulerSuspended.
In my proj this variable start with FFFFFFFF in routine:
void vTaskSuspendAll( void )
{
/* A critical section is not required as the variable is of type
BaseType_t. Please read Richard Barry’s reply in the following link to a
post in the FreeRTOS support forum before reporting this as a bug! -
http://goo.gl/wu4acr */
++uxSchedulerSuspended;
}
even if it was initialized with pbFALSE:
PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE;
The MDK is Keil, FreeRTOS 9.0.0 and board STM32F4.
The optimization is set to 0.
NOTE: I have another trivial project (with a different configuration) where vTaskSuspendAll works fine.
Regards.

rtel wrote on Thursday, August 03, 2017:

I don’t understand your question. Can it be rephrased to the following
statement:

“uxSchedulerSuspended has an initial value of 0xffffffff even though the
C code initialised it to 0”.

If so that sounds like a compiler or linker or linker script problem,
not a FreeRTOS problem.

matita87 wrote on Friday, August 04, 2017:

Dear
In the module task.c the variable uxSchedulerSuspended is define as:
PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended= ( UBaseType_t )pdFALSE;
This variable can be incremented only by vTaskSuspendAll() which is call the first time in xTaskCreate.
The first time the vTaskSuspendAll() is called the uxSchedulerSuspended is equal to FFFFFFFE (and then incremented by 1)
This problem appears only with this variable and it causes a problem in vTaskDelay() (e.i. the vTaskDelay() never return because the xTaskResumeAll fails).
Thanks
Regards

matita87 wrote on Friday, August 04, 2017:

This problem related to the uxSchedulerSuspended was solved.
vTaskDelay still dosen’t work, it never return.
I can see that:
vTaskDelay(100ms)
{
vTaskSuspendAll(); //seems ok
prvAddCurrentTaskToDelayedList()
{
uxListRemove// return 0
//INCLUDE_vTaskSuspend == 1
// here note xTimeToWake > xNextTaskUnblockTime. is this strange ?
}
xTaskResumeAll()
{
//xPendingReadyList is not empty.
//xYieldPending = pdTRUE;
//pxTCB != NULL
//uxPendedTicks == 0
//Here the problem. It not possible to continue debue another tash execute this routine.
}
}

How can i solve ?
thaks all regads

rtel wrote on Friday, August 04, 2017:

This problem related to the uxSchedulerSuspended was solved.
vTaskDelay still dosen’t work, it never return.

For the benefit of others using this forum, and to ensure this resource
is as useful for others as possible, please state how the problem was
solved, after which we can look at your new problem.