Skip to content

Commit 039bbcd

Browse files
committed
adding bandpass filters to full-duplex test flows
1 parent cdce344 commit 039bbcd

File tree

4 files changed

+97
-15
lines changed

4 files changed

+97
-15
lines changed

tdo_rup.grc

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ blocks:
6565
bus_sink: false
6666
bus_source: false
6767
bus_structure: null
68-
coordinate: [600, 752.0]
68+
coordinate: [480, 792.0]
6969
rotation: 0
7070
state: true
7171
- name: analog_sig_source_x_0_0
@@ -88,7 +88,7 @@ blocks:
8888
bus_sink: false
8989
bus_source: false
9090
bus_structure: null
91-
coordinate: [360, 136.0]
91+
coordinate: [352, 152.0]
9292
rotation: 0
9393
state: true
9494
- name: audio_sink_0
@@ -124,7 +124,32 @@ blocks:
124124
bus_sink: false
125125
bus_source: false
126126
bus_structure: null
127-
coordinate: [232, 696.0]
127+
coordinate: [144, 720.0]
128+
rotation: 0
129+
state: enabled
130+
- name: band_pass_filter_0
131+
id: band_pass_filter
132+
parameters:
133+
affinity: ''
134+
alias: ''
135+
beta: '6.76'
136+
comment: ''
137+
decim: '1'
138+
gain: '1'
139+
high_cutoff_freq: tx_rx_mix_freq + (tx_rx_bw /2) + 1000
140+
interp: '1'
141+
low_cutoff_freq: tx_rx_mix_freq - (tx_rx_bw /2) - 1000
142+
maxoutbuf: '0'
143+
minoutbuf: '0'
144+
samp_rate: samp_rate
145+
type: fir_filter_ccf
146+
width: '1000'
147+
win: window.WIN_HAMMING
148+
states:
149+
bus_sink: false
150+
bus_source: false
151+
bus_structure: null
152+
coordinate: [592, 564.0]
128153
rotation: 0
129154
state: enabled
130155
- name: blocks_complex_to_float_0
@@ -187,7 +212,7 @@ blocks:
187212
bus_sink: false
188213
bus_source: false
189214
bus_structure: null
190-
coordinate: [488, 664.0]
215+
coordinate: [400, 664.0]
191216
rotation: 0
192217
state: enabled
193218
- name: blocks_message_strobe_0
@@ -240,7 +265,7 @@ blocks:
240265
bus_sink: false
241266
bus_source: false
242267
bus_structure: null
243-
coordinate: [840, 648.0]
268+
coordinate: [808, 664.0]
244269
rotation: 0
245270
state: true
246271
- name: blocks_multiply_xx_0_0
@@ -490,10 +515,11 @@ connections:
490515
- [analog_sig_source_x_0, '0', blocks_multiply_xx_0, '1']
491516
- [analog_sig_source_x_0_0, '0', blocks_multiply_xx_0_0, '0']
492517
- [audio_source_0, '0', blocks_float_to_complex_0, '0']
518+
- [band_pass_filter_0, '0', blocks_multiply_xx_0, '0']
493519
- [blocks_complex_to_float_0, '0', audio_sink_0, '0']
494520
- [blocks_complex_to_float_1, '0', blocks_wavfile_sink_0, '0']
495521
- [blocks_conjugate_cc_0, '0', blocks_complex_to_float_0, '0']
496-
- [blocks_float_to_complex_0, '0', blocks_multiply_xx_0, '0']
522+
- [blocks_float_to_complex_0, '0', band_pass_filter_0, '0']
497523
- [blocks_message_strobe_0, strobe, lora_sdr_payload_id_inc_0, msg_in]
498524
- [blocks_message_strobe_0, strobe, lora_tx_0, in]
499525
- [blocks_multiply_const_vxx_0, '0', blocks_conjugate_cc_0, '0']

tdo_rup.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
from gnuradio import audio
1414
from gnuradio import blocks
1515
import pmt
16-
from gnuradio import gr
16+
from gnuradio import filter
1717
from gnuradio.filter import firdes
18+
from gnuradio import gr
1819
from gnuradio.fft import window
1920
import sys
2021
import signal
@@ -77,6 +78,16 @@ def __init__(self, message_str='TEST', mult_amp=0.5, tx_cr=1, tx_rx_bw=8000, tx_
7778
self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
7879
self.blocks_complex_to_float_1 = blocks.complex_to_float(1)
7980
self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
81+
self.band_pass_filter_0 = filter.fir_filter_ccf(
82+
1,
83+
firdes.band_pass(
84+
1,
85+
samp_rate,
86+
(tx_rx_mix_freq - (tx_rx_bw /2) - 1000),
87+
(tx_rx_mix_freq + (tx_rx_bw /2) + 1000),
88+
1000,
89+
window.WIN_HAMMING,
90+
6.76))
8091
self.audio_source_0 = audio.source(samp_rate, 'hw:3,0', True)
8192
self.audio_sink_0 = audio.sink(samp_rate, 'hw:3,0', True)
8293
self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, tx_rx_mix_freq, 1, 0, 0)
@@ -90,10 +101,11 @@ def __init__(self, message_str='TEST', mult_amp=0.5, tx_cr=1, tx_rx_bw=8000, tx_
90101
self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
91102
self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 0))
92103
self.connect((self.audio_source_0, 0), (self.blocks_float_to_complex_0, 0))
104+
self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
93105
self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0))
94106
self.connect((self.blocks_complex_to_float_1, 0), (self.blocks_wavfile_sink_0, 0))
95107
self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_complex_to_float_0, 0))
96-
self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0))
108+
self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0))
97109
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_conjugate_cc_0, 0))
98110
self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_1, 0))
99111
self.connect((self.blocks_multiply_xx_0, 0), (self.lora_rx_0, 0))
@@ -126,6 +138,7 @@ def get_tx_rx_bw(self):
126138

127139
def set_tx_rx_bw(self, tx_rx_bw):
128140
self.tx_rx_bw = tx_rx_bw
141+
self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, (self.tx_rx_mix_freq - (self.tx_rx_bw /2) - 1000), (self.tx_rx_mix_freq + (self.tx_rx_bw /2) + 1000), 1000, window.WIN_HAMMING, 6.76))
129142

130143
def get_tx_rx_mix_freq(self):
131144
return self.tx_rx_mix_freq
@@ -134,6 +147,7 @@ def set_tx_rx_mix_freq(self, tx_rx_mix_freq):
134147
self.tx_rx_mix_freq = tx_rx_mix_freq
135148
self.analog_sig_source_x_0.set_frequency((-self.tx_rx_mix_freq))
136149
self.analog_sig_source_x_0_0.set_frequency(self.tx_rx_mix_freq)
150+
self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, (self.tx_rx_mix_freq - (self.tx_rx_bw /2) - 1000), (self.tx_rx_mix_freq + (self.tx_rx_bw /2) + 1000), 1000, window.WIN_HAMMING, 6.76))
137151

138152
def get_tx_rx_sf(self):
139153
return self.tx_rx_sf
@@ -162,6 +176,7 @@ def set_samp_rate(self, samp_rate):
162176
self.samp_rate = samp_rate
163177
self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
164178
self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
179+
self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, (self.tx_rx_mix_freq - (self.tx_rx_bw /2) - 1000), (self.tx_rx_mix_freq + (self.tx_rx_bw /2) + 1000), 1000, window.WIN_HAMMING, 6.76))
165180

166181

167182

tup_rdo.grc

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ blocks:
8888
bus_sink: false
8989
bus_source: false
9090
bus_structure: null
91-
coordinate: [336, 176.0]
91+
coordinate: [336, 192.0]
9292
rotation: 0
9393
state: true
9494
- name: audio_sink_0
@@ -124,7 +124,32 @@ blocks:
124124
bus_sink: false
125125
bus_source: false
126126
bus_structure: null
127-
coordinate: [232, 696.0]
127+
coordinate: [152, 696.0]
128+
rotation: 0
129+
state: enabled
130+
- name: band_pass_filter_0
131+
id: band_pass_filter
132+
parameters:
133+
affinity: ''
134+
alias: ''
135+
beta: '6.76'
136+
comment: ''
137+
decim: '1'
138+
gain: '1'
139+
high_cutoff_freq: tx_rx_mix_freq + (tx_rx_bw /2) + 1000
140+
interp: '1'
141+
low_cutoff_freq: tx_rx_mix_freq - (tx_rx_bw /2) - 1000
142+
maxoutbuf: '0'
143+
minoutbuf: '0'
144+
samp_rate: samp_rate
145+
type: fir_filter_ccf
146+
width: '1000'
147+
win: window.WIN_HAMMING
148+
states:
149+
bus_sink: false
150+
bus_source: false
151+
bus_structure: null
152+
coordinate: [552, 548.0]
128153
rotation: 0
129154
state: enabled
130155
- name: blocks_complex_to_float_0
@@ -171,7 +196,7 @@ blocks:
171196
bus_sink: false
172197
bus_source: false
173198
bus_structure: null
174-
coordinate: [712, 640.0]
199+
coordinate: [736, 624.0]
175200
rotation: 0
176201
state: enabled
177202
- name: blocks_float_to_complex_0
@@ -187,7 +212,7 @@ blocks:
187212
bus_sink: false
188213
bus_source: false
189214
bus_structure: null
190-
coordinate: [488, 664.0]
215+
coordinate: [392, 664.0]
191216
rotation: 0
192217
state: enabled
193218
- name: blocks_message_strobe_0
@@ -490,10 +515,11 @@ connections:
490515
- [analog_sig_source_x_0, '0', blocks_multiply_xx_0, '1']
491516
- [analog_sig_source_x_0_0, '0', blocks_multiply_xx_0_0, '0']
492517
- [audio_source_0, '0', blocks_float_to_complex_0, '0']
518+
- [band_pass_filter_0, '0', blocks_conjugate_cc_0, '0']
493519
- [blocks_complex_to_float_0, '0', audio_sink_0, '0']
494520
- [blocks_complex_to_float_0_0, '0', blocks_wavfile_sink_0, '0']
495521
- [blocks_conjugate_cc_0, '0', blocks_multiply_xx_0, '0']
496-
- [blocks_float_to_complex_0, '0', blocks_conjugate_cc_0, '0']
522+
- [blocks_float_to_complex_0, '0', band_pass_filter_0, '0']
497523
- [blocks_message_strobe_0, strobe, lora_sdr_payload_id_inc_0, msg_in]
498524
- [blocks_message_strobe_0, strobe, lora_tx_0, in]
499525
- [blocks_multiply_const_vxx_0, '0', blocks_complex_to_float_0, '0']

