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

Reading Timestamp should reference a cached offset #27

Open
Poofjunior opened this issue Mar 14, 2024 · 0 comments
Open

Reading Timestamp should reference a cached offset #27

Poofjunior opened this issue Mar 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Poofjunior
Copy link
Collaborator

Poofjunior commented Mar 14, 2024

There is a race condition where it is possible for the reported Timestamp seconds and microseconds to reference a different offset and therefore report an erroneous value. This happens if the timestamp offset is updated via interrupt while the timestamp is being added into the reply message.

The fix would be to make sure we reference the same offset when we retrieve the time and compute it to update the timestamp registers and then read them. It really just boils down to making sure that the local offset value (offset_us_64_) is either a monotonic read or read from a double-buffer.
https://github.com/AllenNeuralDynamics/harp.core.rp2040/blob/main/firmware/inc/harp_core.h#L351

@Poofjunior Poofjunior added the bug Something isn't working label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant