Post Go back to editing

IIO question with AD9361

I'm starting with the ad9361-iiostream.c example and am trying to get the receiver's RSSI and gain status, but seem to be unable to 'find' the attribute.

I've tried to get it a few ways and nothing seems to work

1) iio_device_attr_read_double () from the ad9361-phy and channel voltage 0 asking for attribute "rssi"

2) iio_device_attr_read_double () from the ad9361-phy and channel voltage 0 asking for attribute "rssi"

3) iio_channel_attr_read_double () from cf-ad9361-A and channel voltage 0 asking for attribute "rssi"

I've been trying to rely on iio_info to tell me what are the valid current device/channel/attribute combinations but it seems not to be helping.

What am I missing?  Is there a good primer that would help?

Thanks!

Parents
  • Hi,

    1) and 2) look the same to me

    Here is some sample code that reads the IRSSI:

    #include <iio.h>
    #include <stdio.h>
    
    int main(void)
    {
        double value;
        struct iio_context *ctx = iio_create_default_context();
        struct iio_device *dev = iio_context_find_device(ctx, "ad9361-phy");
        struct iio_channel *ch = iio_device_find_channel(dev, "voltage0", false);
        int ret = iio_channel_attr_read_double(ch, "rssi", &value);
        if (ret < 0)
            printf("Unable to read RSSI: %i\n", ret);
        else
            printf("RSSI: %f\n", value);
    
        iio_context_destroy(ctx);
        return 0;
    }
    
    
    

    So 3) was right, but you used the wrong device (cf-ad9361-A instead of ad9361-phy).

    -Paul

Reply
  • Hi,

    1) and 2) look the same to me

    Here is some sample code that reads the IRSSI:

    #include <iio.h>
    #include <stdio.h>
    
    int main(void)
    {
        double value;
        struct iio_context *ctx = iio_create_default_context();
        struct iio_device *dev = iio_context_find_device(ctx, "ad9361-phy");
        struct iio_channel *ch = iio_device_find_channel(dev, "voltage0", false);
        int ret = iio_channel_attr_read_double(ch, "rssi", &value);
        if (ret < 0)
            printf("Unable to read RSSI: %i\n", ret);
        else
            printf("RSSI: %f\n", value);
    
        iio_context_destroy(ctx);
        return 0;
    }
    
    
    

    So 3) was right, but you used the wrong device (cf-ad9361-A instead of ad9361-phy).

    -Paul

Children
No Data