From: Daniele Nicolodi <daniele@domain.hid>
To: comedi_list@domain.hid
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] [comedi] NI 6251 "wrong" samples
Date: Mon, 21 Jun 2010 11:03:32 +0200 [thread overview]
Message-ID: <4C1F2AE4.6030304@domain.hid> (raw)
In-Reply-To: <4C19E5C8.8070802@domain.hid>
On 17/06/10 11:07, Daniele Nicolodi wrote:
> No. I'm running a continuous memory mapped acquisition. The only maybe
> uncommon thing I'm doing is that I'm reading the mmapped buffer in fixed
> chunks, rather than reading all the samples available each time. The
> number of samples I read each time is larger than the 4095 samples after
> which the hardware sends the FIFO half full trigger event.
I modified my code from a loop like:
unsigned int required = <compute required number of bytes>;
unsigned int read = 0;
void * buffer = a4l_mmap(dsc, ...);
while (1) {
while (read < required) {
read = a4l_pool(...);
clock_nanosleep(...);
}
process(buffer, ...);
a4l_buff_markrw(dsc, subdevice, required, ...);
}
to something like:
unsigned int required = <compute required number of bytes>;
unsigned int read = 0;
void *buffer = malloc(required);
while (1) {
while (read < required) {
a4l_sys_read(dsc, buffer + read, required - read);
}
process(buffer, ...);
}
I tested this setup over the weekend and the wrong samples went away!
Therefore i suspect that the problem is not related to FIFO
synchronization but to kernel space buffer handling.
I have tried to look at Analogy buffer handling, but the lack of any
comment in the source code makes understanding how it is supposed to
work a complex task.
Alexis, can you see any case where there may be a synchronization issue
like the one I'm seeing in your code? Any suggestion in where to look
for the bug?
Thanks. Cheers,
--
Daniele
next prev parent reply other threads:[~2010-06-21 9:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 17:49 [Xenomai-help] NI 6251 "wrong" samples Daniele Nicolodi
[not found] ` <4C0CEC7E.6080408@domain.hid>
[not found] ` <4C0CF99F.1090700@domain.hid>
2010-06-17 9:07 ` [Xenomai-help] [comedi] " Daniele Nicolodi
2010-06-21 9:03 ` Daniele Nicolodi [this message]
2010-06-21 11:59 ` Alexis Berlemont
2010-06-21 18:14 ` Daniele Nicolodi
2010-06-21 22:52 ` Alexis Berlemont
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=4C1F2AE4.6030304@domain.hid \
--to=daniele@domain.hid \
--cc=comedi_list@domain.hid \
--cc=xenomai@xenomai.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.