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.
4-step RACH — the messages
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
| Trigger | RACH type | Notes |
|---|---|---|
| Initial access from RRC_IDLE | Contention-based | Our case — first connection after camping |
| RRC connection re-establishment | Contention-based | After radio link failure |
| Handover | Contention-free | gNB assigns dedicated preamble |
| UL data arrival in RRC_INACTIVE | Contention-based | Resume suspended connection |
| Uplink sync lost | Contention-based | TA timer expired |
| Beam failure recovery | Contention-free | New 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.