linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problems with using IIO buffers
@ 2016-12-20 10:18 Matthias Klumpp
  2016-12-20 10:46 ` Peter Meerwald-Stadler
  0 siblings, 1 reply; 9+ messages in thread
From: Matthias Klumpp @ 2016-12-20 10:18 UTC (permalink / raw)
  To: linux-iio

Hello!
I am having troubles getting buffers to work with IIO. Querying raw
data from devices works well via sysfs, but buffered input from ADCs
does not work.

I am writing a driver for the MAX1133 ADC chip, and the poll function
to gather data is never called, while it is correctly registered using
the iio_triggered_buffer_setup() function.
Querying the device with iio_readdev fails with a timeout.

Furthermore when using the iio_dummy driver with iio_readdev from the
libiio utils, I get the exact same result: "Unable to refill buffer:
Connection timed out".

Do you maybe have any pointers for me on what to try next to make this
work? So far, all my attempts at adressing this issue yielded no
results. The Linux kernel is rather standard, but compiled with the
RT_PREEMPT patches (but I also verified that this issue exists with a
non-RT kernel as well).

Linux is at 4.8.14 on armhf, and this issue also exists with Linux 4.4.

Since I never touched IIO before, I would be very happy about getting
some pointers on how to debug this.

Kind regards,
    Matthias Klumpp

-- 
Debian Developer | Freedesktop-Developer
I welcome VSRE emails. See http://vsre.info/

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Problems with using IIO buffers
@ 2017-01-27 18:53 Mani Sadhasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Mani Sadhasivam @ 2017-01-27 18:53 UTC (permalink / raw)
  To: matthias; +Cc: pmeerw, jic23, linux-iio

Hello Mathias,

For iio_readdev api, the default timeout is 1s that's why you're getting timeout error as the trigger fails to happen within that timeout period.

It'd be worth to note that this api is not a blocking call.

If you wanna use iio_readddev you can probably increase the timeout in local.c file of libiio source.

Change the timeout value of DEFAULT_TIMEOUT_MS to 5000 or anything which will let the trigger to happen. Depending upon the buffer and sample
size you'll require corresponding number of triggers.

For instance, for the buffer length of 2 and you want 2 samples

iio_readdev -t sysfstrig1 -b 2 -s 2 mydev

In this case, if 2 triggers happen within that timeout period, iio_readdev api will successfully return the buffer content.

But for iio_generic_buffer, buffer contents are returned after getting enough triggers (blocking).

Thanks,
Mani

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-01-27 19:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-20 10:18 Problems with using IIO buffers Matthias Klumpp
2016-12-20 10:46 ` Peter Meerwald-Stadler
     [not found]   ` <CAKNHny_yV-FV9smGfrX2wR-T7M5uCk9WWG4xNGBMXrAuwVy2ZA@mail.gmail.com>
2016-12-20 16:30     ` Peter Meerwald-Stadler
2016-12-20 16:49       ` Matthias Klumpp
2016-12-30 18:34         ` Jonathan Cameron
2017-01-09  1:59           ` Matthias Klumpp
2017-01-10 13:29             ` Matthias Klumpp
2017-01-10 14:18               ` jic23
  -- strict thread matches above, loose matches on Subject: below --
2017-01-27 18:53 Mani Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).