SoapySDR

anyone working on soapysdr for lime?

the SoapyLMS7 module is in the LimeSuite distro. It should plug in fine.

how is the NCO used …

the few softwares that i use dont have bits that control lime … and im wondering if its soapy or those saotwares – linhpsdr gqrx, sdrangel and quisk etc …

If you set source “RF” you are setting the PLL for the analog conversion. If you set source “BB” you are setting the NCO. Here is a setup I am using:

sdr = SoapySDR.Device(dev)

sdr.setSampleRate(SOAPY_SDR_RX, 0, 1e6)
sdr.setSampleRate(SOAPY_SDR_TX, 0, 1e6)

sdr.setFrequency(SOAPY_SDR_RX, 0, "RF", 200e6+1.0e6*1 )
#note: SoapyLMS7 seems to have an opposite sign on this than gr-limesuite
sdr.setFrequency(SOAPY_SDR_RX, 0, "BB", -1.0e6*1 )
sdr.setBandwidth(SOAPY_SDR_RX, 0, 2.5e6)

sdr.setFrequency(SOAPY_SDR_TX, 0, "RF", 200e6+1.0e6*1 )
#note: SoapyLMS7 seems to have an opposite sign on this than gr-limesuite
sdr.setFrequency(SOAPY_SDR_TX, 0, "BB", -1.0e6*1 )
sdr.setBandwidth(SOAPY_SDR_TX, 0, 5e6)

rxranges =  {k: sdr.getGainRange(SOAPY_SDR_RX,0,k) for k in ("TIA","LNA","PGA")}
sdr.setAntenna(SOAPY_SDR_RX, 0, "LNAW")
sdr.setGain(SOAPY_SDR_RX,0,"LNA",rxranges["LNA"].maximum()-20)
sdr.setGain(SOAPY_SDR_RX,0,"TIA",rxranges["TIA"].maximum())
sdr.setGain(SOAPY_SDR_RX,0,"PGA",rxranges["PGA"].maximum()-10)
sdr.setDCOffsetMode(SOAPY_SDR_RX,0,False) #turn off automatic DC offset correction
sdr.writeSetting("CALIBRATE_RX",str(5e6)); #calibrate to expected bandwidth
sdr.setGain(SOAPY_SDR_RX,0,"LNA",rxranges["LNA"].minimum()+5)

txgains=sdr.listGains(SOAPY_SDR_TX, 0)
txranges =  {k: sdr.getGainRange(SOAPY_SDR_TX,0,k) for k in txgains}
for k, v in txranges.items():
    print(k, v.minimum(), v.maximum())

sdr.setGain(SOAPY_SDR_TX,0,"IAMP",0)
sdr.setGain(SOAPY_SDR_TX,0,"PAD",30) #power amp gain
sdr.setBandwidth(SOAPY_SDR_TX, 0, 5e6)
sdr.writeSetting("CALIBRATE_TX",str(5e6) );
sdr.setGain(SOAPY_SDR_TX,0,"PAD",20) #power amp gain turned down

#had to read source code to find this...
sdr.writeSetting(SOAPY_SDR_RX,0,"ENABLE_GFIR_LPF", str(1e5))

print("locked?", sdr.readSensor("clock_locked"))
print("temperature", sdr.readSensor("lms7_temp"))

how about hardware decimation

That was a bit trickier. I had to add my own “settings” code to SoapyLMS7 that introduces a “OVERSAMPLING” keyword and calls the LimeSuite function which handles this. Since this site doesn’t seem to allow file uploads, I cant send this to you. Now that I know it works, I should send it to the git maintainers to check it in. I just did it last week, but I think it is OK, since it pretty directly calls their rather complex function.

I’ll do it the cheap way. Here is the end of SoapyLMS7::writeSetting(const int direction, const size_t channel, const std::string &key, const std::string &value) with my addition, and some extra lines for context. Just look at the bottom of the function, and you will see where to paste this in. Note that this must be called after setting the main sample rate. The argument is a string representing the integer oversampling rate.

   }
else if (key == "OVERSAMPLING")
{
    std::unique_lock<std::recursive_mutex> lock(_accessMutex);
    lms7Device->SetRate(sampleRate, std::stoi(value));
}
else
{
    uint16_t val = std::stoi(value);
    if (lms7Device->WriteParam(key,val,channel)!=-1)
        return;
    throw std::runtime_error("unknown setting key: "+key);
}

do you mind if i pass that code to the author of Quisk … to see if he wouls do something simiar …

or ask him to look here …

im not sure, but i dont thin that is python

Please pass it along. It is edited c++ code from “Settings.cpp” in SoapyLMS7. I guess I should have said what file it went with

To call this function, do:
sdr.writeSetting("OVERSAMPLING", str(32))