English 中文(简体)
FreeRTOS configTICK_RATE_HZ
原标题:

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.

最佳回答

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.

问题回答

暂无回答




相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签