AnsweredAssumed Answered

How do you change the sampling frequency on the AD9371?

Question asked by taschluter on Oct 26, 2016
Latest reply on Nov 14, 2016 by taschluter

Right now what would be helpful is a step by step guide on how to change the sampling frequency and Bandwidth.

 

Whether or not I start the osc app with sudo or not I cannot write to the sampling frequency in the debug tab. Even trying to change the value directly in the terminal I get:

/sys/bus/iio/devices/iio:device3# echo 2450000000 > out_voltage_sampling_frequency

-bash: echo: write error: Success

 

Even changing the IQ rate directly in the advanced tab does not change the sampling rate. We have also tried changing it directly from the command line. If you look in the c file for the driver it gets set from the following on line 637/638:

clk_set_rate(phy->clks[RX_SAMPL_CLK]

mykDevice->rx->rxProfile->iqRate_kHz * 1000);

https://github.com/analogdevicesinc/linux/blob/mykonos/drivers/iio/adc/ad9371.c

 

I also tried using the Matlab AD9371 Filter Wizard to try and generate the profile which I then could load inside the osc app. When I load it from the File tab it loads in with still the incorrect values. When I load it from the Global Settings Load Profile button it says that it fails to load in the profile. When I try and do it from command line as shown:

https://wiki.analog.com/resources/tools-software/linux-drivers/iio-transceiver/ad9371#example_linux_device-tree_initialization

this is what we see.

 

root@analog:/sys/bus/iio/devices/iio:device3# cat /usr/local/lib/osc/profiles/test2.txt > profile_config

cat: write error: Invalid argument

 

The Matlab GUI supposedly checked the requirements below before creating the profile:

The complete set of rules used by the GUI is listed later on this Wiki page.

  1. The Tx Input Sample Rate must be the same as the ORx Output Sample Rate as internal and external AD9371 calibrations require these rates to be the same
  2. The ORx Output Sample Rate must be a power of 2 multiple of the Rx Output Rate to satisfy JESD204B requirements
  3. The Tx Synthesis (total) bandwidth must be less than 82% of the Tx sample rate
  4. The ORx RF BW must be greater than 33% and less than 82% of the ORx sample rate
  5. The Rx RF BW must be greater than 33% and less than 82% of the Rx sample rate

Are there other requirements necessary when loading in the profile?

 

If I go to /sys/kernel/debug/iio /iio:device3 and attempt to change the adi,rx-profile-iq-rate_khz I am able to modify the values, however, I do not see the changes propagate up through the sampling rate in the GUI or through the values in /sys/bus/iio/devices /iio:device3.

 

I have also tried modifying the clk frequency in the device tree, however, after modifying the system does not boot and it says it cannot read the device tree blob. Are there any device tree bindings for the devices?

 

I am finding it very difficult to find any lower level documentation or requirements for any of the settings. I am very easily able to change the mix frequency, however, have not found a way to change the BW or the sampling frequency even using profiles. I have very easily been able to sweep the frequency of the DDS core (device 5). Obviously my process is wrong, and I need an example to work from.

 

It would also be nice if the tool did design rule checks so that the requirements of the sampling rate and bandwidth were made clear to the user. I only knew about them because of the summary on the MATLAB tool page. Also if the Bandwidth and Sampling frequency are not modifiable while it is running then it would be nice if those were read only so that the user could tell. Also all of the links point to a mykonos branch on the repo, however, all of the tools update everything to the 2015_R2 branches. Is this correct or would the mykonos branch be more up to date?

Outcomes