Skip to content

Conversation

@LMESTM
Copy link
Contributor

@LMESTM LMESTM commented May 7, 2019

There is an errata in LPTIM specification that explains that CMP Flag
condition is not an exact match (COUNTER = MATCH) but rather a
comparison (COUNTER >= MATCH).

As a consequence the interrupt is firing early than expected when
programing a timestamp after the 0xFFFF wrap-around.

In order to
work-around this issue, we implement the below work-around.
In case timestamp is after the work-around, let's decide to program the
CMP value to 0xFFFF, which is the wrap-around value. There would anyway be
a wake-up at the time of wrap-around to let the OS update the system time.
When the wrap-around interrupt happen, OS will check the current time and
program again the timestamp to the proper value.

Description

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

Release Notes

There is an errata in LPTIM specification that explains that CMP Flag
condition is not an exact match (COUNTER = MATCH) but rather a
comparison (COUNTER >= MATCH).

As a consequence the interrupt is firing early than expected when
programing a timestamp after the 0xFFFF wrap-around.

In order to
work-around this issue, we implement the below work-around.
In case timestamp is after the work-around, let's decide to program the
CMP value to 0xFFFF, which is the wrap-around value. There would anyway be
a wake-up at the time of wrap-around to let the OS update the system time.
When the wrap-around interrupt happen, OS will check the current time and
program again the timestamp to the proper value.
@LMESTM
Copy link
Contributor Author

LMESTM commented May 7, 2019

Note: Test changes to cope with this workaround have been proposed in #10536

@jeromecoutant
Copy link
Collaborator

Should we update targets json file within this PR ?

  • set lpticker_lptim to 1 for NUCLEO_L073RZ ?
  • set tickless-from-us-ticker to false for LPTIM targets?

@ciarmcom ciarmcom requested a review from a team May 7, 2019 11:00
@ciarmcom
Copy link
Member

ciarmcom commented May 7, 2019

@LMESTM, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@LMESTM
Copy link
Contributor Author

LMESTM commented May 7, 2019

Should we update targets json file within this PR ?

  • set lpticker_lptim to 1 for NUCLEO_L073RZ ?
  • set tickless-from-us-ticker to false for LPTIM targets?

no - regardless of this fix, there are other ongoing investigations around lp ticker wrapper to be solved first.

@LMESTM
Copy link
Contributor Author

LMESTM commented May 29, 2019

This PR is being superseded by #10701 which includes the same commit together with extra ones
So closing this now.

@LMESTM LMESTM closed this May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants