AnsweredAssumed Answered

Problem/error using triggers libiio AD9361

Question asked by LeroyKii on Nov 17, 2016
Latest reply on Nov 17, 2016 by LeroyKii

Hello everyone,

 

(PicoZed SDR + breakout carrier, kernel 4.6)

 

I've been following this thread to be able to use hrtimer triggers from an user program. I enabled the kernel drivers and I'm able to create a trigger instance:

$ mount -t configfs none /config
$ mkdir /config/iio/triggers/hrtimer/instance1

$ ls /sys/bus/iio/devices

   iio:device0  iio:device1  iio:device2  iio:device3  trigger0

$ iio_info

IIO context has 5 devices:
        trigger0: instance1
                0 channels found:
                1 device-specific attributes found:
                                attr 0: sampling_frequency value: 120

So far so good.

My C program calls are as follows:

(...)

assert((ctx = iio_create_local_context()) && "No context");

ctx_timeout = iio_context_set_timeout(ctx, 0);

trigger = iio_context_find_device(ctx, "instance1");

dev = iio_context_find_device(ctx, "cf-ad9361-lpc");

ret = iio_device_attr_write_longlong(trigger, "sampling_frequency", SAMPLES);

ret = iio_device_set_trigger(dev, trigger);

(...)

  • trigger returns a pointer to (nil).
  • Anyhow the call to iio_device_attr_write_longlong works and I can see the sampling_frequency attribute updated.
  • iio_device_set_trigger call returns -2 (No such file or directory).

I would appreciate any hint on what I'm doing wrong.
Regards,
Leroy.

Outcomes