Hi,
I study ChibiOS and need some help.
When I tested tickless mode from Arduino Uno demo example, I found that prescaler value is hard-coded to 1024 (hal_st_lld.c) and tick frequency is set to 15625 (obviously F_CLK/1024). So I have a question:
- what is the basic principle on how to calculate prescaler in tickless mode if I want to set a 1000 Hz (1 ms) tick? How do we consider a hardware timer resolution in this matter? Why do we need to set tick frequency to the higher value than in the periodic tick mode?
AVR tickless mode Topic is solved
- Giovanni
- Site Admin
- Posts: 14461
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: AVR tickless mode Topic is solved
Hi,
You can have the same tick frequency in tick and tickless mode, it does not need to be different.
Giovanni
You can have the same tick frequency in tick and tickless mode, it does not need to be different.
Giovanni
Re: AVR tickless mode
We can't set tick frequency to 1000 in this case because AVR timer1 is capable of counting with frequency of clk/1024 at minimum. I could set prescaler to a lesser value (not 1024, but 256 for example, then tick frequency is 16000000/256=62500). This means that system timer would have a better precision (it ticks more frequently) but at the same time it reduces maximum possible time delay by 4 times (65536/62500=1.048 seconds).
Thank you, I think I understand now.
Thank you, I think I understand now.
Re: AVR tickless mode
The tickless implementation for the AVR port is not very flexible right now, IMO, for these reasons:
- As you mentioned, the tick resolution is not configurable since it is hardcoded in os/hal/ports/AVR/MEGA/LLD/TIMv1/hal_st_lld.c to a frequency given by F_CPU/1024
- Because of the above and a simple implementation using TIMER1, the systime_t type only works correctly when it's 16 bits, and this makes the maximum delay in a virtual timer to be about 4.2 seconds
- Since it uses TIMER1, the gpt and input capture modules cannot be used in tickless mode; also the use of pwm module with TIMER1 is precluded.
Who is online
Users browsing this forum: No registered users and 2 guests