From 93e98cd214c9b3a1990de6d5a014169655e2f15c Mon Sep 17 00:00:00 2001 From: ismagom Date: Fri, 5 Jun 2015 12:42:39 +0100 Subject: [PATCH] Added LO offset --- srsapps/radio/src/radio_uhd.cc | 3 ++- srslte/lib/cuhd/src/cuhd_imp.cpp | 2 +- srslte/lib/phch/test/prach_test_usrp.c | 22 +++++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/srsapps/radio/src/radio_uhd.cc b/srsapps/radio/src/radio_uhd.cc index a36e5d217..a22168ff6 100644 --- a/srsapps/radio/src/radio_uhd.cc +++ b/srsapps/radio/src/radio_uhd.cc @@ -116,7 +116,8 @@ void radio_uhd::set_rx_srate(float srate) void radio_uhd::set_tx_freq(float freq) { - cuhd_set_tx_freq(uhd, freq); + //cuhd_set_tx_freq(uhd, freq); + cuhd_set_tx_freq_offset(uhd, freq, 8e6); } void radio_uhd::set_tx_gain(float gain) diff --git a/srslte/lib/cuhd/src/cuhd_imp.cpp b/srslte/lib/cuhd/src/cuhd_imp.cpp index ba2809213..adf7bd708 100644 --- a/srslte/lib/cuhd/src/cuhd_imp.cpp +++ b/srslte/lib/cuhd/src/cuhd_imp.cpp @@ -162,7 +162,7 @@ int cuhd_open_(char *args, void **h, bool create_thread_gain, bool tx_gain_same_ { cuhd_handler *handler = new cuhd_handler(); std::string _args = std::string(args); - handler->usrp = uhd::usrp::multi_usrp::make(_args + ", master_clock_rate=30720000, num_recv_frames=512"); + handler->usrp = uhd::usrp::multi_usrp::make(_args);// + ", master_clock_rate=30720000, num_recv_frames=512"); // handler->usrp = uhd::usrp::multi_usrp::make(_args + ", master_clock_rate=50000000" + ", num_recv_frames=512"); handler->usrp->set_clock_source("internal"); diff --git a/srslte/lib/phch/test/prach_test_usrp.c b/srslte/lib/phch/test/prach_test_usrp.c index 28ce0b571..4ae74aad1 100644 --- a/srslte/lib/phch/test/prach_test_usrp.c +++ b/srslte/lib/phch/test/prach_test_usrp.c @@ -149,12 +149,12 @@ int main(int argc, char **argv) { } printf("Subframe len: %d samples\n", flen); printf("Set TX/RX rate: %.2f MHz\n", cuhd_set_rx_srate(uhd, srslte_sampling_freq_hz(nof_prb)) / 1000000); - printf("Set TX/RX gain: %.1f dB\n", cuhd_set_rx_gain(uhd, uhd_gain)); + printf("Set RX gain: %.1f dB\n", cuhd_set_rx_gain(uhd, uhd_gain)); + printf("Set TX gain: %.1f dB\n", cuhd_set_tx_gain(uhd, uhd_gain)); printf("Set TX/RX freq: %.2f MHz\n", cuhd_set_rx_freq(uhd, uhd_freq) / 1000000); cuhd_set_tx_srate(uhd, srslte_sampling_freq_hz(nof_prb)); - cuhd_set_tx_gain(uhd, uhd_gain); - cuhd_set_tx_freq(uhd, uhd_freq); - cuhd_rx_wait_lo_locked(uhd); + cuhd_set_tx_freq_offset(uhd, uhd_freq, 8e6); + sleep(1); cf_t *zeros = calloc(sizeof(cf_t),flen); @@ -167,21 +167,25 @@ int main(int argc, char **argv) { cuhd_start_rx_stream(uhd); uint32_t nframe=0; - + while(nframe