Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

problems on same priority tasks

Posted by sara on March 1, 2008
Hi all,
I have working with i.MX27 multimedia application processor.I am using FreeRTOS v4.7.1 and IAR embedded workbench v5.11 for my project.I am newbie to the FreeRTOS.I have created simply 3 tasks and assign the priorities.there is no problem when tasks have different priotities.
But if i assign the same priority for 2 or 3 tasks,it will point out last priority task only.if task 1 and 2 have same priority,it points 2nd task only or tasks 1&3 or 2&3 have same priority,it points 3rd task only.
I dont know what will happened on 2 or more tasks have the same priority.so anyone suggest idea for my problem.



regards,
saravanan.r

RE: problems on same priority tasks

Posted by Richard on March 1, 2008
Do you have configUSE_PREEMPTION set to 1 in FreeRTOSConfig.h?

If so, can you create three very simple tasks (may that do nothing but flash an LED each, then sleep) that have a similar structure to your real tasks to see if these run as expected - and if not post the code for these simple tasks here.

Regards.

RE: problems on same priority tasks

Posted by sara on March 3, 2008
Hi richardbarry,
Thanks for your quick reply.Now i am currently working in IAR Embedded Workbench v5.11 simulator.I have no any hardware device.so i cant able to check in hardware device.I have write my piece of code here.

#include "FreeRTOS.h"
#include "task.h"

#define TASK1_PRIORITY ( tskIDLE_PRIORITY + 2)
#define TASK2_PRIORITY ( tskIDLE_PRIORITY + 3)
#define TASK3_PRIORITY ( tskIDLE_PRIORITY + 4)

main()
{
xTaskCreate( TASK1,"CHECK", configMINIMAL_STACK_SIZE, NULL,TASK1_PRIORITY,NULL);
xTaskCreate( TASK2,"LCD",configMINIMAL_STACK_SIZE, NULL,TASK2_PRIORITY, NULL);
xTaskCreate( TASK3,"MSG", configMINIMAL_STACK_SIZE,NULL,TASK3_PRIORITY, NULL);
vTaskStartScheduler();
for(;;)
}
static void TASK1( void *pvParameters )
{
int i=0;
for()
{
i++;
-------task code here---------------
}
}

static void TASK2( void *pvParameters )
{
int j=0;
for()
{
j++;
-------task code here---------------
}
}
static void TASK3( void *pvParameters )
{
int k=0;
for()
{
k++;
-------task code here---------------
}
}


Yes,i have configUSE_PREEMPTION set to 1 in FreeRTOSConfig.h.If i have assign the same priorities for tasks 2&3 or 1&3,scheduler points k++(task3)only.it will go to j++(task2) or i++(task1)respectively, when i suspend the 3rd task only.what will happened if a one of the task has same priority.


Regards,
saravanan.r

RE: problems on same priority tasks

Posted by Borut on March 3, 2008
Hello,

maybe it is just a typing mistake but your for() loop is missing ; - it should be for(;;){}. And also you should have a wait condition of somekind - maybe just a vTaskDelay(some_ticks); . Otherwise your highest task will not do a context switch to a task of lower priority.

regards,

Borut

RE: problems on same priority tasks

Posted by Richard on March 3, 2008
The IAR simulator is a core only simulator. This means it does not simulate the timer and therefore the tick interrupt will not be executing. Without the tick interrupt you will never switch tasks unless you use a taskYIELD() statement - I'm not sure if the yielding works in the simulator but I would guess that it did.

Regards.


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


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner