mirror of https://github.com/PentHertz/srsLTE.git
Fixed master clock rate with UHD driver 3.10
This commit is contained in:
parent
09c6077bc9
commit
efb331439e
|
@ -30,7 +30,6 @@
|
|||
#define MEXUTILS_
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef UNDEF_BOOL
|
||||
#undef bool
|
||||
|
@ -38,7 +37,9 @@
|
|||
|
||||
#include "mex.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "srslte/config.h"
|
||||
#include "srslte/common/phy_common.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <complex.h>
|
||||
#include "srslte/common/phy_common.h"
|
||||
#include "srslte/mex/mexutils.h"
|
||||
#include "srslte/utils/vector.h"
|
||||
|
||||
|
|
|
@ -305,6 +305,8 @@ int main(int argc, char **argv) {
|
|||
cell_detect_config.init_agc = 50;
|
||||
}
|
||||
|
||||
cuhd_set_master_clock_rate(uhd, 30.72e6);
|
||||
|
||||
/* set receiver frequency */
|
||||
cuhd_set_rx_freq_offset(uhd, (double) prog_args.uhd_freq, prog_args.uhd_freq_offset);
|
||||
cuhd_rx_wait_lo_locked(uhd);
|
||||
|
@ -323,17 +325,22 @@ int main(int argc, char **argv) {
|
|||
|
||||
/* set sampling frequency */
|
||||
int srate = srslte_sampling_freq_hz(cell.nof_prb);
|
||||
|
||||
if (srate != -1) {
|
||||
if (srate < 10e6) {
|
||||
if (srate < 10e6) {
|
||||
cuhd_set_master_clock_rate(uhd, 4*srate);
|
||||
} else {
|
||||
cuhd_set_master_clock_rate(uhd, srate);
|
||||
}
|
||||
printf("Setting Sampling frequency %.2f MHz\n", (float) srate/1000000);
|
||||
cuhd_set_rx_srate(uhd, (double) srate);
|
||||
printf("Setting sampling rate %.2f MHz\n", (float) srate/1000000);
|
||||
float srate_uhd = cuhd_set_rx_srate(uhd, (double) srate);
|
||||
if (srate_uhd != srate) {
|
||||
fprintf(stderr, "Could not set sampling rate\n");
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Invalid number of PRB %d\n", cell.nof_prb);
|
||||
return SRSLTE_ERROR;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
INFO("Stopping UHD and flushing buffer...\r",0);
|
||||
|
@ -384,8 +391,6 @@ int main(int argc, char **argv) {
|
|||
/* Initialize subframe counter */
|
||||
sf_cnt = 0;
|
||||
|
||||
// Register Ctrl+C handler
|
||||
signal(SIGINT, sig_int_handler);
|
||||
|
||||
#ifndef DISABLE_GRAPHICS
|
||||
if (!prog_args.disable_plots) {
|
||||
|
|
|
@ -188,7 +188,7 @@ int cuhd_open_(char *args, void **h, bool create_thread_gain, bool tx_gain_same_
|
|||
uhd::set_thread_priority_safe();
|
||||
cuhd_handler *handler = new cuhd_handler();
|
||||
std::string _args = std::string(args);
|
||||
handler->usrp = uhd::usrp::multi_usrp::make(_args + ", master_clock_rate=30720000, recv_frame_size=7696,num_recv_frames=64,send_frame_size=7696,num_send_frames=64");
|
||||
handler->usrp = uhd::usrp::multi_usrp::make(_args + ", recv_frame_size=7696,num_recv_frames=64,send_frame_size=7696,num_send_frames=64");
|
||||
handler->usrp->set_clock_source("internal");
|
||||
|
||||
std::string otw, cpu;
|
||||
|
@ -250,7 +250,7 @@ double cuhd_set_rx_srate(void *h, double freq)
|
|||
{
|
||||
cuhd_handler *handler = static_cast < cuhd_handler * >(h);
|
||||
handler->usrp->set_rx_rate(freq);
|
||||
return freq;
|
||||
return handler->usrp->get_rx_rate();
|
||||
}
|
||||
|
||||
double cuhd_set_rx_gain(void *h, double gain)
|
||||
|
|
Loading…
Reference in New Issue