anonymous wrote on Tuesday, July 20, 2010:
Hi guys,
I’m facing a problem with vTaskDelay or vTaskDelay until using 2 tasks just to blink LED’s.
The problem is when I use 1000 ticks, the led blinks every 1050 ms, and if I change to 500, every 550ms , the same occurs at 100 > 150 , so the 50ms it’s constant.
The Timer0 is config to interrupt every 1 ms, and the configs from RTOS I suppose it’s ok as above :
#define configCPU_CLOCK_HZ ( ( unsigned long ) 48000000 ) /* =12.0MHz xtal multiplied by 5 using the PLL. */
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
The mainly problems are : I can’t use anything lower then 50ms for switching, the task 1 and task 2 , supposed to blink together, has 50ms between then, and the interval of blinking has 50ms more… I supposed it’s not ok, because we use a tick of 1 ms, it’s 50x less, and there are only 2 tasks (doing nothing )
Somebody know the reason for this “delay”?
This is the source of the task’s
static void vTeste2( void *pvParameters )
{
portTickType xLastWakeTime;
xLastWakeTime = xTaskGetTickCount ();
while (1) {
vTaskDelayUntil( &xLastWakeTime, 500 );
//vTaskDelay( 5 );
FIO1PIN ^= (1 << 18);
}
}
static void vTeste3( void *pvParameters )
{
portTickType xLastWakeTime;
xLastWakeTime = xTaskGetTickCount ();
while (1) {
vTaskDelayUntil( &xLastWakeTime, 500 );
FIO1PIN ^= (1 << 24);
}
}
Best regards,
Vinicius