Radio and UHD fixes to avoid changing master clock rate and fixes X300 (#589)

* Fixes X300 MIMO

* Do not change sampling rate and calibrate time_adv_nsamples for b210
master
Ismael Gomez 5 years ago committed by GitHub
parent 9ee415ac82
commit 126f2efb5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -141,7 +141,7 @@ int main(int argc, char **argv) {
}
srate = srslte_rf_set_rx_srate(&rf, rf_rate);
if (srate != rf_rate) {
ERROR("Errror setting samplign frequency %.2f MHz\n", rf_rate * 1e-6);
ERROR("Error setting samplign frequency %.2f MHz\n", rf_rate * 1e-6);
exit(-1);
}
}

@ -413,8 +413,8 @@ int rf_uhd_open_multi(char *args, void **h, uint32_t nof_channels)
if (args[0]=='\0') {
if (find_string(devices_str, "type=b200") && !strstr(args, "recv_frame_size")) {
// If B200 is available, use it
args = "type=b200,master_clock_rate=30.72e6";
handler->current_master_clock = 30720000;
args = "type=b200,master_clock_rate=23.04e6";
handler->current_master_clock = 23040000;
handler->devname = DEVNAME_B200;
} else if (find_string(devices_str, "type=x300")) {
// Else if X300 is available, set master clock rate now (can't be changed later)
@ -454,9 +454,9 @@ int rf_uhd_open_multi(char *args, void **h, uint32_t nof_channels)
args = args2;
handler->devname = DEVNAME_E3X0;
} else {
snprintf(args2, sizeof(args2), "%s,master_clock_rate=30.72e6", args);
snprintf(args2, sizeof(args2), "%s,master_clock_rate=23.04e6", args);
args = args2;
handler->current_master_clock = 30720000;
handler->current_master_clock = 23040000;
handler->devname = DEVNAME_B200;
}
}
@ -655,8 +655,9 @@ double rf_uhd_set_rx_srate(void *h, double freq)
if (frac >= 1.0) { full++; frac -= 1.0; };
uhd_usrp_set_command_time(handler->usrp, full, frac, 0);
#endif /* UHD_SUPPORTS_COMMAND_TIME */
for (int i=0;i<handler->nof_rx_channels;i++)
for (int i = 0; i < handler->nof_rx_channels; i++) {
uhd_usrp_set_rx_rate(handler->usrp, freq, i);
}
#ifdef UHD_SUPPORTS_COMMAND_TIME
usleep(100000);
#endif /* UHD_SUPPORTS_COMMAND_TIME */
@ -670,15 +671,20 @@ double rf_uhd_set_tx_srate(void *h, double freq)
{
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
if (handler->nof_tx_channels > 1) {
#ifdef UHD_SUPPORTS_COMMAND_TIME
time_t full;
double frac;
uhd_usrp_get_time_now(handler->usrp, 0, &full, &frac);
frac += 0.100;
if (frac >= 1.0) { full++; frac -= 1.0; };
uhd_usrp_set_command_time(handler->usrp, full, frac, 0);
for (int i=0;i<handler->nof_tx_channels;i++)
#endif /* UHD_SUPPORTS_COMMAND_TIME */
for (int i = 0; i < handler->nof_tx_channels; i++) {
uhd_usrp_set_tx_rate(handler->usrp, freq, i);
}
#ifdef UHD_SUPPORTS_COMMAND_TIME
usleep(100000);
#endif /* UHD_SUPPORTS_COMMAND_TIME */
} else {
uhd_usrp_set_tx_rate(handler->usrp, freq, 0);
}

@ -286,11 +286,7 @@ void radio::set_master_clock_rate(double rate)
void radio::set_rx_srate(double srate)
{
if (srate < 10e6) {
set_master_clock_rate(4 * srate);
} else {
set_master_clock_rate(srate);
}
set_master_clock_rate(srate);
srslte_rf_set_rx_srate(&rf_device, srate);
}
@ -331,11 +327,7 @@ float radio::get_rx_gain()
void radio::set_tx_srate(double srate)
{
if (srate < 10e6) {
set_master_clock_rate(4 * srate);
} else {
set_master_clock_rate(srate);
}
set_master_clock_rate(srate);
cur_tx_srate = srslte_rf_set_tx_srate(&rf_device, srate);
burst_preamble_samples = (uint32_t) (cur_tx_srate * burst_preamble_sec);
if (burst_preamble_samples > burst_preamble_max_samples) {
@ -354,16 +346,16 @@ void radio::set_tx_srate(double srate)
double srate_khz = round(cur_tx_srate/1e3);
if (srate_khz == 1.92e3) {
// 6 PRB
nsamples = 94;
nsamples = 57;
} else if (srate_khz == 3.84e3) {
// 15 PRB
nsamples = 94;
nsamples = 60;
} else if (srate_khz == 5.76e3) {
// 25 PRB
nsamples = 92;
} else if (srate_khz == 11.52e3) {
// 50 PRB
nsamples = 167;
nsamples = 120;
} else if (srate_khz == 15.36e3) {
// 75 PRB
nsamples = 160;

Loading…
Cancel
Save