Hi,

On Mon, Jun 21, 2010 at 11:03 AM, Daniele Nicolodi <[email protected]> wrote:
> 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.
>
Please, tell me where comments are lacking, I will fix that.

> 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?
>

You told you that the bug was occuring randomly and that there was no
pattern in the repetition of the bad samples. But are you sure that
the wrong samples do not occur every modulo x * 64KB ?

If the bug is located in Analogy buffer handling, it should not be
specific to a driver. So, I will try to reproduce it with the testing
drivers. I will compare the mapped and unmapped acquisition results.
If I remember well, the "fake" driver outputs some deterministic
content.  If nothing comes out, I will try to use a NI device.

Many thanks for reporting that.

> Thanks. Cheers,
> --
> Daniele
>

Alexis.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to