aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/device/lms/LMSDevice.cpp
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-04-28 21:38:58 +0200
committerHarald Welte <laforge@gnumonks.org>2018-06-13 21:45:32 +0000
commit9cb4f271127ea4ef428e873a7f76bc02919e3217 (patch)
tree5cea8113b183975c4eea054fcc4cf5ab0abaf99c /Transceiver52M/device/lms/LMSDevice.cpp
parentc38e45e9dc55745193a1a4e63c7cc7e68536f6b4 (diff)
LMSDevice: Call LMS_Init() before setting sample rate
LMS_Init() will override basically all device settings with their default value, including the sample rate. We hence have to make sure to call it before any other API function that changes the device config such as sample rate, frequency, filter bandwidth, ... Change-Id: I4cdbae8406b5e1e93da491e90f8bad41d4be748b
Diffstat (limited to 'Transceiver52M/device/lms/LMSDevice.cpp')
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 603b23d..0442e27 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -112,6 +112,12 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
delete [] info_list;
+ LOG(INFO) << "Init LMS device";
+ if (LMS_Init(m_lms_dev) != 0) {
+ LOG(ERROR) << "LMS_Init() failed";
+ return -1;
+ }
+
LOG(DEBUG) << "Setting sample rate to " << GSMRATE*sps << " " << sps;
if (LMS_SetSampleRate(m_lms_dev, GSMRATE*sps, 32) < 0)
goto out_close;
@@ -139,10 +145,6 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
goto out_close;
}
- LOG(INFO) << "Init LMS device";
- if (LMS_Init(m_lms_dev) < 0)
- goto out_close;
-
/* Perform Rx and Tx calibration */
for (i=0; i<chans; i++) {
LOG(INFO) << "Calibrating chan " << i;