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


2 Task by non-preemptive mode

Posted by daruse on January 16, 2012
i have 2 tasks and set non-preemptive mode.
No my problem is, the scheduler calls only the second task. the first task is not running/call.
can somebody help me?

this is main:

xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, mainCHECK_PARAMETER, mainCHECK_TASK_PRIORITY, NULL );

xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );

/* my tasks */
xTaskCreate(FKT_TASK1, "Task1", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
xTaskCreate(FKT_TASK2, "Task2", configMINIMAL_STACK_SIZE, NULL, 5, NULL);

vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );


and the config.h
#define configUSE_PREEMPTION0
#define configUSE_IDLE_HOOK0
#define configUSE_TICK_HOOK0
#define configTICK_RATE_HZ( ( portTickType ) 1000 ) // 1 Millisekunde
#define configMAX_PRIORITIES( ( unsigned portBASE_TYPE ) 5 )

RE: 2 Task by non-preemptive mode

Posted by daruse on January 16, 2012
the task1 and task2 are outside from main:

void FKT_TASK1 (void *pvParameters)

void FKT_TASK1 (void *pvParameters)

RE: 2 Task by non-preemptive mode

Posted by Dave on January 16, 2012
If you have set the code to non-premtive mode then with those task definitions only one task will ever run. You have told the scheduler not to preempt a task, so the task will carry on running until it takes itself out of the Running state, for example by calling vTaskDelay(), or it explicitly yields, for example by calling taskYIELD().

If you want both tasks to run then they must yeild.

“void FKT_TASK1 (void *pvParameters)

void FKT_TASK1 (void *pvParameters)

RE: 2 Task by non-preemptive mode

Posted by daruse on January 17, 2012
Thanks, now will both tasks executed.

RE: 2 Task by non-preemptive mode

Posted by daruse on January 17, 2012
I have yet a second question.
Do you know the settings, that the task is called 1 ms?

I have used the vTaskDelayUntil (in every task), but then the scheduler jump into the vRegTestFailed function.
Thanks in advance

[ 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