I read in 5G NR book that during RACH procedure, a UE transmits prach preamble associated with RA-RNTI. The gnb then upon reception calculates the RA-RNTI associated with prach occasion in which the preamble is transmitted.
My question is does the UE need to calculate the RA-RNTI before it transmits the preamble? Does it send it to the UE That is during Msg1? Or does it calculate it when it awaits random-access response from the gnb?
PRACH occasions are broadcasted by gNB in SIB. Each occasion has an equivalent RA-RNTI based on a formula defined by 3GPP
For every occasion, gNB tries to detect a preamble. If no preamble is detected, no further action. If at least 1 preamble is detected in this PRACH, msg 2 is sent with all received preamble ID and the CRC of msg2 will include RA-RNTI (corresponding to PRACH occasion)
Any UE waiting for msg2 knows RA-RNTI for PRACH occasion it has used