AnsweredAssumed Answered

Trouble phase synchronizing two AD9361s

Question asked by ttyler777 on Oct 19, 2016
Latest reply on Oct 25, 2016 by ttyler777

Hello,

 

I've been developing our own software for the FMCOMMS5 board for a while now.  I'm using Libiio, Windows 7, and Visual Studio 2015.

 

I've ran across the problem of synchronizing the phases across the two AD9361 chips.  So far, I've been using this wiki page as a good guide:

Synchronizing multiple AD9361 devices [Analog Devices Wiki] 

And this code:

iio-oscilloscope/fmcomms2_adv.c at master · analogdevicesinc/iio-oscilloscope · GitHub 

 

I however have ran into some problems.  My general thought process behind synchronizing the phases is such:

 

   1.  Turn on TX1B_A

I currently do this by grabbing the "cf-ad9361-dds-core-lpc" device, and setting all "altvoltageX" channels to a frequency of 1 Mhz and a scale of .025.

 

   2.  Insert the signal into RX1C_A

To do this, I have to write to the registry using "iio_device_reg_read" on the "cf-ad9361-A" device.  Here is a code snippet:

 

bool ToggleLoopback(iio_device * inDevice, int channelOnDevice, bool enable)
{
   unsigned int tmp;
   iio_device_reg_read(inDevice, 0x80000418 + channelOnDevice * 0x40, &tmp);

   if (enable)
      tmp |= 0x1;
   else
      tmp &= ~0xF;

   iio_device_reg_write(inDevice, 0x80000418 + channelOnDevice * 0x40, tmp);

   return true;
}

 

I call this function twice as such:

ToggleLoopback(deviceMaster, 0, true);

ToggleLoopback(deviceMaster, 1, true);

 

This successfully inserts the signal into the input, and I can get a frequency domain sample from it.

 

   3.  Insert the signal into RX1C_B 

This is where I've run into issues.  No matter what I do, I can't get the signal generated by "cf-ad9361-dds-core-lpc" to show up in RX1C_B.  I've tried calling ToggleLoopback on the "cf-ad9361-B".  The only way I've seen is to do step one on cf-ad9361-dds-core-B.  

 

Also, if I turn on both dds cores, and ToggleLoopback() on both "cf-ad9361-A"  devices, I can see the signal in both channels!  The diagram on the wiki that I linked makes it seem like it would be impossible for that to happen.

 

   4. Compare phases and update phase cal

I plan on taking the to frequency domain complex values and dividing them.  Then taking the arg of the result.  That should give the phase difference between the two devices and then I can upload the phase cal numbers.

 

Any help would be appreciated.  If any more code is needed, let me know.

Outcomes