Thoughts triggered by some work on a 32L071, with systick 1000usec, which is fine for 99% of use.
I need to generate one-shot time intervals in the range of 100-5000usec, with a resolution of, say, 10usec. Potentially I could have several timers running in parallel (although that would be unusual). Obviously out of the range of polledDelay() function.
Essentially what it needs is to clone the virtual timer code, but running off a faster hardware timer.
Any thoughts on the practicalities of this?
(I can see the obvious - that these timers would need to be used sparingly, otherwise the overhead would become very significant)
High Speed Tickless timers?
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: High Speed Tickless timers?
Hi,
Non sure about your requirements but 10uS is a bit extreme for an M0, probably you cannot do that using virtual timers.
What you could do is to enable the unused 3 comparators in the ST driver and use those like 3 extra timers working with the same resolution of ST.
Giovanni
Non sure about your requirements but 10uS is a bit extreme for an M0, probably you cannot do that using virtual timers.
What you could do is to enable the unused 3 comparators in the ST driver and use those like 3 extra timers working with the same resolution of ST.
Giovanni
Re: High Speed Tickless timers?
I could manage with a slightly higher minimum resolution - up to about 100 usec, maybe.
Unless I've missed something, systick of 1000usec sets the minimum timing resolution - I don't want to speed up systick, and I could do with better resolution.
I can code a dedicated solution; but a generic solution would be cleaner.
Unless I've missed something, systick of 1000usec sets the minimum timing resolution - I don't want to speed up systick, and I could do with better resolution.
I can code a dedicated solution; but a generic solution would be cleaner.
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: High Speed Tickless timers?
I think 50..100uS would be viable, it depends on time spent in callbacks/ISRs.
You could have significant jitter anyway, even using an HW solution.
Giovanni
You could have significant jitter anyway, even using an HW solution.
Giovanni
Re: High Speed Tickless timers?
Had a go at this, with very satisfactory-looking results. I've settled on a 1usec resolution and minimum time of 100usec for now. Running 3 timers on a 32MHz 32L031 the jitter is 1usec - very stable. (Although that is with just a 'blinky' thread running as well).
Code attached in case anyone wants a play - its basically a mangled version of the Chibi virtual timers.
A more efficient approach would undoubtedly be to limit myself to four comparators off a fast counter (which is ample for my application), but I thought I would try the general solution first.
Code attached in case anyone wants a play - its basically a mangled version of the Chibi virtual timers.
A more efficient approach would undoubtedly be to limit myself to four comparators off a fast counter (which is ample for my application), but I thought I would try the general solution first.
- Attachments
-
- Chibi_Fast_Timers.7z
- (18.13 KiB) Downloaded 197 times
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 39 guests