FreeRTOS 软件定时器周期设置超过2小时,会提前进入定时器回调函数
我通过官网下载的10.2.1和10.0.1版本移植在f405板子上。软件定时器设置周期为4小时,结果30分钟左右就进入定时器回调函数了。设置为1小时则时间准确。有遇到相同的问题的么?
可以这样检测下,没秒进去1次,累计30分钟的时候,看看是否有异常 好的,谢谢指点,我检测下。
我之前用过每分钟进去一次,大约也测了30分钟。没有问题。而且1小时多一点的时间内,都是准确的。超过1个半小时左右,就不准了。
eric2013 发表于 2019-6-11 11:12
可以这样检测下,没秒进去1次,累计30分钟的时候,看看是否有异常
1秒进一次,累积了30分钟了,没有问题。时间也是准的 google 发表于 2019-6-11 15:43
1秒进一次,累积了30分钟了,没有问题。时间也是准的
那就这种应用方式吧,还靠谱点。 eric2013 发表于 2019-6-12 00:14
那就这种应用方式吧,还靠谱点。
感谢,问题找到了:/* Converts a time in milliseconds to a time in ticks.This macro can be
overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
definition here is not suitable for your application. */
#ifndef pdMS_TO_TICKS
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )
#endif
这里溢出了。
https://sourceforge.net/p/freertos/bugs/135/
https://www.freertos.org/FreeRTOS_Support_Forum_Archive/February_2016/freertos_On_pdMS_TO_TICKS_macro_definition_317c7160j.html
google 发表于 2019-6-12 13:24
感谢,问题找到了:/* Converts a time in milliseconds to a time in ticks.This macro can be
overr ...
长知识了。不过冒昧的问一句,定时这么长时间,是做什么应用的呢? google 发表于 2019-6-12 13:24
感谢,问题找到了:/* Converts a time in milliseconds to a time in ticks.This macro can be
overr ...
看来FreeRTOS应该设计成几个版本,16bit~64bit就好了。使用宏定义来搞
页:
[1]