Repository navigation
camera_streamer: map SIPL sensor timestamps to sender CLOCK_MONOTONIC and add an AVS1 timing record - #1474
Open
gareth-morgan-nv wants to merge 7 commits into
Conversation
…K_MONOTONIC A sensor timestamp that counts the platform counter's ticks is placed on CLOCK_MONOTONIC from one anchor pair (counter, CLOCK_MONOTONIC) that is refreshed on a schedule, never per frame. Every conversion is checked: a capture time after the frame was ready or implausibly long before it, a counter that cannot be read, an unknown frequency, or a clock step between anchors gives an invalid mapping with a reason; nothing is replaced by a host-side stamp. The mapping carries the anchor's bracket as its uncertainty and the anchor's age, and reset() drops the anchor when capture restarts. Unit tests inject the clock reader and cover wrong units, capture after ready, an implausible age, the refresh schedule, a deliberate clock step, reset and an unreadable counter. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…tamps CAMERA_SENDER_SIPL_TSC_PROBE=1 logs about once a second the SIPL start-of-frame and end-of-frame capture timestamps beside the platform counter, its frequency and CLOCK_MONOTONIC, so the timestamp's units and the event it marks can be established from measurements instead of assumed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
… TSC in nanoseconds The SIPL start-of-frame timestamp counts the platform counter's ticks (31.25 MHz here, measured against CNTVCT_EL0 and CLOCK_MONOTONIC on the board: it leads the counter read at dequeue by about 22 ms, and the end-of-frame value by 15 ms). SiplCapture places each frame's timestamp with SensorClockMap and, only while the check passes, reports it as a TSC in nanoseconds in the same domain as the Argus start-of-frame timestamp; a frame that fails the check carries no sensor time and the reason is logged when it changes. CaptureFrame also carries the capture time on CLOCK_MONOTONIC with its uncertainty and anchor age when mapped. SiplSender writes the TSC into the AVS1 sample and the bundle's TSC anchor (read with the wall clock) only for frames that carry one; a raw counter is never written to a nanosecond field. Source-built and cross-compiled; qualified against hardware by a run recorded separately. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…IPL sender TIMING_EXT (bundle flag 0x0008) adds one 24-byte record per sample after the sample descriptors, counted in descriptor_bytes: the sensor's capture instant on the sender's CLOCK_MONOTONIC, an uncertainty bound, the age of the mapping's anchor, a VALID flag and the clock domain. A record without VALID is all zero and makes no capture claim; the encoder and parser reject the other combinations, unknown flags and nonzero reserved fields. FrameBundleAssembler fills the records from the frame's checked capture mapping when constructed with the extension, and the SIPL sender turns it on with network.timing_extension, which is off by default because a receiver that predates the flag rejects those bundles. SensorClockMap's uncertainty now also grows by 500 ppm of the anchor's age, the bound on how far CLOCK_MONOTONIC can be slewed against the counter. WIRE_FORMAT.md documents the record with a golden byte vector that the unit test compares against. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…extension Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…ance, not the anchor's age The counter and CLOCK_MONOTONIC can drift apart by at most the slew limit over the time the mapping extrapolates from its anchor to the sensor event, in either direction. The uncertainty is now the anchor's read bracket plus 500 ppm of that distance; it was 500 ppm of how old the anchor was when the frame was handled, which is zero for a frame mapped at a fresh anchor even though the event precedes the anchor by tens of milliseconds. The anchor's age stays a separate freshness value. WIRE_FORMAT.md and the README state the new bound. The sensor clock unit tests still assert the old formula and are updated separately. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…nt distance The slew term of the mapping's uncertainty follows the distance between the anchor and the sensor event, not the anchor's age. Update the refresh-schedule and first-mapping expectations and cover a fresh anchor with an earlier event, a delayed capture, an event after the anchor, a non-default slewPpm, an event at the anchor, and the uncertainty reported for refused mappings. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
gareth-morgan-nv
requested review from
farbod-nv,
jiwenc-nv,
jsepulveda-nvidia and
tengw-nv
November 11, 2026 04:34
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 11, 2026
gareth-morgan-nv
had a problem deploying
to
dev
November 11, 2026 05:05 — with
GitHub Actions
Failure
This branch had an error being deployed
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.
Summary
Places the SIPL sensor timestamp on the sender's
CLOCK_MONOTONICwith a checked mapping and an explicit uncertainty, and carries it to receivers in an optional AVS1 timing record. Frames whose timestamp fails the checks carry no capture time; nothing is replaced by a host-side stamp. The record is off by default.What changed
SensorClockMap: pairs the platform counter withCLOCK_MONOTONIConce a second and converts each frame's counter timestamp from the difference. It refuses a capture after the frame was ready, an implausibly old one, an unreadable counter, an unknown frequency, or a step between two anchors, and it reports the reason when it changes. A mapped frame carries an uncertainty (the anchor's read bracket plus 500 ppm of the time between the anchor and the sensor event, the bound on how farCLOCK_MONOTONICcan be slewed against the counter) and the anchor's age as a separate freshness value.CAMERA_SENDER_SIPL_TSC_PROBE=1logs the raw SIPL timestamps beside the counter for repeating the measurement.0x0008): one 24-byte record per sample after the sample descriptors, with the capture instant onCLOCK_MONOTONIC, the uncertainty, the anchor age, a VALID flag and the clock domain. A record without VALID is all zero; the encoder and parser reject the other combinations, unknown flags and nonzero reserved fields; values that do not fit 32 bits are left unqualified, never wrapped.WIRE_FORMAT.mddocuments it with a golden byte vector that a unit test compares against.network.timing_extension(default false) turns the extension on. A receiver that predates it rejects those bundles, so keep it off until the receiver parses it.Validation
clang-format-14andpre-commitclean on the changed files (andpre-commit run --all-filesclean on this head).-DWITH_SIPL=ONandOFF: syntax check and full link.sensor_clock(wrong units, capture after ready, implausible age, refresh schedule, a deliberate clock step, reset, unreadable counter, and the uncertainty over the anchor-to-event distance),avs1_wire(extension round trip, rejections, golden vector),bundle_assembler(extension fill, 32-bit overflow left unqualified).CNTVCT_EL0ticks at 31.25 MHz, advances at the same rate asCLOCK_MONOTONIC(1.00368 s against 1.00369 s over 30 frames), leads the dequeue by about 22 ms, and the end-of-frame value is about 15.5 ms later.Known limitations / follow-ups
Test plan
network.timing_extension: trueinto a receiver that parses the extension and check the per-frame capture times.🤖 Generated with Claude Code