From ae8319dbb683130572155cc8597afadafb941551 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 3 Dec 2025 01:45:53 +0000 Subject: [PATCH] phy: add warning when choosing higher 3/4 sampling --- common/utils/nr/nr_common.c | 2 ++ common/utils/nr/nr_common.h | 14 ++++++++++++++ openair1/PHY/INIT/nr_parms.c | 22 +++++++++++++++++----- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index a842f66443..64902c6be2 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -874,6 +874,7 @@ void get_samplerate_and_bw(int mu, switch(n_rb) { case 270: if (threequarter_fs) { + warn_higher_threequarter_fs(n_rb, mu); *sample_rate=92.16e6; *samples_per_frame = 921600; *tx_bw = 50e6; @@ -973,6 +974,7 @@ void get_samplerate_and_bw(int mu, case 273: if (threequarter_fs) { + warn_higher_threequarter_fs(n_rb, mu); *sample_rate=184.32e6; *samples_per_frame = 1843200; *tx_bw = 100e6; diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 52eb305824..84de7805ec 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -37,6 +37,7 @@ #include #include "assertions.h" #include "common/utils/utils.h" +#include "common/utils/LOG/log.h" #define MAX_SI_GROUPS 3 #define NR_MAX_PDSCH_TBS 3824 @@ -272,6 +273,19 @@ static __attribute__((always_inline)) inline int count_bits64_with_mask(uint64_t return count_bits64(v & mask); } +static inline void warn_higher_threequarter_fs(const int n_rb, const int mu) +{ + LOG_W(PHY, + "3/4 sampling is not possible for current PRB size: %d and numerology: %d.\n " + "So 6/4 sampling is chosen to support x3xx type USRPs.\n " + "Note that this sampling rate increases fronthaul traffic, FFT buffer size and processing time by a factor of two compared " + "to 3/4 sampling rate.\n " + "Some PRACH configuration might not be supported with 6/4 FFT size.\n " + "Consider reducing the PRB size that would fit within the FFT size of 3/4 sampling\n", + n_rb, + mu); +} + uint64_t reverse_bits(uint64_t in, int n_bits); void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out); diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 880d568ca6..6fbfcb3cac 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -199,14 +199,26 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL) AssertFatal(1==0,"Invalid numerology index %d", mu); } - if(fp->threequarter_fs) - fp->ofdm_symbol_size = 3 * 128; - else - fp->ofdm_symbol_size = 4 * 128; + // Start with FFT size 512 + fp->ofdm_symbol_size = 512; - while(fp->ofdm_symbol_size < N_RB_DL * 12) + // Choose the right FFT size for the BW + while(fp->ofdm_symbol_size < N_RB_DL * NR_NB_SC_PER_RB) fp->ofdm_symbol_size <<= 1; + // Do 3/4 sampling + if (fp->threequarter_fs) { + const uint16_t threeq_fft_size = fp->ofdm_symbol_size * 3 / 4; + if (threeq_fft_size < (N_RB_DL * NR_NB_SC_PER_RB)) { + // 3/4 sampling FFT size not enough + warn_higher_threequarter_fs(N_RB_DL, fp->numerology_index); + // Choose 2 times 3/4 sampling + fp->ofdm_symbol_size = threeq_fft_size << 1; + } else { + fp->ofdm_symbol_size = threeq_fft_size; + } + } + fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2); fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9; fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu));