FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2012 Threads] 2 Task by non-preemptive modePosted by daruse on January 16, 2012 Hi, 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: prvSetupHardware();
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 ); vTaskStartScheduler();
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 modePosted by daruse on January 16, 2012 the task1 and task2 are outside from main:
void FKT_TASK1 (void *pvParameters) { while[(1){ i1++;} }
void FKT_TASK1 (void *pvParameters) { while(1){ i2++} }
RE: 2 Task by non-preemptive modePosted 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) { while[(1){ i1++; taskYIELD();} }
void FKT_TASK1 (void *pvParameters) { while(1){ i2++; taskYIELD();} }”
RE: 2 Task by non-preemptive modePosted by daruse on January 17, 2012 Thanks, now will both tasks executed.
RE: 2 Task by non-preemptive modePosted 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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|