Commit 580722b5 authored by luis_pereira87's avatar luis_pereira87

Perform 2 Step frequency adjustment in the USRP and reset frequency offset...

Perform 2 Step frequency adjustment in the USRP and reset frequency offset after changing the RF card frequency
parent a0b87123
......@@ -450,25 +450,43 @@ static void UE_synch(void *arg) {
// rerun with new cell parameters and frequency-offset
// todo: the freq_offset computed on DL shall be scaled before being applied to UL
nr_rf_card_config_freq(&openair0_cfg[UE->rf_map.card], ul_carrier, dl_carrier, freq_offset);
nr_rf_card_config_freq(&openair0_cfg[UE->rf_map.card],
(uint64_t)openair0_cfg[UE->rf_map.card].tx_freq[0],
(uint64_t)openair0_cfg[UE->rf_map.card].rx_freq[0],
freq_offset);
LOG_I(PHY,"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %f (DL %f Hz, UL %f Hz)\n",
LOG_I(PHY,
"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %f (DL %f Hz, UL %f Hz)\n",
hw_slot_offset,
freq_offset,
openair0_cfg[UE->rf_map.card].rx_gain[0],
openair0_cfg[UE->rf_map.card].rx_freq[0],
openair0_cfg[UE->rf_map.card].tx_freq[0]);
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0]);
if (UE->UE_scan_carrier == 1) {
UE->rfdevice.trx_set_freq_func(&UE->rfdevice, &openair0_cfg[0]);
LOG_A(PHY,
"Adjusting hardware frequency offset to %d Hz (computed SSB offset %d Hz)\n",
(int)((double)dl_carrier - openair0_cfg[UE->rf_map.card].rx_freq[0]),
UE->common_vars.freq_offset);
if (abs(UE->common_vars.freq_offset) > abs(UE->frame_parms.subcarrier_spacing / 100)) {
LOG_W(PHY,
"Computed SSB offset %d Hz > %d Hz, resynchronizing again...\n",
UE->common_vars.freq_offset,
(UE->frame_parms.subcarrier_spacing / 100));
// Reset frequency offset after applying new frequency with nr_rf_card_config_freq
UE->common_vars.freq_offset = 0;
return;
}
// Reset frequency offset after applying new frequency with nr_rf_card_config_freq
UE->common_vars.freq_offset = 0;
if (UE->UE_scan_carrier == 1)
UE->UE_scan_carrier = 0;
} else {
else
UE->is_synchronized = 1;
}
if (UE->synch_request.received_synch_request == 1) {
UE->is_synchronized = 0;
UE->synch_request.received_synch_request = 0;
}
} else {
if (UE->UE_scan_carrier == 1) {
......@@ -602,6 +620,8 @@ nr_phy_data_t UE_dl_preprocessing(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc)
UE->frame_parms.ul_CarrierFreq = dl_CarrierFreq - diff;
nr_rf_card_config_freq(&openair0_cfg[UE->rf_map.card], UE->frame_parms.ul_CarrierFreq, UE->frame_parms.dl_CarrierFreq, 0);
// Reset frequency offset
UE->common_vars.freq_offset = 0;
UE->rfdevice.trx_set_freq_func(&UE->rfdevice, &openair0_cfg[0]);
init_symbol_rotation(&UE->frame_parms);
}
......
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