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

task timing issue with freertos on 9s08

Posted by Lav Thyagarajan on November 17, 2009
Hello, I have just started using freertos on a 9S08(GT60) using CW 6.2.

This is what I have:

3 tasks + 1 idle task.

Task1 : blocks for 100 ms using Vdelayuntil(). priority( idle+1)

Taks2: blocks for 50 ms using Vdelayuntil(). priority(idle+2)

Task3: blocks for a binary semaphore. priority(idle+3)

The semaphore is given by an interrupt generated by ( tim1 channel 1) every 100 ms. The interrupt rate is 10ms, and the TICKS_TO_WAIT is set to 10.

The RTOS tick is set at 1ms using tim1 channel 0 .



The problem:

When I have all three tasks running, the tasks are NOT running at their specified repeat rates. ( its all over the place).I am toggling an output pin in each of the tasks to determine the timing.

If I remove task2, then task1 and task3 run at the specified repeat rates.



Will appreciate any help/hints to this problem.





Thanks!!

Lav







// ------------------------------------------//

code snippets below

//---------------------------------//



*******************************************************************************
*
*
*
*******************************************************************************
*/
static void vTaskone( void *pvParameters )
{
// pvParameters = pvParameters;
portTickType xLastWakeTime;
const portTickType xFrequency = 100;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for( ;; )
{
//#if !defined(_FCS_)
// Wait for the next cycle.
vTaskDelayUntil( &xLastWakeTime, xFrequency );
PTDD_PTDD4 = ~PTDD_PTDD4;
//#endif
// vTaskDelay(500);
}
}


/*
*******************************************************************************
*
*
*
*******************************************************************************
*/
void vTaskTwo ( void *pvParameters )
{
// pvParameters = pvParameters;
portTickType xLastWakeTime;
const portTickType xFrequency = 50;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for (;:smileywink:
{
//#if !defined(_FCS_)
vTaskDelayUntil( &xLastWakeTime, xFrequency );
//PTDD_PTDD3 = ~PTDD_PTDD3;
//#endif
// vTaskDelay(250);
}
}

*******************************************************************************
*
*
*
*******************************************************************************
*/
void vTaskThree ( void *pvParameters )
{
// pvParameters = pvParameters;
/* We are using the semaphore for synchronisation so we create a binary
semaphore rather than a mutex. We must make sure that the interrupt
does not attempt to use the semaphore before it is created! */
vSemaphoreCreateBinary(tsk3_semphr);
for (;:smileywink:
{

/* We want this task to run every 30 ticks of a 10 ms timer. The semaphore
was created before this task was started.

Block waiting for the semaphore to become available. */
if( xSemaphoreTake( tsk3_semphr, LONG_TIME ) == pdTRUE )
{
PTDD_PTDD3 = ~PTDD_PTDD3;
}
}
}

*******************************************************************************
*
*
*
*******************************************************************************
*/

if (xTaskCreate( vTaskone, (const signed char *)"MyTaskone", configMINIMAL_STACK_SIZE , NULL, ( tskIDLE_PRIORITY + 1 ), NULL ) == pdFAIL)
{
for (;:smileywink: __asm ("nop");
}

if (xTaskCreate( vTaskTwo, (const signed char *)"MyTaskTwo", configMINIMAL_STACK_SIZE, NULL, ( tskIDLE_PRIORITY + 2 ), NULL ) == pdFAIL)
{
for (;:smileywink: __asm ("nop");
}

if (xTaskCreate( vTaskThree, (const signed char *)"MyTaskThree", configMINIMAL_STACK_SIZE, NULL, ( tskIDLE_PRIORITY + 3 ), NULL ) == pdFAIL)
{
for (;:smileywink: __asm ("nop");

}

RE: task timing issue with freertos on 9s08

Posted by Dave on November 20, 2009
There is no official 9S08 port so people are not going to be able to help you with the port itself, which may not be working correctly. If you can repost your code with a tab in front of every line then the forum will display it in a readable way and you may get some suggestions about the task implementation.


[ 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