tup_rdo.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
from gnuradio import audio
1414
from gnuradio import blocks
1515
import pmt
16-
from gnuradio import gr
16+
from gnuradio import filter
1717
from gnuradio.filter import firdes
18+
from gnuradio import gr
1819
from gnuradio.fft import window
1920
import sys
2021
import signal
@@ -77,6 +78,16 @@ def __init__(self, message_str='TEST', mult_amp=0.5, tx_cr=1, tx_rx_bw=8000, tx_
7778
self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
7879
self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1)
7980
self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
81+
self.band_pass_filter_0 = filter.fir_filter_ccf(
82+
1,
83+
firdes.band_pass(
84+
1,
85+
samp_rate,
86+
(tx_rx_mix_freq - (tx_rx_bw /2) - 1000),
87+
(tx_rx_mix_freq + (tx_rx_bw /2) + 1000),
88+
1000,
89+
window.WIN_HAMMING,
90+
6.76))
8091
self.audio_source_0 = audio.source(samp_rate, 'hw:3,0', True)
8192
self.audio_sink_0 = audio.sink(samp_rate, 'hw:3,0', True)
8293
self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, tx_rx_mix_freq, 1, 0, 0)
@@ -90,10 +101,11 @@ def __init__(self, message_str='TEST', mult_amp=0.5, tx_cr=1, tx_rx_bw=8000, tx_
90101
self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
91102
self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 0))
92103
self.connect((self.audio_source_0, 0), (self.blocks_float_to_complex_0, 0))
104+
self.connect((self.band_pass_filter_0, 0), (self.blocks_conjugate_cc_0, 0))
93105
self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0))
94106
self.connect((self.blocks_complex_to_float_0_0, 0), (self.blocks_wavfile_sink_0, 0))
95107
self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 0))
96-
self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_conjugate_cc_0, 0))
108+
self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0))
97109
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_complex_to_float_0, 0))
98110
self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_0_0, 0))
99111
self.connect((self.blocks_multiply_xx_0, 0), (self.lora_rx_0, 0))
@@ -126,6 +138,7 @@ def get_tx_rx_bw(self):
126138

127139
def set_tx_rx_bw(self, tx_rx_bw):
128140
self.tx_rx_bw = tx_rx_bw
141+
self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, (self.tx_rx_mix_freq - (self.tx_rx_bw /2) - 1000), (self.tx_rx_mix_freq + (self.tx_rx_bw /2) + 1000), 1000, window.WIN_HAMMING, 6.76))
129142

130143
def get_tx_rx_mix_freq(self):
131144
return self.tx_rx_mix_freq
@@ -134,6 +147,7 @@ def set_tx_rx_mix_freq(self, tx_rx_mix_freq):
134147
self.tx_rx_mix_freq = tx_rx_mix_freq
135148
self.analog_sig_source_x_0.set_frequency((-self.tx_rx_mix_freq))
136149
self.analog_sig_source_x_0_0.set_frequency(self.tx_rx_mix_freq)
150+
self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, (self.tx_rx_mix_freq - (self.tx_rx_bw /2) - 1000), (self.tx_rx_mix_freq + (self.tx_rx_bw /2) + 1000), 1000, window.WIN_HAMMING, 6.76))
137151

138152
def get_tx_rx_sf(self):
139153
return self.tx_rx_sf
@@ -162,6 +176,7 @@ def set_samp_rate(self, samp_rate):
162176
self.samp_rate = samp_rate
163177
self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
164178
self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
179+
self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, (self.tx_rx_mix_freq - (self.tx_rx_bw /2) - 1000), (self.tx_rx_mix_freq + (self.tx_rx_bw /2) + 1000), 1000, window.WIN_HAMMING, 6.76))
165180

166181

167182

0 commit comments

Comments
 (0)