FreeRTOS的configTICK_RATE_HZ [英] FreeRTOS configTICK_RATE_HZ

查看:2716
本文介绍了FreeRTOS的configTICK_RATE_HZ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用与FreeRTOS操作系统的5.4版的MSP430F5438。

I am using an MSP430f5438 with version 5.4 of FreeRTOS.

我有,我不能想出一个有趣的问题。

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

基本上,当我设置configTICK_RATE_HZ为不同的值,则LED闪烁更快或更慢;它应该保持相同的速率。它闪烁速度较慢我设置configTICK_RATE_HZ和更快当我设置TICK_RATE低。高

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);是这样的LED应只闪烁一次的第二无论configTICK_RATE_HZ是什么。我踩通过,并检查了xFlashRate确保。它总是=到configTICK_RATE_HZ。
code:

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.
}

LED的闪烁具有周期长,超过1秒钟时,我的configtick_rate_hz设置为1000,发光二极管闪烁一个周期远远小于1秒,当我设置的节拍率成为任何超过〜200

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不应影响LED blinktime

configTICK_RATE_HZ should not affect the LED blinktime.

我认识更多的是需要信息,并很容易提供所需的任何code片段,以帮助。

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

推荐答案

是由定时器中断产生的RTOS打勾。计时器设置(不当),使得它总是在导致400kHz的固定刻度不管你设置configTICK_RATE_HZ了。由于眨眼率的假设下设置的RTOS节拍率是正常重新由configTICK_RATE_HZ(portTICK_RATE_MS = 1000 / configTICK_RATE_HZ)psented $ P $,问题接踵而至。

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.

这篇关于FreeRTOS的configTICK_RATE_HZ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