Random Access

RACH —
The UE knocks on the door

The UE is camped on PCI 442. It knows the operator, the signal is good, access is allowed. Now it must actually connect. The Random Access Channel (RACH) procedure is how the UE synchronises its uplink timing with the gNB and gets a temporary identity — the first step to an RRC connection.

TS 38.213 §8 TS 38.321 §5.1 TS 38.331 §5.3.3

Why RACH is needed

In OFDM systems, the gNB must receive all UE transmissions time-aligned to within the cyclic prefix duration. A UE that just powered on does not know how long its signal takes to travel to the gNB — it could be 100 metres away or 10 km away. The propagation delay can range from near-zero to ~33 μs for a cell radius of 5 km.

If the UE transmitted on the uplink without adjusting for this delay, its signal would arrive misaligned at the gNB, causing interference with other UEs. RACH solves this by letting the gNB measure the UE's arrival timing and send back a Timing Advance (TA) command — telling the UE to transmit earlier by exactly the right amount.

The random access procedure is used to achieve uplink synchronisation and to allocate a unique temporary identifier to the UE. The UE shall initiate the random access procedure when directed by upper layers to establish an RRC connection.
3GPP TS 38.321, Section 5.1
4-step
contention-based RACH
Msg1 → Msg2 → Msg3 → Msg4. Standard initial access.
2-step
contention-free RACH
MsgA → MsgB. Faster, used for handover.
64
preambles per cell
UE picks one at random from 64 Zadoff-Chu sequences
TA
timing advance
gNB-measured delay sent to UE in Msg2

4-step RACH — the messages

4-step RACH procedure — Msg1 through Msg4 TS 38.321 §5.1.2, TS 38.331 §5.3.3

Contention — the problem in 4-step RACH

When a UE selects a preamble at random from 64 options, two UEs in the same cell might pick the same preamble in the same PRACH occasion. The gNB cannot tell them apart from the preamble alone — it responds to both with the same RAR. Both UEs then send Msg3, which collide at the gNB.

Msg4 resolves this: the gNB's contention resolution message includes the UE's identity from Msg3. Only the UE that recognises its own identity continues; the other one backs off and retries.

When RACH is triggered

RACH trigger conditions TS 38.321 §5.1.1
TriggerRACH typeNotes
Initial access from RRC_IDLEContention-basedOur case — first connection after camping
RRC connection re-establishmentContention-basedAfter radio link failure
HandoverContention-freegNB assigns dedicated preamble
UL data arrival in RRC_INACTIVEContention-basedResume suspended connection
Uplink sync lostContention-basedTA timer expired
Beam failure recoveryContention-freeNew beam selected after failure

SSB-to-PRACH beam linking

In 5G NR, the RACH is not beam-agnostic. Because the UE detected the SSB on beam index 3 (strongest beam), it must send its preamble on the PRACH occasion linked to that same beam. This ensures the gNB receives the preamble on the same spatial direction it used to transmit the SSB.

SIB1 contains a table mapping each SSB index to one or more PRACH occasions. The UE uses this table to find the correct PRACH resource for SSB index 3.

A UE that has identified an SS/PBCH block shall, if the UE initiates a random access procedure, transmit a preamble in the PRACH occasion associated with the SS/PBCH block as defined in TS 38.213.
3GPP TS 38.321, Section 5.1.2
RACH overview — key facts for our cell
Type          → 4-step contention-based (initial access)
SSB beam      → index 3 → links to specific PRACH occasions
Preamble pool  → 64 sequences (Zadoff-Chu based)
RA config     → from SIB1 (prach-ConfigIndex=16, target power=−110 dBm)
Next          → Msg1: select and transmit preamble