AnsweredAssumed Answered

Changing AD9361 RX hardware gain

Question asked by amy_s on May 23, 2016
Latest reply on Jan 23, 2018 by mhennerich

Hi,

 

I'm using a zedboard and AD-FMCOMMS2-EBZ and trying to change the gain on the receive channels.

I have tried calling code which results in

 

long long hwgain = <new gain setting>

iio_channel_attr_write_longlong(channel, "hardwaregain", hwgain)

 

but there this doesn't seem to change the gain, and doesn't seem to result in an error return code, either.

 

I'm also not able to change the gain through the shell:

 

root@analog:/sys/bus/iio/devices/iio:device1# echo "61.000000" > in_voltage0_hardwaregain

root@analog:/sys/bus/iio/devices/iio:device1# cat in_voltage0_hardwaregain

71.000000 dB

root@analog:/sys/bus/iio/devices/iio:device1# echo 62 > in_voltage0_hardwaregain

root@analog:/sys/bus/iio/devices/iio:device1# cat in_voltage0_hardwaregain

71.000000 dB

 

I'm able to change other attributes, such as :

root@analog:/sys/bus/iio/devices/iio:device1# cat in_voltage_rf_bandwidth

18000000

root@analog:/sys/bus/iio/devices/iio:device1# echo 17000000 > in_voltage_rf_bandwidth

root@analog:/sys/bus/iio/devices/iio:device1# cat in_voltage_rf_bandwidth

17000000

 

However, if I change the gain through the Matlab IIO System Object, from then onwards, I can change the gain from the shell:

root@analog:/sys/bus/iio/devices/iio:device1# echo "61.000000" > in_voltage0_hardwaregain

root@analog:/sys/bus/iio/devices/iio:device1# cat in_voltage0_hardwaregain

61.000000 dB

root@analog:/sys/bus/iio/devices/iio:device1# echo 62 > in_voltage0_hardwaregain

root@analog:/sys/bus/iio/devices/iio:device1# cat in_voltage0_hardwaregain

62.000000 dB

 

I'd like to know how I can do this from C program using libiio, but I'm not sure if being able to change it from the shell is related.

 

Thanks,

 

Amy

Outcomes