From 8e814003296b5b217d0ed18ff8d71cd52df3e23e Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 23 Aug 2017 15:34:40 +0200 Subject: [PATCH 1/5] Solved bug: UE DL was not getting into TxDiversity on DCI formats 1 and 1A --- lib/src/phy/ue/ue_dl.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index c9a5dea1a..26dc0b908 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -379,7 +379,11 @@ int srslte_ue_dl_decode_rnti_multi(srslte_ue_dl_t *q, cf_t *input[SRSLTE_MAX_POR switch(dci_msg.format) { case SRSLTE_DCI_FORMAT1: case SRSLTE_DCI_FORMAT1A: - mimo_type = SRSLTE_MIMO_TYPE_SINGLE_ANTENNA; + if (q->cell.nof_ports == 1) { + mimo_type = SRSLTE_MIMO_TYPE_SINGLE_ANTENNA; + } else { + mimo_type = SRSLTE_MIMO_TYPE_TX_DIVERSITY; + } break; case SRSLTE_DCI_FORMAT2: if (grant.nof_tb == 1 && dci_unpacked.pinfo == 0) { @@ -456,7 +460,10 @@ int srslte_ue_dl_ri_pmi_select(srslte_ue_dl_t *q, uint32_t *ri, uint32_t *pmi, f float best_sinr = -INFINITY; uint32_t best_pmi = 0, best_ri = 0; - if (q->cell.nof_ports == 2 && q->nof_rx_antennas == 2) { + if (q->cell.nof_ports < 2 || q->nof_rx_antennas < 2) { + /* Do nothing */ + return SRSLTE_SUCCESS; + } else if (q->cell.nof_ports == 2 && q->nof_rx_antennas == 2) { if (srslte_pdsch_pmi_select(&q->pdsch, &q->pdsch_cfg, q->ce_m, noise_estimate, SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp), q->pmi, q->sinr)) { ERROR("SINR calculation error"); @@ -489,7 +496,7 @@ int srslte_ue_dl_ri_pmi_select(srslte_ue_dl_t *q, uint32_t *ri, uint32_t *pmi, f } else if (q->pdsch_cfg.nof_layers == 2) { *current_sinr = q->sinr[1][q->pdsch_cfg.codebook_idx - 1]; } else { - ERROR("Not implemented number of layers"); + ERROR("Not implemented number of layers (%d)", q->pdsch_cfg.nof_layers); return SRSLTE_ERROR; } } From 02a4bb6bddca224d5d17c6eb606e5e24d208ac8e Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 23 Aug 2017 15:35:48 +0200 Subject: [PATCH 2/5] Improved PDSCH UE debug --- lib/examples/pdsch_ue.c | 45 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c index 60cc0a4db..8c4d57484 100644 --- a/lib/examples/pdsch_ue.c +++ b/lib/examples/pdsch_ue.c @@ -101,6 +101,7 @@ typedef struct { int net_port_signal; char *net_address_signal; int decimate; + int verbose; }prog_args_t; void args_default(prog_args_t *args) { @@ -131,6 +132,7 @@ void args_default(prog_args_t *args) { args->net_address_signal = "127.0.0.1"; args->decimate = 0; args->cpu_affinity = -1; + args->verbose = 0; } void usage(prog_args_t *args, char *prog) { @@ -187,6 +189,8 @@ void parse_args(prog_args_t *args, int argc, char **argv) { break; case 'o': args->file_offset_freq = atof(argv[optind]); + argv++; + argc--; break; case 'O': args->file_offset_time = atoi(argv[optind]); @@ -240,7 +244,8 @@ void parse_args(prog_args_t *args, int argc, char **argv) { args->disable_plots_except_constellation = true; break; case 'v': - srslte_verbose++; + args->verbose++; + srslte_verbose = args->verbose; break; case 'Z': args->decimate = atoi(argv[optind]); @@ -392,8 +397,8 @@ int main(int argc, char **argv) { srslte_rf_set_master_clock_rate(&rf, 30.72e6); /* set receiver frequency */ - printf("Tunning receiver to %.3f MHz\n", prog_args.rf_freq/1000000); - srslte_rf_set_rx_freq(&rf, prog_args.rf_freq); + printf("Tunning receiver to %.3f MHz\n", (prog_args.rf_freq + prog_args.file_offset_freq)/1000000); + srslte_rf_set_rx_freq(&rf, prog_args.rf_freq + prog_args.file_offset_freq); srslte_rf_rx_wait_lo_locked(&rf); uint32_t ntrial=0; @@ -416,7 +421,7 @@ int main(int argc, char **argv) { srslte_rf_flush_buffer(&rf); /* set sampling frequency */ - int srate = srslte_sampling_freq_hz(cell.nof_prb); + int srate = srslte_sampling_freq_hz(cell.nof_prb)*(1 + prog_args.file_offset_freq/prog_args.rf_freq); if (srate != -1) { if (srate < 10e6) { srslte_rf_set_master_clock_rate(&rf, 4*srate); @@ -540,7 +545,27 @@ int main(int argc, char **argv) { INFO("\nEntering main loop...\n\n", 0); /* Main loop */ while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) { - + char input[128]; + + fd_set set; + FD_ZERO(&set); + FD_SET(0, &set); + + struct timeval to; + to.tv_sec = 0; + to.tv_usec = 0; + + /* Set default verbose level */ + srslte_verbose = prog_args.verbose; + int n = select(1, &set, NULL, NULL, &to); + if (n == 1) { + /* If a new line is detected set verbose level to Debug */ + if (fgets(input, sizeof(input), stdin)) { + srslte_verbose = SRSLTE_VERBOSE_DEBUG; + } + } + + ret = srslte_ue_sync_zerocopy_multi(&ue_sync, sf_buffer); if (ret < 0) { fprintf(stderr, "Error calling srslte_ue_sync_work()\n"); @@ -673,7 +698,9 @@ int main(int argc, char **argv) { printf("\033[K Rb: %6.2f / %6.2f Mbps (net/maximum)\n", uerate, enodebrate); printf("\033[K PDCCH-Miss: %5.2f%%\n", 100 * (1 - (float) ue_dl.nof_detected / nof_trials)); printf("\033[K PDSCH-BLER: %5.2f%%\n", (float) 100 * ue_dl.pkt_errors / ue_dl.pkts_total); - printf("\033[K PDSCH-BLER: %5.2f%%\n\n", (float) 100 * ue_dl.pkt_errors / ue_dl.pkts_total); + printf("\033[K PDSCH-BLER: %5.2f%%\n", (float) 100 * ue_dl.pkt_errors / ue_dl.pkts_total); + printf("\033[K TB 0: mcs=%d; tbs=%d\n", ue_dl.pdsch_cfg.grant.mcs[0].idx, ue_dl.pdsch_cfg.grant.mcs[0].tbs); + printf("\033[K TB 1: mcs=%d; tbs=%d\n", ue_dl.pdsch_cfg.grant.mcs[1].idx, ue_dl.pdsch_cfg.grant.mcs[1].tbs); printf("\033[K\n"); printf("\033[KSINR (dB) Vs RI and PMI:\n"); printf("\033[K | RI | 1 | 2 |\n"); @@ -683,7 +710,7 @@ int main(int argc, char **argv) { printf("\033[K I | 2 | %5.2f%c|-------+ \n", 10 * log10(sinr[0][2]), (ri == 1 && pmi == 2)?'*':' '); printf("\033[K | 3 | %5.2f%c| \n", 10 * log10(sinr[0][3]), (ri == 1 && pmi == 3)?'*':' '); printf("\033[K\n\n"); - printf("\033[20A"); + printf("\033[21A"); } } break; @@ -692,7 +719,7 @@ int main(int argc, char **argv) { sfn++; if (sfn == 1024) { sfn = 0; - printf("\033[20B"); + printf("\033[21B"); ue_dl.pkt_errors = 0; ue_dl.pkts_total = 0; ue_dl.nof_detected = 0; @@ -724,7 +751,7 @@ int main(int argc, char **argv) { sf_cnt++; } // Main loop - printf("\033[20B"); + printf("\033[21B\n"); #ifndef DISABLE_GRAPHICS if (!prog_args.disable_plots) { From ecaf84de5193f4f453c0ec5fafa27e55f4b03c1c Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 23 Aug 2017 15:30:13 +0200 Subject: [PATCH 3/5] pdsch_test can load MIMO files --- lib/src/phy/phch/test/pdsch_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/phy/phch/test/pdsch_test.c b/lib/src/phy/phch/test/pdsch_test.c index 777481d6a..41b05f229 100644 --- a/lib/src/phy/phch/test/pdsch_test.c +++ b/lib/src/phy/phch/test/pdsch_test.c @@ -317,7 +317,7 @@ int main(int argc, char **argv) { #ifdef DO_OFDM srslte_filesource_read(&fsrc, rx_slot_symbols, SRSLTE_SF_LEN_PRB(cell.nof_prb)); #else - srslte_filesource_read(&fsrc, rx_slot_symbols[0], SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp)); + srslte_filesource_read_multi(&fsrc, (void*) rx_slot_symbols, SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp), pdsch_cfg.nof_layers); #endif srslte_chest_dl_t chest; @@ -325,7 +325,7 @@ int main(int argc, char **argv) { fprintf(stderr, "Error initializing equalizer\n"); exit(-1); } - srslte_chest_dl_estimate(&chest, rx_slot_symbols[0], ce[0], subframe); + srslte_chest_dl_estimate_multi(&chest, rx_slot_symbols, ce, subframe, nof_rx_antennas); srslte_chest_dl_free(&chest); srslte_filesource_free(&fsrc); From a1060c067af960cab53b969170cfbdc51ad8f559 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 23 Aug 2017 15:35:48 +0200 Subject: [PATCH 5/5] Improved PDSCH UE debug (cherry picked from commit cef312c) --- lib/examples/pdsch_ue.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c index 8c4d57484..4b7a3f24b 100644 --- a/lib/examples/pdsch_ue.c +++ b/lib/examples/pdsch_ue.c @@ -318,7 +318,6 @@ int main(int argc, char **argv) { srslte_rf_t rf; #endif uint32_t nof_trials = 0; - int n; uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN]; int sfn_offset; float cfo = 0; @@ -690,7 +689,12 @@ int main(int argc, char **argv) { } /* Print Results */ - printf("\033[K Tx scheme: %-10s\n", srslte_mimotype2str(ue_dl.pdsch_cfg.mimo_type)); + if (ue_dl.pdsch_cfg.mimo_type == SRSLTE_MIMO_TYPE_SPATIAL_MULTIPLEX) { + printf("\033[K Tx scheme: %s (codebook_idx=%d)\n", srslte_mimotype2str(ue_dl.pdsch_cfg.mimo_type), + ue_dl.pdsch_cfg.codebook_idx); + } else { + printf("\033[K Tx scheme: %s\n", srslte_mimotype2str(ue_dl.pdsch_cfg.mimo_type)); + } printf("\033[K nof layers: %d \n", ue_dl.pdsch_cfg.nof_layers); printf("\033[Knof codewords: %d \n", ue_dl.pdsch_cfg.grant.nof_tb); printf("\033[K CFO: %+5.2f kHz\n", srslte_ue_sync_get_cfo(&ue_sync) / 1000); @@ -702,7 +706,7 @@ int main(int argc, char **argv) { printf("\033[K TB 0: mcs=%d; tbs=%d\n", ue_dl.pdsch_cfg.grant.mcs[0].idx, ue_dl.pdsch_cfg.grant.mcs[0].tbs); printf("\033[K TB 1: mcs=%d; tbs=%d\n", ue_dl.pdsch_cfg.grant.mcs[1].idx, ue_dl.pdsch_cfg.grant.mcs[1].tbs); printf("\033[K\n"); - printf("\033[KSINR (dB) Vs RI and PMI:\n"); + printf("\033[KSINR (dB) Vs RI and PMI (for TM4, close loop MIMO only):\n"); printf("\033[K | RI | 1 | 2 |\n"); printf("\033[K -------+-------+-------+\n"); printf("\033[K P | 0 | %5.2f%c| %5.2f%c|\n", 10 * log10(sinr[0][0]), (ri == 1 && pmi == 0)?'*':' ', 10 * log10(sinr[1][0]), (ri == 2 && pmi == 0)?'*':' ');