Quality RTOS & Embedded Software

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


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 ]    [ 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