AnsweredAssumed Answered

Scripting for FMCOMMS5 MCS

Question asked by rmd91 on Dec 11, 2015
Latest reply on Dec 14, 2015 by rmd91

I've been able to get my design working using the IIO Oscilloscope and Linux drivers, but my project will ultimately need to run without having a person controlling the GUI. We've been able to set parameters like RX and TX sampling rate, but noticed that the receive waveforms will often be distorted. Initially, we were clicking "Reload Settings" and the problem would go away. If our script is run more than once, this fix doesn't work.

 

After some debugging, I found that pressing the MCS Sync button fixes this problem. I believe this is because MCS must be run after changing the sampling rate. How can I integrate MCS into the script I've included below? I've tried echo 2 > multichip_sync as I saw in another forum post but that didn't work. I've only been able to get it working through the GUI. If it isn't possible with this method, could you direct me to the solution using libiio in C?

 

FCRX1_DEFAULT=739000000

FCTX1_DEFAULT=739000000

FCRX2_DEFAULT=739000000

FCTX2_DEFAULT=739000000

 

FS=15360000

 

if [ "$#" -eq "4" ]

then

    FCRX1=$1

    FCTX1=$2

    FCRX2=$3

    FCRX2=$4

else

    FCRX1=$FCRX1_DEFAULT

    FCTX1=$FCTX1_DEFAULT

    FCRX2=$FCRX2_DEFAULT

    FCTX2=$FCTX2_DEFAULT

fi

 

BW=10000000

 

echo "Frequency Translation Demo"

echo "RX1 Frequency: $FCRX1 Hz"

echo "TX1 Frequency: $FCTX1 Hz"

echo "RX2 Frequency: $FCRX2 Hz"

echo "TX2 Frequency: $FCTX2 Hz"

 

PHYA_PATH=/sys/bus/iio/devices/iio\:device1

PHYB_PATH=/sys/bus/iio/devices/iio\:device2

TX1_PATH=/sys/bus/iio/devices/iio\:device4

RX1_PATH=/sys/bus/iio/devices/iio\:device6

TX2_PATH=/sys/bus/iio/devices/iio\:device5

RX2_PATH=/sys/bus/iio/devices/iio\:device7

 

#echo 0 > $TX1_PATH/out_altvoltage0_TX1_I_F1_raw

 

# Setup phy

echo $FS > $PHYA_PATH/in_voltage_sampling_frequency

echo $FS > $PHYA_PATH/out_voltage_sampling_frequency

echo $BW > $PHYA_PATH/in_voltage_rf_bandwidth

echo $BW > $PHYA_PATH/out_voltage_rf_bandwidth

echo $FCRX1 > $PHYA_PATH/out_altvoltage0_RX_LO_frequency

echo $FCTX1 > $PHYA_PATH/out_altvoltage1_TX_LO_frequency

 

echo $FS > $PHYB_PATH/in_voltage_sampling_frequency

echo $FS > $PHYB_PATH/out_voltage_sampling_frequency

echo $BW > $PHYB_PATH/in_voltage_rf_bandwidth

echo $BW > $PHYB_PATH/out_voltage_rf_bandwidth

echo $FCRX2 > $PHYB_PATH/out_altvoltage0_RX_LO_frequency

echo $FCTX2 > $PHYB_PATH/out_altvoltage1_TX_LO_frequency

 

# Setup TX

echo 0 > $TX1_PATH/buffer/enable

#echo 0 > $TX2_PATH/buffer/enable

#for i in {0..3}

#do

#    echo 1 > $TX_PATH/scan_elements/out_voltage${i}_en

#done

 

echo 1 > $TX1_PATH/scan_elements/out_voltage0_en

echo 1 > $TX1_PATH/scan_elements/out_voltage1_en

echo 1 > $TX1_PATH/scan_elements/out_voltage2_en

echo 1 > $TX1_PATH/scan_elements/out_voltage3_en

echo 1 > $TX1_PATH/scan_elements/out_voltage4_en

echo 1 > $TX1_PATH/scan_elements/out_voltage5_en

echo 1 > $TX1_PATH/scan_elements/out_voltage6_en

echo 1 > $TX1_PATH/scan_elements/out_voltage7_en

 

echo 1 > $TX1_PATH/buffer/enable

 

# Setup RX

echo 0 > $RX1_PATH/buffer/enable

#for i in {0..3}

#do

#    echo 1 > $RX_PATH/scan_elements/in_voltage${i}_en

#done

 

echo 1 > $RX1_PATH/scan_elements/in_voltage0_en

echo 1 > $RX1_PATH/scan_elements/in_voltage1_en

echo 1 > $RX1_PATH/scan_elements/in_voltage2_en

echo 1 > $RX1_PATH/scan_elements/in_voltage3_en

echo 1 > $RX1_PATH/scan_elements/in_voltage4_en

echo 1 > $RX1_PATH/scan_elements/in_voltage5_en

echo 1 > $RX1_PATH/scan_elements/in_voltage6_en

echo 1 > $RX1_PATH/scan_elements/in_voltage7_en

 

echo 1 > $RX1_PATH/buffer/enable

 

#./set_bypass_fmcomms5 1

Outcomes