Commit e97130c1 authored by luis_pereira87's avatar luis_pereira87

Improve USRP tx_sample_advance to get preamble delay closer to 0

Currently, in *develop* branch, when running gNB with COTS UE, the preamble delay is never 0 when UE is very close to gNB. This MR provides more accurate values to get preamble delay 0 when UE is at 1 meter of gNB for several USRP models and sampling rates. The values here were obtained by experimentation and UHD 4.4.0.0
parent 2b796874
...@@ -1011,6 +1011,50 @@ int trx_usrp_reset_stats(openair0_device *device) { ...@@ -1011,6 +1011,50 @@ int trx_usrp_reset_stats(openair0_device *device) {
return(0); return(0);
} }
int get_tx_sample_advance(dev_type_t device_type, int sampling_rate)
{
switch (device_type) {
case USRP_B200_DEV:
switch (sampling_rate) {
case 46080000: // 40 MHz 30 kHz SCS 3/4 sampling rate
return 164;
case 30720000: // 20 MHz 30 kHz SCS
return 186;
default:
return -1;
}
break;
case USRP_N300_DEV:
switch (sampling_rate) {
case 122880000: // 100/80 MHz 30 kHz SCS
return 200;
case 61440000: // 60/40 MHz 30 kHz SCS
return 120;
case 30720000: // 20 MHz 30 kHz SCS
return 96;
default:
return -1;
}
break;
case USRP_X400_DEV:
switch (sampling_rate) {
case 122880000: // 100/80 MHz 30 kHz SCS
return 164;
case 61440000: // 60/40 MHz 30 kHz SCS
return 100;
case 30720000: // 20 MHz 30 kHz SCS
return 90;
default:
return -1;
}
break;
default:
return -1;
}
return -1;
}
extern "C" { extern "C" {
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
LOG_I(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs); LOG_I(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs);
...@@ -1368,6 +1412,14 @@ extern "C" { ...@@ -1368,6 +1412,14 @@ extern "C" {
} }
} }
int tx_sample_advance = get_tx_sample_advance(device->type, (int)openair0_cfg[0].sample_rate);
if (tx_sample_advance >= 0) {
openair0_cfg[0].tx_sample_advance = tx_sample_advance;
LOG_I(HW, "Applying USRP tx_sample_advance: %d\n", tx_sample_advance);
} else {
LOG_W(HW, "A calibration for USRP tx_sample_advance may be required! Applying default tx_sample_advance: %d\n", openair0_cfg[0].tx_sample_advance);
}
/* device specific */ /* device specific */
//openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered //openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered
//openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered //openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment