tags:

views:

331

answers:

2

Hi,

I am using an MSP430f5438 with version 5.4 of FreeRTOS.

I am having a funny problem that I can't figure out.

Basically, when I set configTICK_RATE_HZ to different values, the LED blinks faster or slower; it should stay the same rate. It blinks slower the higher i set configTICK_RATE_HZ, and faster when I set TICK_RATE lower.

vTaskDelayUntil( &xLastFlashTime, xFlashRate ); is such that the LED should only blink once a second no matter what the configTICK_RATE_HZ is. I stepped through and checked the xFlashRate to make sure. Its always = to the configTICK_RATE_HZ. Code:

xFlashRate = ledFLASH_RATE_BASE;//my flash base rate is 1000ms
xFlashRate /= portTICK_RATE_MS; //so xFlashrate = whatever configTICK_RATE_HZ equals

/* We need to initialise xLastFlashTime prior to the first call to vTaskDelayUntil().*/ 
xLastFlashTime = xTaskGetTickCount();
for(;;) { 
vTaskDelayUntil( &xLastFlashTime, xFlashRate ); vParTestToggleLED( uxLED ); 
flashled();//this should happen every 1 second.
}

The led blink with a period greater than 1 second when i set the configtick_rate_hz to 1000 and the led blinks with a period far less than 1s when i set the tick rate to anything less than ~200

configTICK_RATE_HZ should not affect the LED blinktime!!!!!!!

I realize more info is needed and will readily supply whatever code snippets are needed to help!!!!!!

Thanks,

Mike.

+2  A: 

The RTOS tick is generated by a Timer interrupt. The timer was set (improperly) such that it always caused a fixed tick at 400kHz no matter what you set configTICK_RATE_HZ too. Since the blink rate is set under the assumption that the RTOS tick rate is properly represented by the configTICK_RATE_HZ (portTICK_RATE_MS = 1000/configTICK_RATE_HZ), problems ensued.

michael
A: 

Why not ask on the free to use FreeRTOS support forum?

Richard Barry
I actually did! I just like to ask here too. Stack Overflow's embedded community is a lot smaller than its .net/php/sql community, but the interface is really nice for browsing questions and answers. I find the sourceforge forum system to be kinda clunky and hard to navigate.
michael