Skip to content

Conversation

@bugadani
Copy link
Contributor

@bugadani bugadani commented Aug 16, 2023

Thank you!

Thank you for your contribution.
Please make sure that your submission includes the following:

Must

  • The code compiles without errors or warnings.
  • All examples work.
  • cargo fmt was run.
  • Your changes were added to the CHANGELOG.md in the proper section.

Nice to have

  • You add a description of your work to this PR.
  • You added proper docs for your newly added features and code.

When multiple executors are used, each allocates a different alarm. Previously, a single TIMG-based alarm was supported, and since #609 this restriction has been lifted. However, that PR was incomplete: even though multiple alarms could be allocated, actually setting an alarm always configured timer 0 of TIMG0. This issue can lead to problems when multiple executors are started.

@bugadani bugadani mentioned this pull request Aug 16, 2023
13 tasks
@bugadani bugadani force-pushed the timer branch 7 times, most recently from 298cc8c to dc1ffdc Compare August 16, 2023 06:45
@bugadani
Copy link
Contributor Author

I was considering flipping the order of operations in set_alarm to align with the embassy-rp implementation. But hopefully a few clock cycles' worth of difference won't be meaningful. It is an interesting question, however, what happens if we load the current timestamp as the alarm value, which is technically possible to happen.

@bugadani bugadani marked this pull request as ready for review August 16, 2023 06:50
@MabezDev
Copy link
Member

I was considering flipping the order of operations in set_alarm to align with the embassy-rp implementation. But hopefully a few clock cycles' worth of difference won't be meaningful. It is an interesting question, however, what happens if we load the current timestamp as the alarm value, which is technically possible to happen.

Should be okay because arm is being called in a critical section.

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MabezDev MabezDev merged commit eb8acaf into esp-rs:main Aug 16, 2023
@bugadani
Copy link
Contributor Author

Should be okay because arm is being called in a critical section.

Still, the timer ticks and if it goes beyond the alarm value... :)

@bugadani bugadani deleted the timer branch August 16, 2023 11:55
bugadani added a commit to bugadani/esp-hal that referenced this pull request Aug 20, 2023
bugadani added a commit to bugadani/esp-hal that referenced this pull request Aug 20, 2023
playfulFence pushed a commit to playfulFence/esp-hal that referenced this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants