Over the last several weeks I’ve been trying to adapt a Gen 2 UHF RFID library that was originally made for the USRPN200/N210 and I’ve at least been able to partially adapt the library, after installing it, for the LimeSDR with the code below:
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
from gnuradio import analog
from gnuradio import digital
import osmosdr
import sip
import sys
import time
import rfid
class reader_top_block(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
rt = gr.enable_realtime_scheduling()
######## Variables #########
self.dac_rate = 1e6 # DAC rate
self.adc_rate = 100e6/50 # ADC rate (2MS/s complex samples)
self.decim = 5 # Decimation (downsampling factor)
self.ampl = 0.1 # Output signal amplitude (signal power vary for different RFX900 cards)
self.freq = 915e6 # Modulation frequency (can be set between 902-920)
self.rx_gain = 20 # RX Gain (gain at receiver)
self.tx_gain = 0 # RFX900 no Tx gain option
# Each FM0 symbol consists of ADC_RATE/BLF samples (2e6/40e3 = 50 samples)
# 10 samples per symbol after matched filtering and decimation
self.num_taps = [1] * 25 # matched to half symbol period
self.file_sink_decoder = blocks.file_sink(gr.sizeof_gr_complex*1, "data/decoder", False)
######## Blocks #########
self.matched_filter = filter.fir_filter_ccf(self.decim, self.num_taps)
self.gate = rfid.gate(int(self.adc_rate/self.decim))
self.tag_decoder = rfid.tag_decoder(int(self.adc_rate/self.decim))
self.reader = rfid.reader(int(self.adc_rate/self.decim),int(self.dac_rate))
self.amp = blocks.multiply_const_ff(self.ampl)
self.to_complex = blocks.float_to_complex(1)
# Osmocom blocks
self.u_source = osmosdr.source(args="numchan=" + str(1) + " " + 'driver=lime,soapy=0' )
self.u_source.set_sample_rate(self.adc_rate)
self.u_source.set_center_freq(self.freq, 0)
self.u_source.set_freq_corr(0, 0)
self.u_source.set_dc_offset_mode(0, 0)
self.u_source.set_iq_balance_mode(0, 0)
self.u_source.set_gain_mode(True, 0)
self.u_source.set_gain(self.rx_gain, 0)
self.u_source.set_if_gain(10, 0)
self.u_source.set_bb_gain(10, 0)
self.u_source.set_antenna("LNAL", 0)
self.u_source.set_bandwidth(0, 1000000)
self.u_sink = osmosdr.sink(args="numchan=" + str(1) + " " + 'driver=lime,soapy=0' )
self.u_sink.set_sample_rate(self.dac_rate)
self.u_sink.set_center_freq(self.freq, 0)
self.u_sink.set_freq_corr(0, 0)
self.u_sink.set_gain(self.tx_gain, 0)
self.u_sink.set_if_gain(15, 0)
self.u_sink.set_bb_gain(15, 0)
self.u_sink.set_antenna("BAND1", 0)
self.u_sink.set_bandwidth(0, 1000000)
######## Connections #########
self.connect(self.u_source, self.matched_filter)
self.connect(self.matched_filter, self.gate)
self.connect(self.gate, self.tag_decoder)
self.connect((self.tag_decoder,0), self.reader)
self.connect(self.reader, self.amp)
self.connect(self.amp, self.to_complex)
self.connect(self.to_complex, self.u_sink)
#self.connect(self.gate, self.file_sink_gate)
self.connect((self.tag_decoder,1), self.file_sink_decoder) # (Do not comment this line)
#self.connect(self.file_sink_reader, self.file_sink_reader)
#self.connect(self.matched_filter, self.file_sink_matched_filter)
if __name__ == '__main__':
main_block = reader_top_block()
main_block.start()
while(1):
inp = raw_input("'Q' to quit \n")
if (inp == "q" or inp == "Q"):
break
main_block.reader.print_results()
main_block.stop()
And when I run it I get the following output:
/usr/bin/python2.7 /home/logic/SDR/LimeReader.py
linux; GNU C++ version 5.4.0 20160609; Boost_105800; UHD_003.010.001.001-release
gr::log :INFO: gate0 - T1 samples : 96
gr::log :INFO: gate0 - PW samples : 4
gr::log :INFO: gate0 - Samples of Tag bit : 10
gr::log :INFO: gate0 - Size of window : 100
gr::log :INFO: gate0 - Size of window for dc offset estimation : 48
gr::log :INFO: gate0 - Duration of window for dc offset estimation : 120 us
gr::log :INFO: gate0 - Initializing reader state...
gr::log :INFO: tag_decoder0 - Number of samples of Tag bit : 10
gr::log :INFO: reader0 - Block initialized
gr::log :INFO: reader0 - Number of samples data 0 : 24
gr::log :INFO: reader0 - Number of samples data 1 : 48
gr::log :INFO: reader0 - Number of samples cw : 250
gr::log :INFO: reader0 - Number of samples delim : 12
gr::log :INFO: reader0 - Number of slots : 1
gr::log :INFO: reader0 - Carrier wave after a query transmission in samples : 1295
gr::log :INFO: reader0 - Carrier wave after ACK transmission in samples : 4575
gr-osmosdr v0.1.x-xxx-xunknown (0.1.5git) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy soapy redpitaya
[INFO] Make connection: 'LimeSDR-USB [USB 3.0] 9060A02592E12'
Estimated reference clock 30.7197 MHz
Selected reference clock 30.720 MHz
LMS7002M values cache at /home/logic/.limesuite/LMS7002M_cache_values.db
[INFO] Device name: LimeSDR-USB
[INFO] Reference: 30.72 MHz
[INFO] Init LMS7002M(0)
[INFO] Ver=7, Rev=1, Mask=1
CGEN: Freq=80 MHz, VCO=2.56 GHz, INT=82, FRAC=349525, DIV_OUTCH_CGEN=15
[INFO] LMS7002M calibration values caching Enable
[INFO] SoapyLMS7::setFrequency(Rx, 0, BB, 0 MHz)
[INFO] SoapyLMS7::setFrequency(Tx, 0, BB, 0 MHz)
[INFO] SoapyLMS7::setAntenna(Rx, 0, LNAL)
[INFO] SoapyLMS7::setAntenna(Tx, 0, BAND1)
[INFO] SoapyLMS7::setGain(Rx, 0, PGA, 0 dB)
[INFO] SoapyLMS7::setGain(Rx, 0, LNA, 0 dB)
[INFO] SoapyLMS7::setGain(Rx, 0, TIA, 0 dB)
[INFO] SoapyLMS7::setGain(Tx, 0, PAD, -50 dB)
[INFO] SoapyLMS7::setSampleRate(Rx, 0, 10 MHz), CGEN=80 MHz, ADC=20 MHz, decim=2
ConnectionSTREAM::ConfigureFPGA_PLL(tx=20MHz, rx=10MHz)
----- FPGA PLL #1 CONFIG -----
M=156, N=3, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 114.2 (steps 132)
----- FPGA PLL #0 CONFIG -----
M=182, N=7, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 100.4 (steps 58)
[INFO] SoapyLMS7::setSampleRate(Tx, 0, 10 MHz), CGEN=80 MHz, DAC=20 MHz, interp=2
ConnectionSTREAM::ConfigureFPGA_PLL(tx=10MHz, rx=10MHz)
----- FPGA PLL #1 CONFIG -----
M=156, N=3, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 114.2 (steps 132)
----- FPGA PLL #0 CONFIG -----
M=156, N=3, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 95.2 (steps 110)
[INFO] SoapyLMS7::setBandwidth(Rx, 0, 30 MHz)
[INFO] Rx Filter calibrated from cache
[INFO] SoapyLMS7::setBandwidth(Tx, 0, 30 MHz)
[INFO] Tx Filter calibrated from cache
[INFO] SoapyLMS7::setFrequency(Rx, 1, BB, 0 MHz)
[INFO] SoapyLMS7::setFrequency(Tx, 1, BB, 0 MHz)
[INFO] SoapyLMS7::setAntenna(Rx, 1, LNAL)
[INFO] SoapyLMS7::setAntenna(Tx, 1, BAND1)
[INFO] SoapyLMS7::setGain(Rx, 1, PGA, 0 dB)
[INFO] SoapyLMS7::setGain(Rx, 1, LNA, 0 dB)
[INFO] SoapyLMS7::setGain(Rx, 1, TIA, 0 dB)
[INFO] SoapyLMS7::setGain(Tx, 1, PAD, -50 dB)
[INFO] SoapyLMS7::setSampleRate(Rx, 1, 10 MHz), CGEN=80 MHz, ADC=20 MHz, decim=2
ConnectionSTREAM::ConfigureFPGA_PLL(tx=20MHz, rx=10MHz)
----- FPGA PLL #1 CONFIG -----
M=156, N=3, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 114.2 (steps 132)
----- FPGA PLL #0 CONFIG -----
M=182, N=7, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 100.4 (steps 58)
[INFO] SoapyLMS7::setSampleRate(Tx, 1, 10 MHz), CGEN=80 MHz, DAC=20 MHz, interp=2
ConnectionSTREAM::ConfigureFPGA_PLL(tx=10MHz, rx=10MHz)
----- FPGA PLL #1 CONFIG -----
M=156, N=3, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 114.2 (steps 132)
----- FPGA PLL #0 CONFIG -----
M=156, N=3, Fvco=1040.000 MHz
Configured phase: 0.0 (steps 0)
Configured phase: 95.2 (steps 110)
[INFO] SoapyLMS7::setBandwidth(Rx, 1, 30 MHz)
[INFO] Rx Filter calibrated from cache
[INFO] SoapyLMS7::setBandwidth(Tx, 1, 30 MHz)
[INFO] Tx Filter calibrated from cache
[INFO] SoapyLMS7::setSampleRate(Rx, 0, 2 MHz), CGEN=256 MHz, ADC=64 MHz, decim=32
CGEN: Freq=256 MHz, VCO=2.56 GHz, INT=82, FRAC=349525, DIV_OUTCH_CGEN=4
ConnectionSTREAM::ConfigureFPGA_PLL(tx=2MHz, rx=2MHz)
SetFrequency using cache values vco:2, csw:181
[INFO] SoapyLMS7::setFrequency(Rx, 0, RF, 915 MHz)
[WARNING] GetDC_IQ_Interp(915 MHz, ch=0, tx=0): no matches between [914, 916] MHz
[INFO] SoapyLMS7::setFrequency(Rx, 0, BB, 0 MHz)
[INFO] SoapyLMS7::setGain(Rx, 0, LNA, 20 dB)
[INFO] SoapyLMS7::setGain(Rx, 0, TIA, 2 dB)
[INFO] SoapyLMS7::setGain(Rx, 0, PGA, 2 dB)
[INFO] SoapyLMS7::setGain(Rx, 0, LNA, 10 dB)
[INFO] SoapyLMS7::setGain(Rx, 0, PGA, 10 dB)
[INFO] SoapyLMS7::setAntenna(Rx, 0, LNAL)
gr-osmosdr v0.1.x-xxx-xunknown (0.1.5git) gnuradio 3.7.10
built-in sink types: uhd hackrf bladerf soapy redpitaya file
CGEN: Freq=128 MHz, VCO=2.56 GHz, INT=82, FRAC=349525, DIV_OUTCH_CGEN=9
[INFO] SoapyLMS7::setSampleRate(Tx, 0, 1 MHz), CGEN=128 MHz, DAC=32 MHz, interp=32
ConnectionSTREAM::ConfigureFPGA_PLL(tx=1MHz, rx=2MHz)
SetFrequency using cache values vco:2, csw:182
[INFO] SoapyLMS7::setFrequency(Tx, 0, RF, 915 MHz)
[WARNING] GetDC_IQ_Interp(915 MHz, ch=0, tx=1): no matches between [914, 916] MHz
[INFO] SoapyLMS7::setFrequency(Tx, 0, BB, 0 MHz)
[INFO] SoapyLMS7::setGain(Tx, 0, PAD, 15 dB)
[INFO] SoapyLMS7::setGain(Tx, 0, PAD, 15 dB)
[INFO] SoapyLMS7::setAntenna(Tx, 0, BAND1)
'Q' to quit
Warning popping from TX, samples popped 1314/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 1083/1360
Warning popping from TX, samples popped 0/1360
L 1392640
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Rx: 6.029 MB/s, Fs: 0.000 MHz, overrun: 0, loss: 0
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Tx: 0.000 MB/s, Fs: 0.000 MHz, failures: 0, ts:0
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
Rx: 6.023 MB/s, Fs: 0.000 MHz, overrun: 0, loss: 0
Warning popping from TX, samples popped 0/1360
Warning popping from TX, samples popped 0/1360
And that message continually repeats itself. I’ve narrowed it down this file on github in LimeSuite, that is continuously printing that message for a popping of the TX stream. I know some guys working with OpenBTS had a similar problem with this on that setup and a BLE sniffer setup too, but I’m not entirely sure how they fixed it. Is there anyway to mitigate TX popping?