Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


task not switching

Posted by seek25 on March 16, 2016


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?




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

  • Calculate the time to wake - this may overflow but this is not a problem. */ xTimeToWake = xTickCount + xTicksToDelay;

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.

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists