When using gr-osmosdr with an xtrx board
Executing: /usr/bin/python3 -u /home/gwe/sources/nop.py
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/osmosdr/osmosdr_swig.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
File "<frozen importlib._bootstrap>", line 583, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1043, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /usr/lib/libgnuradio-osmosdr.so.0.2.0: undefined symbol: xtrx_tune_rx_bandwidth
libgnuradio-osmosdr has no references to libxtrx*.so*:
$ ldd /usr/lib/libgnuradio-osmosdr.so.0.2.0.0 | grep xtrx
$
After adding the mandatory library in CMakeLists.txt, flowgraph start
correctly:
Executing: /usr/bin/python3 -u /home/gwe/sources/nop.py
CPU Features: SSE2+ SSE4.1+ AVX- FMA-
Using sse2 for xtrxdsp_iq16_sc32
Using sse2 for xtrxdsp_iq8_ic16
Using sse2 for xtrxdsp_iq16_ic16i
Using sse2 for xtrxdsp_iq8_ic8i
Using sse2 for xtrxdsp_sc32i_iq16
Using sse2 for xtrxdsp_iq8_sc32
Using sse2 for xtrxdsp_iq8_sc32i
Using sse2 for xtrxdsp_iq16_sc32i
Using sse2 for xtrxdsp_sc32_iq16
Using sse2 for xtrxdsp_iq8_ic16i
Using sse2 for xtrxdsp_ic16i_iq16
gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.8.2.0
built-in source types: file xtrx
xtrx
xtrx_obj::xtrx_obj = 4
And the libgnuradio-osmosdr is correctly linked to libxtrx*.so*
$ ldd /usr/lib/libgnuradio-osmosdr.so.0.2.0.0 | grep xtrx
libxtrx.so.0 => /usr/local/lib/libxtrx.so.0 (0x00007f0cf7188000)
libxtrxll.so.0 => /usr/local/lib/libxtrxll.so.0 (0x00007f0cf6535000)
libxtrxdsp.so.0 => /usr/local/lib/libxtrxdsp.so.0 (0x00007f0cf6526000)
$
Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou(a)trabucayre.com>
---
lib/xtrx/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/xtrx/CMakeLists.txt b/lib/xtrx/CMakeLists.txt
index 9297bf0..7f31829 100644
--- a/lib/xtrx/CMakeLists.txt
+++ b/lib/xtrx/CMakeLists.txt
@@ -26,6 +26,10 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBXTRX_INCLUDE_DIRS}
)
+APPEND_LIB_LIST(
+ ${LIBXTRX_LIBRARIES}
+)
+
list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/xtrx_obj.cc
${CMAKE_CURRENT_SOURCE_DIR}/xtrx_source_c.cc
--
2.26.2
From: Clayton Smith <argilo(a)gmail.com>
The T/R switching code added in ae2253c516bfdc9ae4575ecd61fe0e6cd8608a0d
fails to set custom filter bandwidths because it sets bandwidth and
sample rate in the wrong order. As noted in the documentation for
hackrf_set_sample_rate: "If you want to override the baseband filter
selection, you must do so after setting the sample rate."
To solve this problem I moved the set_bandwidth call after
set_sample_rate. It was also necessary to skip the call if a custom
bandwidth was not requested.
---
lib/hackrf/hackrf_common.cc | 5 ++++-
lib/hackrf/hackrf_common.h | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/hackrf/hackrf_common.cc b/lib/hackrf/hackrf_common.cc
index a6de22aab6..666dc60f84 100644
--- a/lib/hackrf/hackrf_common.cc
+++ b/lib/hackrf/hackrf_common.cc
@@ -37,6 +37,7 @@ hackrf_common::hackrf_common(const std::string &args) :
_center_freq(0),
_freq_corr(0),
_auto_gain(false),
+ _requested_bandwidth(0),
_bandwidth(0),
_bias(false),
_started(false)
@@ -339,6 +340,7 @@ double hackrf_common::set_bandwidth( double bandwidth, size_t chan )
int ret;
// osmosdr::freq_range_t bandwidths = get_bandwidth_range( chan );
+ _requested_bandwidth = bandwidth;
if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */
bandwidth = _sample_rate * 0.75; /* select narrower filters to prevent aliasing */
@@ -411,9 +413,10 @@ bool hackrf_common::get_bias()
void hackrf_common::start()
{
_started = true;
- set_bandwidth(get_bandwidth());
set_center_freq(get_center_freq());
set_sample_rate(get_sample_rate());
+ if (_requested_bandwidth != 0)
+ set_bandwidth(get_bandwidth());
set_gain(get_gain());
set_bias(get_bias());
}
diff --git a/lib/hackrf/hackrf_common.h b/lib/hackrf/hackrf_common.h
index bb553c3bc6..d1ab47b6fb 100644
--- a/lib/hackrf/hackrf_common.h
+++ b/lib/hackrf/hackrf_common.h
@@ -104,6 +104,7 @@ private:
double _freq_corr;
bool _auto_gain;
double _amp_gain;
+ double _requested_bandwidth;
double _bandwidth;
bool _bias;
bool _started;
--
2.25.1