a small question about the tickless mode....
Does CH_CFG_ST_FREQUENCY have an impact on performance of the system in tickless mode?
In traditional mode increasing CH_CFG_ST_FREQUENCY will increase the number of system interrupts per second. In tickless mode if CH_CFG_ST_FREQUENCY is increased, the system time resolution is better but... does it have any drawbacks? Any reason why a lower CH_CFG_ST_FREQUENCY might be better?
Thanks!
Tickless mode implementation
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Tickless mode implementation
Hi,
The drawback is that an higher resolution allows for a shorter time before the time counter wraps back. In case you have a lot of activity with virtual timers you may need to increase the delta parameter in chconf.h. On an F4 I tested up to 4MhZ, probably it could also be increased. 1MhZ is a nice round number to use.
Note that running with too high frequencies does not make sense because the system jitter would become predominant, you would not gain accuracy.
Giovanni
The drawback is that an higher resolution allows for a shorter time before the time counter wraps back. In case you have a lot of activity with virtual timers you may need to increase the delta parameter in chconf.h. On an F4 I tested up to 4MhZ, probably it could also be increased. 1MhZ is a nice round number to use.
Note that running with too high frequencies does not make sense because the system jitter would become predominant, you would not gain accuracy.
Giovanni
Re: Tickless mode implementation
Ok, thanks!
On a STM32F1 (16 bit timer) using CH_CFG_ST_FREQUENCY 10000 the timer will wrap about every 6.5 seconds, isn't it?
What happens then? I mean...do the virtual timer account for wrapping?
And.. in the same configuration, using the code form the wiki:
--
systime_t time = chTimeNow(); // T0
while (TRUE) {
time += MS2ST(1000); // Next deadline
do_something();
chThdSleepUntil(time);
}
--
would run into porblems after 6.5 seconds, right?
Any suggestion on how to do this reliably for long time with a f1?
On a STM32F1 (16 bit timer) using CH_CFG_ST_FREQUENCY 10000 the timer will wrap about every 6.5 seconds, isn't it?
What happens then? I mean...do the virtual timer account for wrapping?
And.. in the same configuration, using the code form the wiki:
--
systime_t time = chTimeNow(); // T0
while (TRUE) {
time += MS2ST(1000); // Next deadline
do_something();
chThdSleepUntil(time);
}
--
would run into porblems after 6.5 seconds, right?
Any suggestion on how to do this reliably for long time with a f1?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Tickless mode implementation
Absolutely not, the counter is MEANT to wrap, it just means that the largest delay you can specify is 6.5 seconds. An OS that stops working after a finite time would not be nice.
Giovanni
Giovanni
Re: Tickless mode implementation
OK, thanks! I figured it out myself as I had a look at the code...
Sorry for the question
Sorry for the question
Re: Tickless mode implementation
Hi.
Is it possible to implement tickless mode on Timer with DOWN COUNT mode?
Is there any reason why used UP COUNTING mode?
Is it possible to implement tickless mode on Timer with DOWN COUNT mode?
Is there any reason why used UP COUNTING mode?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Tickless mode implementation
The counter is used as system time and time is assumed to increase. You may simulate an up-counting counter in the ST driver, of course there is a small overhead.
Giovanni
Giovanni
Re: Tickless mode implementation
Thanks - good idea.
I am porting Chibi on EFM32 and want to use Low Energy timer as system because it works in deep sleep mode. Bu it is support only down counting mode. I will try simulate up counter.
I am porting Chibi on EFM32 and want to use Low Energy timer as system because it works in deep sleep mode. Bu it is support only down counting mode. I will try simulate up counter.