Page 1 of 1

Using two rsp2pro simultaneously.

Posted: Fri Dec 01, 2017 3:02 pm
by Paul314
Hi,

I bought 2 rsp2pro's for experimentation. Basically I want to use them as spectrum analyses run coherently (as master and slave) so that I might time correlate signals. Playing with the API so far it's clear that one must either,

1) switch between radios by selecting different device indexes
2) run two versions of the API from separate threads
3) run two version of the API from separate processes
4) use two independent computers.

Since trying all these options is quite time consuming would anyone know which of these options will or is likely to work. Obviously, option 4 will work for some value of work. These options are listed where I favor 1 most and 4 least. If there are other options please advise.

Best regards
Paul

Re: Using two rsp2pro simultaneously.

Posted: Sun Dec 03, 2017 4:35 pm
by Paul314
Okay, still don't have a answer on the previous post but I'm moving forward. The Application 3 of the "RSP2 Reference Clock Application Note" starts with all devices unplugged. I've noticed some odd behavior with "mir_sdr_GetDevices()" that makes the path forward even more cloudy. I'm using a MacPro running High Sierra. The RSP2pro's are plugged via a USB3 compliant 4 port hub.

The issue is when first plugged "mir_sdr_GetDevices()" returns that it finds 2 devices but neglects to fill out the device information in the device list. As long as a radio remains plugged the "mir_sdr_GetDevices()" call works as advertised and fills in the information. I've written a program which lists all sdrplay radios on the system which keeps calling until the info is provided.

Code: Select all

#include <mirsdrapi-rsp.h>
#include <iostream>
#include <stdint.h>

using namespace std;

void initDevT(mir_sdr_DeviceT *device, int &found, int maxCount)
{
  found = -1;
  for (int n = 0; n < maxCount; n++) {
    device[n].SerNo = NULL;
    device[n].DevNm = NULL;
    device[n].hwVer = 0xFF;
    device[n].devAvail = 0xFF;
  }
}

bool invaidDevT(mir_sdr_DeviceT *device, int found)
{
  for (int n = 0; n < found; n++) {
    if (device[n].SerNo == NULL ||
        device[n].DevNm == NULL ||
        device[n].devAvail == 0xFF)
        return true;
  }
  return found < 0;
}

int main()
{
  mir_sdr_ErrT    ret;
  mir_sdr_DeviceT devices[2];
  int             found(-1);
  int             maxCount(2);
  const char     *green = "\033[01;32m";
  const char     *reset = "\033[00m";

  cout << "Look for SDRPlay radios" << endl;
  initDevT(devices,found,maxCount);
  while (invaidDevT(devices,found)) {
    ret = mir_sdr_GetDevices(devices,(uint32_t*)&found,(uint32_t)maxCount);
    if (ret) {
      cout << "GetDevices failed: " << ret << endl;
      return -1;
    }
  }

  cout << "Found: " << found << " devices" << endl;
  for (int n = 0; n < found; n++) {
    cout << "-------------------------" << endl;
    cout << "Serial Number : " << green << devices[n].SerNo << reset << endl;
    cout << "Device Number : " << devices[n].DevNm << endl;
    cout << " Availability : " << ((devices[n].devAvail)?"Available":"In Use") << endl;
    cout << "      Version : " << (int)devices[n].hwVer << endl;
  }
  return 0;
}


Any insight would be appreciated.

Re: Using two rsp2pro simultaneously.

Posted: Sun Dec 03, 2017 5:18 pm
by Paul314
Okay, some diagnostics I should have done first. Added a "mir_sdr_DebugEnable(1)" to the code posted. With the radios previously unplugged, I get,

Code: Select all

Look for SDRPlay radios
fwDownload: FW image size = 6083
fwDownload: FW image size = 6083
Error: libusb_open() -4
mir_sdr_usb_GetDevices Dev0:vid=1df7 pid=3010 rev=0207 serno=1708050E10 bus=000 port=002 devAvail=1
mir_sdr_usb_GetDevices Dev1:vid=1df7 pid=3010 rev=0207 serno=1708051110 bus=000 port=001 devAvail=1
Found: 2 devices
-------------------------
Serial Number : 1708050E10
Device Number : SDRplay_RSPII_VID_1DF7&PID_3010_BUS_000_PORT_002
 Availability : Available
      Version : 2
-------------------------
Serial Number : 1708051110
Device Number : SDRplay_RSPII_VID_1DF7&PID_3010_BUS_000_PORT_001
 Availability : Available
      Version : 2
Just the two lines prior to the "Found: 2 devices" line are emitted if the call works the first time.

If libusb-1.0 is being used, the meaning of a -4 is "No such device (it may have been disconnected)" is what is listed in "libusb.h" as the error meaning.

Re: Using two rsp2pro simultaneously.

Posted: Sun Dec 03, 2017 11:54 pm
by Paul314
The libusb_open failure is special to my Mac and USB3 hub. This problem doesn't occur on my linux machine using a USB2 hub.

I've implemented option 2) of the original post and, of course, it fails with a "hardware problem" error when more than one radio is used :roll:.

Option 1) is stupid so that leaves 3) and 4). On to 3). Inter process communication is not fun but 3) offers more options than 4 as far as I can tell. My the forks be with me...

Re: Using two rsp2pro simultaneously.

Posted: Wed Dec 06, 2017 2:20 pm
by Paul314
Okay, I plug the master radio into the USB and run a program which starts and configures the master with the external clock out enabled. This results in the clock signal appearing (using an oscilloscope) on the out MCX jack on the back of the master as was advertised in the literature. The configure program terminates and the 24MHz clock signal remains. I take a MCX patch cable and connect the output of the master with the soon to be slave and then plug the slave into USB. Both master and slave appear as devices when I run CubicSDR. I select the slave and start. The slave will not work. Why is this?

Re: Using two rsp2pro simultaneously.

Posted: Fri Dec 08, 2017 6:45 am
by Mike2459
File this under 'he debil is in the details;

Re: Using two rsp2pro simultaneously.

Posted: Thu Dec 14, 2017 5:05 pm
by Paul314
In the limit someone might care, it seems it's not possible using the common clock input on the RSP2 to phase lock two radios. Internally the MSI001 tuner uses a Fractional-N synthesizer (or FLL) and not a PLL like I had assumed. Only the average frequency is maintained between the radios and not the relative phase. This means RSP2s can't be used for beam forming or operated as part of a phase array.