Skip to content
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

Double Check Wrapping Behavior of Timers #1599

Closed
bjoernQ opened this issue Dec 22, 2022 · 2 comments
Closed

Double Check Wrapping Behavior of Timers #1599

bjoernQ opened this issue Dec 22, 2022 · 2 comments
Labels
package:esp-wifi Issues related to the esp-wifi package

Comments

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 22, 2022

Several functions include blocking behavior or generally deal with timers - double check them for the wrapping behavior of the timers
Also note that the timers on different targets have different bit-widths

@bugadani
Copy link
Contributor

bugadani commented Oct 31, 2023

I still wouldn't consider this issue solved, but

cc esp-rs/esp-wifi-sys#313 especially esp-rs/esp-wifi-sys@43a4cec

Speaking of the overflowing timeout checks, I'm not sure I got all places where this could pose an issue, but probably most of them. In one place we can't use the convenient elapsed_since function, because the timestamp calculation on Xtensa SoCs is not sounds if called inside a critical section (at the moment of an overflow, the cycle counter and the global overflow counter will be out of sync).

The wifi driver uses 32-bit values with varying units of measurement, which represent a range of:

Often the driver converts times into ticks then passes those ticks to esp-wifi, but not always - it's a bit of a mess. I'm not entirely confident in what time spans we can receive from the wifi stack, to be honest. It's probably fine for block times, but I'm not sure how beacon timeouts are handled, for example, and those are user configurable to some degree.

@bjoernQ bjoernQ transferred this issue from esp-rs/esp-wifi-sys May 27, 2024
@bjoernQ bjoernQ added the package:esp-wifi Issues related to the esp-wifi package label May 27, 2024
@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jul 15, 2024

We are now using esp_hal::time::current_time under the hood which should wrap earliest every 7 years (depending on the target). There is still some code to cleanup but I guess we can close this

@bjoernQ bjoernQ closed this as completed Jul 15, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:esp-wifi Issues related to the esp-wifi package
Projects
Archived in project
Development

No branches or pull requests

2 participants