From: Martin Kelly <mkelly@xevo.com>
To: Jean-Baptiste Maneyrol <JManeyrol@invensense.com>,
Jonathan Cameron <jic23@kernel.org>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: How to handle missing timestamps? (was Re: [PATCH] iio: imu: inv_mpu6050: improve missing timestamp handling)
Date: Mon, 26 Mar 2018 10:43:32 -0700 [thread overview]
Message-ID: <cc66bed2-ef59-ea75-d26d-f5ed55b55a65@xevo.com> (raw)
In-Reply-To: <7c1718f2fc324eb6b959257a80e136cdCY4PR1201MB0184E4503B2B1EEA7F24C41DC4AD0@CY4PR1201MB0184.namprd12.prod.outlook.com>
On 03/26/2018 07:20 AM, Jean-Baptiste Maneyrol wrote:
> Hello,
>
> we should have 1 interrupt every time a sensor data has been acquired. So in theory this is not something that should happen. But real world is always a different story.
>
Agreed.
> Do you have a case where you saw that happen?
>
Yes, I'm seeing this on a board I'm working with. I'm also seeing I2C
bus lockups at high frequencies, so my best guess (though speculation)
is that the interrupts are being generated by the bus is dropping some
of the messages. I'm seeing that, when the data ready interrupt fires,
there are multiple messages in the FIFO, so all but the first get filled
in with 0 timestamps. I plan to investigate why I'm getting bus lockups,
but since this is exposed a bug, I wanted to first work on improving the
resilience to such conditions.
> The best way if this happens would be to create the timestamp based on the sampling rate since we know it (last timestamp + sampling interval). That would be very similar to the real value since the only difference is the clock drift between the chip and the system.
>
That sounds reasonable. Let me make sure I understand what you're
proposing. Let's say we have set the sample rate to 10 Hz. Every time we
get an interrupt, we already take a timestamp, which should be the
correct timestamp for the most recent sample. Imagine that after an
interrupt, we see there are 4 samples in the FIFO instead of just 1. In
that case, we mark the samples with timestamps:
sample 0 (oldest timestamp): interrupt timestamp - 0.3 seconds
sample 1: interrupt timestamp - 0.2 seconds
sample 2: interrupt timestamp - 0.1 seconds
sample 3 (newest timestamp): interrupt timestamp
Does that sound right to you? If so, I will revise my patch to do it.
next prev parent reply other threads:[~2018-03-26 17:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-24 0:02 [PATCH] iio: imu: inv_mpu6050: improve missing timestamp handling Martin Kelly
2018-03-24 12:35 ` How to handle missing timestamps? (was Re: [PATCH] iio: imu: inv_mpu6050: improve missing timestamp handling) Jonathan Cameron
2018-03-26 14:17 ` Jean-Baptiste Maneyrol
[not found] ` <7c1718f2fc324eb6b959257a80e136cdCY4PR1201MB0184E4503B2B1EEA7F24C41DC4AD0@CY4PR1201MB0184.namprd12.prod.outlook.com>
2018-03-26 17:43 ` Martin Kelly [this message]
2018-03-27 8:47 ` Jean-Baptiste Maneyrol
2018-03-28 0:34 ` Martin Kelly
2018-03-28 15:13 ` Jean-Baptiste Maneyrol
2018-03-28 16:40 ` Martin Kelly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc66bed2-ef59-ea75-d26d-f5ed55b55a65@xevo.com \
--to=mkelly@xevo.com \
--cc=JManeyrol@invensense.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.