Hi, Team:
In vi5_fops.c, I modifyed line 422 like this:
/* Read SOF from capture descriptor */
ts = ns_to_timespec((s64)descr->status.sof_timestamp);
get_monotonic_boottime(&tsa);
printk("sec: %ld,nsec: %ld\n camerta sec: %ld,nsec: %ld\n", tsa.tv_sec, tsa.tv_nsec, ts.tv_sec, ts.tv_nsec);
And then ts is 6 seconds longer than tsa. And i checked the cboot booting time in serial console just 6s,
So how can we make the timestamp synchronization?
Help.guys.it’s important for sensor fusion!
hello xuhui1.wang,
may I know which JetPack release you’re working with.
BTW, please also refer to similar discussion thread, such as Topic 1058122, and Topic 1056202 for reference.
thanks
Hi,JerryChang,
I am using jetpack42.2.2.So we need use the delta time right,/sys/devices/system/clocksource/clocksource0/offset_ns .
thanks
hello xuhui1.wang,
please refer to below to demonstrate how to check the timestamp.
offset_ns is used to calculate the capture timestamp from system time.
you might also check below example for offset_ns to compensate the capture timestamp.
root@tegra-ubuntu:~# cat /sys/devices/system/clocksource/clocksource0/offset_ns
9045955168
to add debug prints to gather kernel time.
diff --git a/drivers/media/platform/tegra/camera/vi/vi5_fops.c b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
index f8c0df5..6a7c370 100644
--- a/drivers/media/platform/tegra/camera/vi/vi5_fops.c
+++ b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
@@ -427,6 +427,9 @@ static void vi5_capture_dequeue(struct tegra_channel *chan,
/* Read SOF from capture descriptor */
ts = ns_to_timespec((s64)descr->status.sof_timestamp);
...
+ pr_err("Jerry %s timestamp= %ld.%ld Line(%d)\n", __func__, ts.tv_sec, ts.tv_nsec, __LINE__);
you’ll see kernel log as following
[ 128.924693] Jerry vi5_capture_dequeue timestamp= 137.483546848
which means, you’ll need to compensate the timestamp as below, it should be pretty close.
128.924693 + 9045955168(ns) ~= 137.483546848