-
Notifications
You must be signed in to change notification settings - Fork 178
Add synchronization delay section in lp ticker #491
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
Conversation
Add a section with information about low power ticker synchronization and using LOWPOWERTIMER_DELAY_TICKS to address this problem.
ARMmbed/mbed-os#6536 should be merged before this is |
|
||
Some low power tickers require multiple low power clock cycles for the compare value set by `ticker_set_interrupt` to take effect. Further complicating this issue, a new compare value typically cannot be set until the first has taken effect. Because of this when back to back calls to `ticker_set_interrupt` are made without a delay the second call will block and violate the above requirement that `ticker_set_interrupt` completes in 20us. | ||
|
||
To meet this timing requirement targets which have this synchronization delay must define `LOWPOWERTIMER_DELAY_TICKS` to the number of low power clock cycles it takes for call to `ticker_set_interrupt` to take effect. When this value is set the timer code will prevent `lp_ticker_set_interrupt` from being called twice within that number of clock cycles. It does this by using the microsecond time to schedule the write to happen at a future date. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi
I think LOWPOWERTIMER_DELAY_TICKS will become LPTICKER_DELAY_TICKS when feature branch will be merged ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appart from Jerome's comment that needs answer, this looks good top me ! thx
Complete initial copy edit, mostly for active voice, consistent tense and precise language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c1728p9 Nice work on this 👍 I've left a few queries for you to address.
@@ -36,6 +36,12 @@ Be careful around these common trouble areas when implementing this API: | |||
- The ticker keeps counting when it rolls over | |||
- The ticker interrupt fires when the compare value is set to 0 and and overflow occurs | |||
|
|||
#### Handling synchronization delay | |||
|
|||
Some low power tickers require multiple low power clock cycles for the compare value that `ticker_set_interrupt` sets to take effect. Further complicating this issue, a new compare value typically cannot be set until the first has taken effect. Because of this, when you make back-to-back calls to `ticker_set_interrupt` without a delay, the second call blocks and violates the above requirement that `ticker_set_interrupt` completes in 20us. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query: Who or what typically sets a new compare value?
|
||
Some low power tickers require multiple low power clock cycles for the compare value that `ticker_set_interrupt` sets to take effect. Further complicating this issue, a new compare value typically cannot be set until the first has taken effect. Because of this, when you make back-to-back calls to `ticker_set_interrupt` without a delay, the second call blocks and violates the above requirement that `ticker_set_interrupt` completes in 20us. | ||
|
||
To meet this timing requirement, targets that have this synchronization delay must define `LOWPOWERTIMER_DELAY_TICKS` to the number of low power clock cycles it takes for a call to `ticker_set_interrupt` to take effect. When this value is set, the timer code prevents `lp_ticker_set_interrupt` from being called twice within that number of clock cycles. It does this by using the microsecond time to schedule the write to happen at a future date. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query: Is this saying that targets define LOWPOWERTIMER_DELAY_TICKS
as the number of low power clock cycles required for a call to ticker_set_interrupt
to take effect? Also, in the next sentence, does "this value" refer to that same number of low power clock cycles? If so, do the targets set that value, or do you, the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes from in-person discussion:
- Change "define" to "set"
- Yes
- Targets
Fix confusing phrasing with in-person answers in response to edit queries.
Make changes from #491 to live site after reviewing on test site.
|
||
Some low power tickers require multiple low power clock cycles for the compare value that `ticker_set_interrupt` sets to take effect. Further complicating this issue, a new compare value typically cannot be set until the first has taken effect. Because of this, when you make back-to-back calls to `ticker_set_interrupt` without a delay, the second call blocks and violates the above requirement that `ticker_set_interrupt` completes in 20us. | ||
|
||
To meet this timing requirement, targets that have this synchronization delay must set `LOWPOWERTIMER_DELAY_TICKS` to the number of low power clock cycles it takes for a call to `ticker_set_interrupt` to take effect. When the targets set this value, the timer code prevents `lp_ticker_set_interrupt` from being called twice within that number of clock cycles. It does this by using the microsecond time to schedule the write to happen at a future date. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi
So LOWPOWERTIMER_DELAY_TICKS will not be renamed as LPTICKER_DELAY_TICKS ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jeromecoutant sorry for not responding earlier. I'm not sure when the feature branch is going to be merged to master, so I left this with the name on master. Once the feature branch is merged to master I'll update this for the new name.
Add a section with information about low power ticker synchronization and using LOWPOWERTIMER_DELAY_TICKS to address this problem.