-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Fix esp32 timer issues #2697
Merged
Merged
Fix esp32 timer issues #2697
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Without setting update bit counter value won't change. Probably worked previously because some other code did this.
e.g. ``` String s; s += timer; ``` Doesn't behave as expected and instead constructs new instance then calls destructor on it. Manifests by hanging HostTests on esp32 (standard, s2 and c3 variants) but curiously not on esp8266 or host.
@slaff Some of the what-the-diff comments are pretty unhelpful so I tend to delete them. (Others are surprisingingly accurate, though!) |
slaff
added
3.5 - Approved - Waiting for CI results
and removed
3.5 - Approved - Waiting for CI results
labels
Jan 8, 2024
mikee47
pushed a commit
to mikee47/Sming
that referenced
this pull request
Jan 31, 2024
IDF version 5 changed some low-level HAL calls to accept bit masks instead of timer index. This is the root cause of the WDT allegedly fixewd in SmingHub#2697. However, all we did there was disable interrupts and callback timers never actually worked.
mikee47
pushed a commit
to mikee47/Sming
that referenced
this pull request
Jan 31, 2024
PR SmingHub#2697 was supposed to fix the WDT from hardware timer interrupts. It did this by disabling interrupts (and therefore callbacks) completely. The actual reason for the WDT is twofold: 1. IDF version 5 changed some low-level HAL calls to accept bit masks instead of timer index. 2. Argument to interrupt callback wasn't stored or passed correctly so user-provided callback got junk for this parameter.
slaff
pushed a commit
that referenced
this pull request
Jan 31, 2024
Fix esp32 hardware timer callbacks PR #2697 was supposed to fix the WDT from hardware timer interrupts. It did this by disabling interrupts (and therefore callbacks) completely. The actual reason for the WDT is twofold: 1. IDF version 5 changed some low-level HAL calls to accept bit masks instead of timer index. 2. Argument to interrupt callback wasn't stored or passed correctly so user-provided callback got junk for this parameter. This PR fixes those issues and fixes incomplete testing in HostTests. Also checked Basic_Blink sample using HardwareTimer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HostTests fails on esp32 due to following issues:
Flawed
hw_timer2_read()
implementationWithout setting update bit counter value won't change. Probably worked previously because some other code did this.
WDT with callback timers
Checked against IDF implementations and there's a missing flag which keeps interrupts initially disabled during setup.
Callbacks missing during timer testing
Offending code looks like this:
The above line actually calls the
Timer
copy constructor. Delete this and the compiler catches the error. The corrected line now readss += String(timer)
.HostTests needs more program space for ESP32
Builds are getting chunky!