Post Go back to editing

AD9361 Digital Tune on Slave Device

I'm having issues running the digital tune routine on the slave AD9361 device on the FMCOMMS5 board doing all three test frequencies (25, 40, 61.44 MHz). By default, when Linux boots, the master and slave devices are probed and the 25 MHz, 40 MHz, and 61.44 MHz digital tunes run and pass on the master AD9361 device and then the 30.72 MHz (default sampling frequency) test runs and passes on the slave device. I would like to run the digital tune over all three test frequencies on both the master and slave device so I ended up modifying the ad9361_conv.c driver file to force it to test all three frequencies on both the master and slave device (devices with ID > 0). Sometimes the digital tune on the slave device passes, other times it fails. My code modification forces an update of the sampling frequency of the master device and slave device before performing the digital tune but I still get failures occasionally.

I have seen the posts about it not being uncommon for the slave AD9361 to fail tuning (seen hereand here) but in those posts, it seems like that is the case only before the MCS sequence has been run.

I tried using the the MCS device from debugfs using

echo 1..5 > /sys/kernel/debug/iio:device0/multichip_sync

and also using the libad9361-iio library by making a relatively simple C program that calls the 'ad9361_fmcomms5_multichip_sync' function.

I don't seem to have any issues running either sequence, at least no errors get reported to my knowledge, but even after running the MCS sequence, trying to run the full three test frequencies digital tune on the slave device fails.

The really odd thing is that I can update the sample rate manually of both devices in the rootfs and run single frequency tests on the slave device and never get a failure for each frequency. ie

echo 25000000 > /sys/bus/iio/devices/iio\:device0/out_voltage_sampling_frequency
echo 25000000 > /sys/bus/iio/devices/iio\:device1/out_voltage_sampling_frequency
echo 0 3 > /sys/kernel/debug/iio/iio\:device1/digital_tune
echo 40000000 > /sys/bus/iio/devices/iio\:device0/out_voltage_sampling_frequency
echo 40000000 > /sys/bus/iio/devices/iio\:device1/out_voltage_sampling_frequency
echo 0 3 > /sys/kernel/debug/iio/iio\:device1/digital_tune
echo 61440000 > /sys/bus/iio/devices/iio\:device0/out_voltage_sampling_frequency
echo 61440000 > /sys/bus/iio/devices/iio\:device1/out_voltage_sampling_frequency
echo 0 3 > /sys/kernel/debug/iio/iio\:device1/digital_tune

As soon as I try to do more than one frequency, even with the modified code, I will often get failures in Tx tune and sometimes on Rx tune for the slave device.

echo 1 3 > /sys/kernel/debug/iio/iio\:device1/digital_tune

Am I doing something wrong, or is this a limitation of the hardware/drivers/HDL?

I'm using HDL 2016_r1, the 2016_r2 Linaro image, and the 2017_R1 branch of the ADI Linux kernel.