Skip to content

TPC for MSG3 retransmissions is hardcoded to 1 (0dB)

In nr_fill_rar the TPC for MSG3 is hardcoded as ra->msg3_TPC = 1. The correct implementation would be probably something like:

diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
index d6dfa19dd4..0f24c5cabf 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
@@ -2389,8 +2389,6 @@ static void nr_fill_rar(uint8_t Mod_idP, NR_RA_t *ra, uint8_t *dlsch_buffer, nfa
 
   // UL grant
 
-  ra->msg3_TPC = 1; // This is 0 dB in UL DCI
-
   if (pusch_pdu->frequency_hopping)
     AssertFatal(1==0,"PUSCH with frequency hopping currently not supported");
 
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
index 4599349a04..7da85cd9b7 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
@@ -972,9 +972,12 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
       if (ra->ra_state != nrRA_WAIT_Msg3)
         continue;
 
-      if( (frameP!=ra->Msg3_frame) || (slotP!=ra->Msg3_slot))
+      if((frameP != ra->Msg3_frame) || (slotP != ra->Msg3_slot))
         continue;
 
+      if (ul_cqi != 0xff) {
+        ra->msg3_TPC = nr_get_tpc(target_snrx10, ul_cqi, 30, ???);
+
       handle_msg3_failed_rx(ra, i, gNB_mac->ul_bler.harq_round_max);
     }
   }

Not sure how to set the last parameter of nr_get_tpc

Edited by Francesco Mani