Vector Network Analyzer

I’m getting the following occasionally:

[ERROR] Tune Rx Filter: MCU error 2 (CGEN tune failed)
[ERROR] setBandwidth(Rx, 0, 30 MHz) Failed -
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 801, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 754, in run
self.__target(*self.__args, **self.__kwargs)
File “sna.py”, line 80, in snaThread
self.sweeper = SingleToneSweeper(radio, self.snaSampleRate, 20, 20, self)
File “/media/rusty/COMMON/CE301/VNA/limeSNA/SingleToneSweeper.py”, line 24, in init
self.setSampleRate(sampleRate)
File “/media/rusty/COMMON/CE301/VNA/limeSNA/SingleToneSweeper.py”, line 37, in setSampleRate
self.radio.rxBandwidth = int(sampleRate * 1.5)
File “build/bdist.linux-x86_64/egg/pyLMS7002Soapy/pyLMS7002Soapy.py”, line 222, in rxBandwidth
self.sdr.setBandwidth(SOAPY_SDR_RX, 0, val)
File “/usr/lib/python2.7/dist-packages/SoapySDR.py”, line 1841, in setBandwidth
RuntimeError

Any suggestions?

Try to modify the sweepResult function in the sna.py to:

    self.socketio.emit('data', {
        'x': index,
        'y': pwr
    })
    self.socketio.sleep(0)

Please let me know if it helps.

Based on the pyLMS7002Soapy library configureAntenna code the switching is automatic:

        if frequency >= 1.5e9:
            self.sdr.setAntenna(SOAPY_SDR_TX, self.channel, 'BAND2')
        else:
            self.sdr.setAntenna(SOAPY_SDR_TX, self.channel, 'BAND1')
        if frequency >= 1.5e9:
            self.sdr.setAntenna(SOAPY_SDR_RX, self.channel, 'LNAH')
        else:
            self.sdr.setAntenna(SOAPY_SDR_RX, self.channel, 'LNAL')

You can modify the code by replacing the configureAntenna call in the SingleToneSweeper.py to:

self.radio.sdr.setAntenna(SOAPY_SDR_RX, 0, ‘LNAH’)

1 Like

I uploaded a new version to github, changes:

  • Python 3 support
  • Switched from numpy fft to scipy welch (fixed the fft index calculation issue causing misalignment on higher sample rates)
  • Added rx/tx gain controll to the ui
  • Maybe fixed the socketio lag on linux
2 Likes

I’m checking in on this thread to see if anyone got to run the measureVNA_900.py script for frequencies below 240MHz. Specifically, I am trying to get it to plot an S curve for the FM band with a few different antennas for transmitting a signal.