From 80f90b55991d1e9c9e8b8f7c20265d24ddd34372 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Fri, 13 Sep 2024 14:03:18 +0200 Subject: [PATCH] Add time domain sample scope before sync Added new data sync for UE which displays time domain samples read from RF device before synchronization to PSS/SSS --- executables/nr-ue.c | 6 ++++-- openair1/PHY/TOOLS/imscope/imscope.cpp | 10 ++++++++++ openair1/PHY/TOOLS/phy_scope_interface.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 16fef82eea..d4c3b964fd 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -707,8 +707,10 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) + 4 * ((x * fp->samples_per_subframe) + fp->get_samples_slot_timestamp(slot, fp, 0)); } - int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, timestamp, rxp, fp->get_samples_per_slot(slot, fp), fp->nb_antennas_rx); - AssertFatal(fp->get_samples_per_slot(slot, fp) == tmp, ""); + int read_block_size = fp->get_samples_per_slot(slot, fp); + int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, timestamp, rxp, read_block_size, fp->nb_antennas_rx); + UEscopeCopy(UE, ueTimeDomainSamplesBeforeSync, rxp[0], sizeof(c16_t), 1, read_block_size, 0); + AssertFatal(read_block_size == tmp, ""); if (IS_SOFTMODEM_RFSIM) dummyWrite(UE, *timestamp, fp->get_samples_per_slot(slot, fp)); diff --git a/openair1/PHY/TOOLS/imscope/imscope.cpp b/openair1/PHY/TOOLS/imscope/imscope.cpp index bba22402a3..de555332bc 100644 --- a/openair1/PHY/TOOLS/imscope/imscope.cpp +++ b/openair1/PHY/TOOLS/imscope/imscope.cpp @@ -499,6 +499,16 @@ void ShowUeScope(PHY_VARS_NR_UE *ue, float t) time_domain_iq->Draw(iq_data, t, new_data); ImGui::TreePop(); } + if (ImGui::TreeNode("Time domain samples - before sync")) { + static auto iq_data = new IQData(); + static auto time_domain_iq = new IQHist("Time domain samples - before sync"); + bool new_data = false; + if (time_domain_iq->ShouldReadData()) { + new_data = iq_data->TryCollect(&scope_array[ueTimeDomainSamplesBeforeSync], t, time_domain_iq->GetEpsilon()); + } + time_domain_iq->Draw(iq_data, t, new_data); + ImGui::TreePop(); + } if (ImGui::TreeNode("Broadcast channel")) { ImGui::Text("RSRP %d", ue->measurements.ssb_rsrp_dBm[ue->frame_parms.ssb_index]); if (ImGui::TreeNode("IQ")) { diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index 2d648faa90..5602ed40de 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -74,6 +74,7 @@ enum scopeDataType { gNBPuschRxIq = MAX_SCOPE_TYPES, gNBPuschLlr, ueTimeDomainSamples, + ueTimeDomainSamplesBeforeSync, EXTRA_SCOPE_TYPES };