-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Free running timer #253
base: main
Are you sure you want to change the base?
Free running timer #253
Conversation
Add initial version of changes needed to allow the timer to optionally be free running. This commit changes how the prescaler and timer counts. Instead of down from a set value, they count from zero and up to a set value. Signed-off-by: Joachim Strömbergson <[email protected]>
Add support in the Timer API to enable the free runing mode. Signed-off-by: Joachim Strömbergson <[email protected]>
Fix so that the timer counts the correct number of cycles (again). Make testbench self-testing. Signed-off-by: Joachim Strömbergson <[email protected]>
Change names of states and remove redundant state. Fix comments and printout to clarify. Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
Reset the free_running_reg to reset Make test1 self checking. Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
Added note that prescaler and timer shoild be set to nonzero values. Added note that prescaler and timer can't be changed when the timer is running. Changed reset values for timer and prescalet to one. Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
Add testcase that verifies that using timer with prescaler works in free running mode. Signed-off-by: Joachim Strömbergson <[email protected]>
Change timer from counting to a specified value and stopping or free running, to always be free running. But now the timer sets a reached flag when the target number of ticks has been reached. Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
Needs careful thought since this is a breaking change. What are apps supposed to do if they want to support both existing TKeys with the old timer and this timer? Implement both and somehow test what TKey they are running on? Old apps with no such check will be very confused, of course. Might be worth it to at least do some experiments on new external code we want to use if we can somehow mimic the behaviour of an increasing timer with software wrapping functions of the old timer. |
Description
This PR implements a change to the existing timer to add a free running mode. This is currently an initial version. The testbenches has not been updated with tests of the new mode. But it builds and allow us to measure the amount of resources the changes cause.
Note that this PR breaks the behavior of the timer. Previously both the timer and the prescaler would count down from a set value. The PR changes this so that now the timer and prescaler starts at zero and counts up to the set values. Applications that look at the timer current_value will probably be confused. Applications that just sets the timer and wait for it to complete (stop running) will not be affected.
Fixes #252
Type of change
Please tick any that are relevant to this PR and remove any that aren't.
Submission checklist