fix timestamps on received packets - #3
Open
esaulenka wants to merge 1 commit into
Open
Conversation
smartgauges
reviewed
Feb 14, 2026
|
|
||
| volatile tick_t tick = { 0, 0, 0, 0, 0, 0 }; | ||
| volatile uint32_t usecs = 0; | ||
| static volatile uint32_t usecs = 1000; |
Owner
There was a problem hiding this comment.
this monotonic counter in microseconds increases by 1000 every 1 ms, must be initialized to 0
|
|
||
| value += (1000 * v) / systick_get_reload(); | ||
| // sysick counts DOWN! | ||
| value -= (1000 * v) / systick_get_reload(); |
Owner
There was a problem hiding this comment.
it makes more sense to add a fraction of a millisecond, how do you think?
value += (1000 * (systick_get_reload() - v)) / systick_get_reload();
This file contains hidden or 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
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.
Systick - странная штука, внутренний счётчик там считает вниз, от reload value до нуля.
Соответственно, при использовании этого счётчика надо менять его знак.
Проверил на 100% загруженной 500k шине, теперь пакеты имеют корректные таймштампы с разницей 230..250 микросекунд.
Проблема с изменением порядка по-прежнему есть, разбираюсь...