ssb_file_test: make duplex and SSB SCS configurable, add new unit test for FDD+15kHz SCS

master
Andre Puschmann 3 years ago
parent 800933c38e
commit 573b2f657a

@ -164,4 +164,6 @@ target_link_libraries(ssb_file_test srsran_phy)
# File test 1
# Captured with command: lib/examples/usrp_capture -a type=x300,clock=external,sampling_rate=46.08e6,rx_subdev_spec=B:0 -g 20 -r 46.08e6 -n 460800 -f 3502.8e6 -o /tmp/n78.fo35028.fs2304M.data
add_nr_test(ssb_file_test ssb_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/n78.fo35028.fs4608M.data -v -r 46.08e6 -f 3502.8e6 -F 3512.64e6 -n 460800 -A 500 357802 2 0 1 0)
add_nr_test(ssb_file_test_tdd ssb_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/n78.fo35028.fs4608M.data -v -r 46.08e6 -f 3502.8e6 -F 3512.64e6 -n 460800 -A 500 357802 2 0 1 0)
# Capture with third-party gNB on band n3 (FDD) 15kHz SSB SCS, f_s=15.36e6, f_c=1842.5e6, f_c_ssb=1842.05e6, PCI=500
add_nr_test(ssb_file_test_fdd ssb_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/../../ue/test/ue_dl_nr_pci500_rb52_si_coreset0_idx6_s15.36e6.dat -v -r 15.36e6 -f 1842.5e6 -F 1842.05e6 -n 15360 -d fdd -s 15 -A 500 2200 0 0 0 0)

@ -29,7 +29,7 @@ static char* filename = NULL;
static double srate_hz = 23.04e6; // Base-band sampling rate in Hz
static double center_freq_hz = NAN; // Center frequency in Hz
static double ssb_freq_hz = NAN; // SSB frequency in Hz
static uint32_t nof_samples = 0; // Number of half-frames
static uint32_t nof_samples = 0; // Number of samples
// Assertion
static bool assert = false;
@ -44,9 +44,11 @@ static void usage(char* prog)
{
printf("Usage: %s -i filename [rv]\n", prog);
printf("\t-r sampling rate in Hz [Default %.2f MHz]\n", srate_hz / 1e6);
printf("\t-n number of samples [Default %d]\n", nof_samples);
printf("\t-s SSB subcarrier spacing (15, 30) [Default %s]\n", srsran_subcarrier_spacing_to_str(ssb_scs));
printf("\t-d duplex mode [Default %s]\n", duplex_mode == SRSRAN_DUPLEX_MODE_FDD ? "FDD" : "TDD");
printf("\t-f absolute baseband center frequency in Hz [Default %.2f MHz]\n", center_freq_hz / 1e3);
printf("\t-F absolute SSB center freuqency in Hz [Default %.2f MHz]\n", ssb_freq_hz / 1e3);
printf("\t-F absolute SSB center freuqency in Hz [Default %.2f MHz]\n", ssb_freq_hz / 1e3);
printf("\t-A Assert: PCI t_offset sfn_lsb ssb_idx ssb_k hrf");
printf("\t-v [set srsran_verbose to debug, default none]\n");
}
@ -54,7 +56,7 @@ static void usage(char* prog)
static void parse_args(int argc, char** argv)
{
int opt;
while ((opt = getopt(argc, argv, "inrfFAv")) != -1) {
while ((opt = getopt(argc, argv, "insdrfFAv")) != -1) {
switch (opt) {
case 'i':
filename = argv[optind];
@ -62,6 +64,24 @@ static void parse_args(int argc, char** argv)
case 'n':
nof_samples = (uint32_t)strtol(argv[optind], NULL, 10);
break;
case 's':
if ((uint32_t)strtol(argv[optind], NULL, 10) == 15) {
ssb_scs = srsran_subcarrier_spacing_15kHz;
} else {
ssb_scs = srsran_subcarrier_spacing_30kHz;
}
break;
case 'd':
if (strcmp(argv[optind], "tdd") == 0) {
duplex_mode = SRSRAN_DUPLEX_MODE_TDD;
} else if (strcmp(argv[optind], "fdd") == 0) {
duplex_mode = SRSRAN_DUPLEX_MODE_FDD;
} else {
printf("Invalid duplex mode '%s'\n", argv[optind]);
usage(argv[0]);
exit(-1);
}
break;
case 'r':
srate_hz = strtod(argv[optind], NULL);
break;
@ -195,6 +215,17 @@ int main(int argc, char** argv)
str,
search_res.pbch_msg.crc ? "OK" : "KO");
// unpack MIB
srsran_mib_nr_t mib = {};
if (srsran_pbch_msg_nr_mib_unpack(&search_res.pbch_msg, &mib) < SRSRAN_SUCCESS) {
ERROR("Error unpacking PBCH-MIB");
goto clean_exit;
}
char mib_info[512] = {};
srsran_pbch_msg_nr_mib_info(&mib, mib_info, sizeof(mib_info));
INFO("PBCH-MIB: %s", mib_info);
// Assert search
if (assert) {
if (assert_search(&search_res)) {

Loading…
Cancel
Save