Add script to read RSSI from AD9361

This commit is contained in:
thavinga 2023-01-10 16:16:08 +01:00
parent efa47b29f6
commit c0371e3594

36
user_space/rssi_show.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
# Reads RSSI in dB from RX1, let's call it "r".
# Linear fit offset "o" depends on frequency (2.4GHz or 5GHz and FMCOMMS2/3).
# RSSI(dBm) = -r + o
# 2.4GHz FMCOMMS2: o = 16.74
# 2.4GHz FMCOMMS3: o = 17.44
# 5GHz FMCOMMS2: o = 25.41
# 5GHz FMCOMMS3: o = 24.58
home_dir=$(pwd)
set -x
if test -f "/sys/bus/iio/devices/iio:device0/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device0/
else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device1/
else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device2/
else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device3/
else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device4/
else
echo "Can not find in_voltage_rf_bandwidth!"
echo "Check log to make sure ad9361 driver is loaded!"
exit 1
fi
fi
fi
fi
fi
set +x
cat in_voltage0_rssi
cd $home_dir