task not switching

Posted by seek25 on March 16, 2016

Hello,

I have 4 tasks all of the same priority, cortex M4. No task uses freeRTOS functions.

Once task A is executed it never gets pre-empted. It just gets executed over and over starving the other.

FreeRTOS is 7.3.0 and thre is no definition about time slice in the freertosconfig.h file.

How was that supposed to work?

Thanks.

IC

Edit:

From here: http://www.freertos.org/FAQSched.html

How are tasks of equal priority scheduled? Round robin - Ready state tasks that share a priority "take turns" to run.


task not switching

Posted by edwards3 on March 16, 2016

Sounds like the tick interrupt might not be running. Put a break point on xTaskIncrementTick in Task.c, is it hit?


task not switching

Posted by seek25 on March 16, 2016

Just found this, since it is not defined it should switch between them.

configUSETIMESLICING By default (if configUSETIMESLICING is not defined, or if configUSETIMESLICING is defined as 1) FreeRTOS uses prioritised preemptive scheduling with time slicing. That means the RTOS scheduler will always run the highest priority task that is in the Ready state, and will switch between tasks of equal priority on every RTOS tick interrupt. If configUSETIMESLICING is set to 0 then the RTOS scheduler will still run the highest priority task that is in the Ready state, but will not switch between tasks of equal priority just because a tick interrupt has occurred.


task not switching

Posted by seek25 on March 16, 2016

There is no xTaskIncrementTick in tasks.c

However this gets called and increments


task not switching

Posted by seek25 on March 16, 2016
	uxCurrentNumberOfTasks	6	volatile unsigned long(static storage at address 0x20010efc.

)

6 tasks? I have 4 and adding the idle task will make 5, why 6 evaluated at signed portBASE_TYPE xTaskResumeAll( void )

			while( listLIST_IS_EMPTY( ( xList * ) &xPendingReadyList ) == pdFALSE )
			{

uxNumberOfItems = 0

the below pxTCB = ( tskTCB * ) listGETOWNEROFHEADENTRY( ( ( xList * ) &xPendingReadyList ) ); uxListRemove( &( pxTCB->xEventListItem ) ); never reached


task not switching

Posted by rtel on March 17, 2016

Why are you using such an old version? I think in that version the function will be called vTaskIncrementTick() (v prefix instead of x prefix).

The additional task might be the timer service task - that will be the case if you have configUSE_TIMERS set to 1.