AnsweredAssumed Answered

Using the Xilinx XADC with libiio

Question asked by gsavaton on Oct 25, 2016
Latest reply on Oct 25, 2016 by larsc

I am trying to write a program for the ZedBoard that uses the XADC as a Linux IIO device.

I have successfully activated the VP/VN channel as explained in Adding XADC to Zynq DeviceTree and I can read the current value from: /sys/bus/iio/devices/iio:device0/in_voltage9_vpvn_raw

 

Now I want to access the XADC programmatically using a similar technique as in the AD9361 streaming example.

Currently, my program fails when trying to allocate a buffer for the input samples.

Function iio_device_create_buffer() returns NULL.

This is the sequence of operations that my program executes before failing:

struct iio_context* ctx = iio_create_local_context();
struct iio_device* xadc = iio_context_find_device(ctx, "xadc");
struct iio_channel* vpvn = iio_device_find_channel(xadc, "voltage9", 0);
struct iio_buffer* buf = iio_device_create_buffer(xadc, 1024, 0);

Debugging into iio_device_create_buffer(), I think that the library fails to get the sample size using iio_device_get_sample_size().

 

Is there any working example of using the XADC through the IIO library?

What is the appropriate technique to read a data stream from the XADC?

Outcomes