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




Loading

Tasks stop running

Posted by phil on November 29, 2007
Hi All,

I have had a system running successfully with several task running with the *pvParameters set to Null, as I did not need to pass in any variables.

I am upgrading the code so that I can check if the tasks are still running by incrementing a counter passed into the task 'usTaskCheck[ 1 ]' (I have used the examples given in the demo app's)

The problem I have is I configure the code as shown below and for some reason all the other tasks in the system stop running. The vComTxTask1 still runs as configured.

Any ideas or help would be appreciated,

Thanks,

Phil


xTaskCreate( vComTxTask1, ( const signed portCHAR * const ) "COMTx", comSTACK_SIZE, ( void * ) &( usTaskCheck[ 1 ] ), RabbitPortSettings.uxSerPortPriority, ( xTaskHandle * ) NULL );


static void vComTxTask1( void *pvParameters )
{
portTickType xRabbitTxTickPeriod = RABBIT_TX_TICK_PERIOD;
portTickType xRabbitTxTickTime;

volatile unsigned portSHORT *pusTaskCheckVariable;

pusTaskCheckVariable = ( unsigned portSHORT * ) pvParameters;

for( ;; )
{

vTaskDelayUntil( &xRabbitTxTickTime, xRabbitTxTickPeriod );
vRabbitTxMessageSM();

( *pusTaskCheckVariable )++; //Tick the task counter



}//end of for


}

RE: Tasks stop running

Posted by Richard on November 29, 2007
There is nothing obviously wrong with your code, but I I'm not sure which port you are using. Is it running on a Rabbit Semiconductors processor? If so where did you get the port from, and if not, which processor are you using it on. Also which compiler are you using?

Regards.

RE: Tasks stop running

Posted by phil on November 30, 2007
Hi Richard,

I am using the ARM STR712 controller to communicate with a Rabbit processor. I am using the IAR development tools and compiler and currently version V4.2.1 of FreeRTOS.

Below is the original way I had written the task function. Most of my task function have been written using the portTASK_FUNCTION definition. When I hit on this problem I tried defining the function as 'static void vComTxTask( void *pvParameters )' would this cause the problem.

I find it a bit strange that the vComTxTask function runs correct but any other task in my system stops running. If I configure the code as below the system tasks start running again.

I can confirm that the other tasks in my system are been initialized correct. I have another task running in the same class as the function below 'vComRxTask' and this runs correct. So all tasks are running correct in the class I defined the pvParameters in, outside of this they don't get called?

Regards,

Phil


xTaskCreate( vComTxTask, ( const signed portCHAR * const ) "COMTx", comSTACK_SIZE, NULL , RabbitPortSettings.uxSerPortPriority+1, ( xTaskHandle * ) NULL );


static portTASK_FUNCTION( vComTxTask, pvParameters )
{
portTickType xRabbitTxTickPeriod = RABBIT_TX_TICK_PERIOD;
portTickType xRabbitTxTickTime;

/* Just to stop compiler warnings. */
( void ) pvParameters;

for( ;; )
{
vTaskDelayUntil( &xRabbitTxTickTime, xRabbitTxTickPeriod );
vRabbitTxMessageSM();

}//end of for

}//endoffunction

RE: Tasks stop running

Posted by Richard on November 30, 2007
Curious. Is the COM task the highest priority task? If so, it not blocking for some reason could cause the other tasks to be starved out.

Have you tried commenting out the line:
( *pusTaskCheckVariable )++; //Tick the task counter

just in case the pointer value is invalid, and writing to it is causing some corruption.

Regards.

RE: Tasks stop running

Posted by phil on December 2, 2007
Hi,

I had tried commenting out the ( *pusTaskCheckVariable )++; and had determined that this was not the problem.

I took a look at the task priority's and the tasks that had not been running where lower than the one's that are running such as the 'vComTxTask1' tasks. I made all the tasks that had not been running correct equal to the 'vComTxTask1' priority (set to 2) and they started running correct.

I still have some higher priority tasks running in the system that don't seem to effect the running of the lower tasks.

I am curious to why when I start using the pvParameters I started to get the problems with tasks not running. Is it because it takes a bit more system time when using the pvParameters.

I would be interested in any techniques used to monitor the amount of resource/time each task is using and if it will cause a problem hogging the systems resources. In the past with a simpler (home made) OS I have often toggled some IO pins and measured the time each task is using to get a feel of what is happening in the system, unfortunately I don't have the luxury of a scope at the moment. Any hints and tips on setting up priority's would be useful.

Thanks for the support,

Phil



RE: Tasks stop running and Co-Routines

Posted by phil on December 3, 2007
Hi,

I fixed the problems with the tasks stopping running, this has now caused the co-routine to stop running, I have tried changing the priority level for the co-routine this has had no effect. If I don't use the pvParameters and make this equal to null when I configure the tasks they co-routine runs as expected.

Thanks,

Phil


[ 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