Will the tickless mode in Chibios 3.0 enable virtual timers and delays/etc with 1usec resolution?
Like configuring CH_CFG_ST_FREQUENCY to 1000000 ?
I have a STM32F4-project where i want to schedule events with down to 1-2usec resolution.
It could be done with hardware timers, OutputCompare and some sort of minheap Sorting scheduler, but it would be really nice if one could do it directly in chibios.
Any other suggestions on how to schedule events with high resolution?
Thanks
Erik
High resolution event scheduling in tickless-mode?
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: High resolution event scheduling in tickless-mode?
Hi,
You should not go with such low values, there are limits. On the F4 a safe resolution should be 10-20uS, higher resolutions are being investigated.
Note that even with a 1uS resolution you would get a very high jitter with such low values.
If you need accurate timings you have to use an HW timer AND have it generate a fast interrupt in order to reduce jitter.
Giovanni
You should not go with such low values, there are limits. On the F4 a safe resolution should be 10-20uS, higher resolutions are being investigated.
Note that even with a 1uS resolution you would get a very high jitter with such low values.
If you need accurate timings you have to use an HW timer AND have it generate a fast interrupt in order to reduce jitter.
Giovanni
Re: High resolution event scheduling in tickless-mode?
Hi and thanks for the super-quick reply!
Is this a proper way to deal with something like this?
I´ll also have to check how close together two events can be scheduled without the next one getting dropped.

Thanks again!
Is this a proper way to deal with something like this?
I´ll also have to check how close together two events can be scheduled without the next one getting dropped.

Thanks again!
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: High resolution event scheduling in tickless-mode?
Keep in mind that you cannot invoke kernel APIs from a fast IRQ handler, you would need your own events handling (basically a mask of flags).
You can use PENDSV in order to delegate to a lower priority ISR calls to the kernel.
You could use"cpsie i" and "cpsid i" can be used for mutual exclusion between the low priority and high priority worlds (keep it short of course, that code is your jitter).
Giovanni
You can use PENDSV in order to delegate to a lower priority ISR calls to the kernel.
You could use"cpsie i" and "cpsid i" can be used for mutual exclusion between the low priority and high priority worlds (keep it short of course, that code is your jitter).
Giovanni
Re: High resolution event scheduling in tickless-mode?
Erik, did you end up implementing any kind of minheap Sorting scheduler?
First of all, I wonder if there is a non-head tree implementation one can use for that. I am playing with http://troydhanson.github.io/uthash/utlist.html but that's O(n^2) for iteration with removal, so that would only work for really small n.
First of all, I wonder if there is a non-head tree implementation one can use for that. I am playing with http://troydhanson.github.io/uthash/utlist.html but that's O(n^2) for iteration with removal, so that would only work for really small n.