From ac092841dda32a11806158d9d62af3848d18f95a Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 13 Dec 2019 17:07:09 +0100 Subject: [PATCH 1/2] some updates on SSB and a couple of fixes on warnings --- openair1/PHY/NR_TRANSPORT/nr_dci.h | 4 ++++ openair1/SCHED_NR/fapi_nr_l1.c | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 5 ++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 19 ++++++++++--------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.h b/openair1/PHY/NR_TRANSPORT/nr_dci.h index ccebf3c82f..047139aa63 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.h @@ -46,6 +46,10 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, int frame, int slot); +void nr_fill_ul_dci(PHY_VARS_gNB *gNB, + int frame, + int slot); + void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m); void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset); diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 063b56564d..be4ab944db 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -44,7 +44,7 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot, AssertFatal(dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag== 1, "bchPayloadFlat %d != 1\n", dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag); - LOG_I(PHY,"%d.%d : pbch_pdu: %x\n",frame,slot,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex); + LOG_I(PHY,"%d.%d : pbch_pdu: %x\n",frame,slot,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload); gNB->ssb_pdu = &dl_tti_pdu->ssb_pdu; } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 9f3e5a1ef2..a4f8e64b03 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -367,11 +367,14 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { // SSB Table Configuration int scs_scaling = 1<<(cfg->ssb_config.scs_common.value); + if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000) + scs_scaling = scs_scaling*3; + if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666) + scs_scaling = scs_scaling>>2; uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling); cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG; cfg->num_tlv++; - cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; cfg->num_tlv++; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index f657d52d50..f73e581592 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -69,7 +69,6 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ int mib_sdu_length; int CC_id; - AssertFatal(slotP == 0, "Subframe must be 0\n"); AssertFatal((frameP & 7) == 0, "Frame must be a multiple of 8\n"); @@ -107,34 +106,36 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ AssertFatal(cc->ServingCellConfigCommon->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n"); AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n"); long band = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - uint32_t ssb_offset0 = cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + uint32_t ssb_offset0 = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; int ratio; switch (*cc->ServingCellConfigCommon->ssbSubcarrierSpacing) { case NR_SubcarrierSpacing_kHz15: - AssertFatal(band <= 79, "Band %d is not possible for SSB with 15 kHz SCS\n",band); + AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band); if (band<77) // below 3GHz ratio=3; // NRARFCN step is 5 kHz else ratio=1; // NRARFCN step is 15 kHz break; case NR_SubcarrierSpacing_kHz30: - AssertFatal(band <= 79, "Band %d is not possible for SSB with 15 kHz SCS\n",band); + AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band); if (band<77) // below 3GHz ratio=6; // NRARFCN step is 5 kHz else ratio=2; // NRARFCN step is 15 kHz break; case NR_SubcarrierSpacing_kHz120: - AssertFatal(band >= 257, "Band %d is not possible for SSB with 120 kHz SCS\n",band); - ratio=8; // NRARFCN step is 15 kHz + AssertFatal(band >= 257, "Band %ld is not possible for SSB with 120 kHz SCS\n",band); + ratio=2; // NRARFCN step is 15 kHz break; case NR_SubcarrierSpacing_kHz240: - AssertFatal(band >= 257, "Band %d is not possible for SSB with 240 kHz SCS\n",band); - ratio=16; // NRARFCN step is 15 kHz + AssertFatal(band >= 257, "Band %ld is not possible for SSB with 240 kHz SCS\n",band); + ratio=4; // NRARFCN step is 15 kHz break; + default: + AssertFatal(1==0,"SCS %ld not allowed for SSB \n", *cc->ServingCellConfigCommon->ssbSubcarrierSpacing); } dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = 0; //kSSB - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/ratio; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12); dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1; dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = ((uint32_t)cc->MIB_pdu.payload[0]) & ((1<<24)-1); dl_req->nPDUs++; From d1dc15f3c0f855c421bcd02631660e93b8cb25c1 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 13 Dec 2019 18:07:03 +0100 Subject: [PATCH 2/2] SSB correctly demodulated at FSW, CRC passes, but payload is wrong --- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 1 + openair1/PHY/NR_TRANSPORT/nr_pbch.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_transport.h | 1 - openair1/SCHED_NR/fapi_nr_l1.c | 1 - openair1/SCHED_NR/phy_procedures_nr_gNB.c | 4 +++- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index eb6b7c10c1..0e4057ecc6 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -39,6 +39,7 @@ #include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" +#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "SCHED_NR/sched_nr.h" #include "defs.h" #include "common/utils/LOG/vcd_signal_dumper.h" diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index e1a256d546..2bc1f37342 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -227,7 +227,6 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, uint8_t ssb_start_symbol, uint8_t n_hf, uint8_t Lmax, - uint8_t ssb_index, int sfn, nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms) { @@ -243,6 +242,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ///Payload generation memset((void *)pbch, 0, sizeof(NR_gNB_PBCH)); pbch->pbch_a=0; + uint8_t ssb_index = ssb_pdu->ssb_pdu_rel15.SsbBlockIndex; uint8_t *pbch_pdu = (uint8_t*)&ssb_pdu->ssb_pdu_rel15.bchPayload; for (int i=0; ipbch_a |= ((pbch_pdu[2-(i>>3)]>>(7-(i&7)))&1)<num_pdsch_rnti=0; gNB->pdcch_pdu = NULL; gNB->pbch_configured=0; - gNB->ssb_pdu=NULL; for (int i=0;idl_tti_request_body.dl_tti_pdu_list[i]; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6b05771a6a..70c293f9c2 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -117,6 +117,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ssb_index = i + 2*rel_slot; // computing the ssb_index if ((fp->L_ssb >> ssb_index) & 0x01) { // generating the ssb only if the bit of L_ssb at current ssb index is 1 + gNB->ssb_pdu->ssb_pdu_rel15.SsbBlockIndex = ssb_index; + int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp, ssb_index); // computing the starting symbol for current ssb ssb_start_symbol = ssb_start_symbol_abs % 14; // start symbol wrt slot @@ -137,7 +139,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { txdataF[0], AMP, ssb_start_symbol, - n_hf,fp->Lmax,ssb_index, + n_hf,fp->Lmax, frame, cfg, fp); } }