mirror of https://github.com/PentHertz/srsLTE.git
Fixed master clock rate for 15 Mhz BW.
This commit is contained in:
parent
2b34a3cb10
commit
67a5e0f0f1
|
@ -40,10 +40,7 @@
|
|||
#include "srslte/cuhd/cuhd.h"
|
||||
#include "srslte/cuhd/cuhd_utils.h"
|
||||
|
||||
#define B210_DEFAULT_GAIN 40.0
|
||||
#define B210_DEFAULT_GAIN_CORREC 110.0 // Gain of the Rx chain when the gain is set to 40
|
||||
|
||||
float gain_offset = B210_DEFAULT_GAIN_CORREC;
|
||||
#define B210_DEFAULT_GAIN_CORREC 100.0
|
||||
|
||||
cell_search_cfg_t cell_detect_config = {
|
||||
5000, // maximum number of frames to receive for MIB decoding
|
||||
|
@ -69,7 +66,7 @@ void args_default(prog_args_t *args) {
|
|||
args->force_N_id_2 = -1; // Pick the best
|
||||
args->uhd_args = "";
|
||||
args->uhd_freq = -1.0;
|
||||
args->uhd_gain = B210_DEFAULT_GAIN;
|
||||
args->uhd_gain = 50;
|
||||
}
|
||||
|
||||
void usage(prog_args_t *args, char *prog) {
|
||||
|
@ -188,6 +185,10 @@ int main(int argc, char **argv) {
|
|||
/* set sampling frequency */
|
||||
int srate = srslte_sampling_freq_hz(cell.nof_prb);
|
||||
if (srate != -1) {
|
||||
/* Modify master clock rate for 15 Mhz */
|
||||
if (cell.nof_prb == 75) {
|
||||
cuhd_set_master_clock_rate(uhd, 23.04e6);
|
||||
}
|
||||
cuhd_set_rx_srate(uhd, (double) srate);
|
||||
} else {
|
||||
fprintf(stderr, "Invalid number of PRB %d\n", cell.nof_prb);
|
||||
|
@ -279,7 +280,7 @@ int main(int argc, char **argv) {
|
|||
nof_trials++;
|
||||
} else {
|
||||
printf("Decoded SIB1. Payload: ");
|
||||
srslte_vec_fprint_hex(stdout, data, n);;
|
||||
srslte_vec_fprint_byte(stdout, data, n/8);;
|
||||
state = MEASURE;
|
||||
}
|
||||
}
|
||||
|
@ -293,15 +294,11 @@ int main(int argc, char **argv) {
|
|||
|
||||
srslte_chest_dl_estimate(&chest, sf_symbols, ce, srslte_ue_sync_get_sfidx(&ue_sync));
|
||||
|
||||
rssi = SRSLTE_VEC_CMA(srslte_vec_avg_power_cf(sf_buffer,SRSLTE_SF_LEN(srslte_symbol_sz(cell.nof_prb))),rssi,nframes);
|
||||
rssi_utra = SRSLTE_VEC_CMA(srslte_chest_dl_get_rssi(&chest),rssi_utra,nframes);
|
||||
rssi = SRSLTE_VEC_EMA(srslte_vec_avg_power_cf(sf_buffer,SRSLTE_SF_LEN(srslte_symbol_sz(cell.nof_prb))),rssi,0.05);
|
||||
rssi_utra = SRSLTE_VEC_EMA(srslte_chest_dl_get_rssi(&chest),rssi_utra,0.05);
|
||||
rsrq = SRSLTE_VEC_EMA(srslte_chest_dl_get_rsrq(&chest),rsrq,0.05);
|
||||
rsrp = SRSLTE_VEC_EMA(srslte_chest_dl_get_rsrp(&chest),rsrp,0.05);
|
||||
snr = SRSLTE_VEC_EMA(srslte_chest_dl_get_snr(&chest),snr,0.05);
|
||||
// Adjust with USRP gain
|
||||
rssi += cuhd_get_rx_gain(uhd);
|
||||
rssi_utra += cuhd_get_rx_gain(uhd);
|
||||
rsrp += cuhd_get_rx_gain(uhd);
|
||||
|
||||
nframes++;
|
||||
}
|
||||
|
@ -311,9 +308,9 @@ int main(int argc, char **argv) {
|
|||
printf("CFO: %+8.4f KHz, SFO: %+8.4f Khz, RSSI: %5.1f dBm, RSSI/ref-symbol: %+5.1f dBm, "
|
||||
"RSRP: %+5.1f dBm, RSRQ: %5.1f dB, SNR: %5.1f dB\r",
|
||||
srslte_ue_sync_get_cfo(&ue_sync)/1000, srslte_ue_sync_get_sfo(&ue_sync)/1000,
|
||||
10*log10(rssi*1000)-gain_offset,
|
||||
10*log10(rssi_utra*1000)-gain_offset,
|
||||
10*log10(rsrp*1000)-gain_offset,
|
||||
10*log10(rssi*1000) - cuhd_get_rx_gain(uhd),
|
||||
10*log10(rssi_utra*1000)- cuhd_get_rx_gain(uhd),
|
||||
10*log10(rsrp*1000)- cuhd_get_rx_gain(uhd),
|
||||
10*log10(rsrq), 10*log10(snr));
|
||||
if (srslte_verbose != SRSLTE_VERBOSE_NONE) {
|
||||
printf("\n");
|
||||
|
|
|
@ -323,6 +323,10 @@ int main(int argc, char **argv) {
|
|||
/* set sampling frequency */
|
||||
int srate = srslte_sampling_freq_hz(cell.nof_prb);
|
||||
if (srate != -1) {
|
||||
/* Modify master clock rate for 15 Mhz */
|
||||
if (cell.nof_prb == 75) {
|
||||
cuhd_set_master_clock_rate(uhd, 23.04e6);
|
||||
}
|
||||
cuhd_set_rx_srate(uhd, (double) srate);
|
||||
} else {
|
||||
fprintf(stderr, "Invalid number of PRB %d\n", cell.nof_prb);
|
||||
|
@ -408,15 +412,7 @@ int main(int argc, char **argv) {
|
|||
#endif
|
||||
|
||||
ue_sync.correct_cfo = !prog_args.disable_cfo;
|
||||
|
||||
/* Set high priority */
|
||||
struct sched_param param;
|
||||
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
||||
if (sched_setscheduler(pthread_self(), SCHED_FIFO, ¶m)) {
|
||||
perror("setscheduler");
|
||||
}
|
||||
|
||||
|
||||
|
||||
INFO("\nEntering main loop...\n\n", 0);
|
||||
/* Main loop */
|
||||
while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) {
|
||||
|
|
|
@ -344,6 +344,10 @@ cell.nof_ports = 1;
|
|||
/* set sampling frequency */
|
||||
int srate = srslte_sampling_freq_hz(cell.nof_prb);
|
||||
if (srate != -1) {
|
||||
/* Modify master clock rate for 15 Mhz */
|
||||
if (cell.nof_prb == 75) {
|
||||
cuhd_set_master_clock_rate(uhd, 23.04e6);
|
||||
}
|
||||
cuhd_set_rx_srate(uhd, (double) srate);
|
||||
cuhd_set_tx_srate(uhd, (double) srate);
|
||||
} else {
|
||||
|
|
|
@ -55,6 +55,9 @@ SRSLTE_API void cuhd_flush_buffer(void *h);
|
|||
|
||||
SRSLTE_API bool cuhd_rx_wait_lo_locked(void *h);
|
||||
|
||||
SRSLTE_API void cuhd_set_master_clock_rate(void *h,
|
||||
double rate);
|
||||
|
||||
SRSLTE_API double cuhd_set_rx_srate(void *h,
|
||||
double freq);
|
||||
|
||||
|
|
|
@ -220,6 +220,10 @@ int cuhd_close(void *h)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void cuhd_set_master_clock_rate(void *h, double rate) {
|
||||
cuhd_handler *handler = static_cast < cuhd_handler * >(h);
|
||||
handler->usrp->set_master_clock_rate(rate);
|
||||
}
|
||||
|
||||
double cuhd_set_rx_srate(void *h, double freq)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue