5G SA RACH Procedure– A Technical Deep Dive
- Venkateshu
- May 22
- 7 min read
Introduction
The Random Access CHannel (RACH) procedure is the gateway to the 5G Standalone (SA) network. It allows the User Equipment (UE) to synchronize, identify itself, and request resources for uplink communication.
In 5G SA, the initial attach procedure is launched through a contention-based RACH, triggered when a UE powers on or reselects a cell in RRC_IDLE.
Overview: UE Attach & RACH Flow

There are two types of RACH procedures: Contention-Based and Contention-Free, each suited to different scenarios and configured accordingly by the network.
1. Contention-Based Random Access (CBRA) | 2. Contention-Free Random Access (CFRA) |
Description:
Procedure:
Used in:
| Description:
Procedure:
Used in:
|
CBRA MSG1-MSG4 IEs with explanation:
Step 1: MSG1 – PRACH Preamble Transmission
UE randomly selects a preamble index.
Transmits PRACH on the PRACH Occasion based on timing and frequency settings.
Waits for Random Access Response (RAR) within the RA Response Window.
Example UE Log:

Mapping a Preamble Index to an RA-RNTI (Random Access Radio Network Temporary Identifier) is crucial in 5G NR for contention-based random access. The RA-RNTI is not explicitly sent in Msg1 (PRACH preamble); rather, it's calculated by the gNB and UE independently based on the PRACH occasion.
This RA-RNTI is then used in Msg2 (RAR – Random Access Response), allowing the UE to recognize that the Msg2 is intended for it.
RA-RNTI = 1 + s_id + 14 × t_id + 14 × 80 × f_id + 14 × 80 × 8 × ul_carrier_id
where
· s_id is the index of the first OFDM symbol of the PRACH occasion (0 ≤ s_id < 14),
· t_id is the index of the first slot of the PRACH occasion in a system frame (0 ≤ t_id < 80),
· f_id is the index of the PRACH occasion in the frequency domain (0 ≤ f_id < 8),
· ul_carrier_id is the UL carrier used for Random Access Preamble transmission (0 for NUL carrier, and 1 for SUL carrier).
Example:
Assume PRACH Configuration Index 16, as per 3GPP TS 38.211 Table 6.3.3.2-2 (for FR1, FDD, 15 kHz SCS), maps to:
s_id = 0 as first OFDM symbol is “0”
Number of PRACH slots per subframe = 1 (t_id)
PRACH Occasions per Frame = 10 (one per subframe in specific subframes)
Symbols = 0 (starts at symbol 0 of the slot)
only one RA-RB (PRACH frequency resource block) used in this configuration, then fid=0
ul-carrier-id=0
RA_RNTI= 1+0+14*1+ 14*80*0+14*80*8*0 =15
Step 2: MSG2 – Random Access Response (RAR)
gNB responds on PDSCH mapped via RAR-RNTI.
Contains:
Timing Advance Command
UL Grant for MSG3
Temporary C-RNTI
Example UE Log:

Timing Advance Command
This instructs the UE to advance its uplink transmissions, compensating for propagation delay to ensure UL time alignment.
Expressed as a 12-bit field in the MAC RAR.
Actual adjustment in time domain:
TA (in Ts)=16×(TA_Command)(for SCS = 15kHz)
Where Ts=1/(30.72×10^6)=≈32.55 ns
Example:If TA Command = 62, then time advance = 16 × 62 = 992 Ts ≈ 32.3 μs.
UL Grant for Msg3
This grant tells the UE when and where to send Msg3 (its actual identity or request).
UL Grant includes:
Frequency allocation (Resource Blocks for PUSCH)
Time domain resource (e.g., slot/subslot offset)
MCS index (modulation and coding scheme)
HARQ process info
TBS size (Transport Block Size)
Example:UL Grant might instruct the UE to transmit Msg3 on PUSCH starting 6 slots later, using RBs 10–20 with QPSK.
Temporary C-RNTI
A 16-bit identifier temporarily assigned to the UE.
This is used by the gNB to:
Track the UE in subsequent messages.
Identify the UE in Msg3, Msg4, and beyond, before final RRC connection setup.
If contention resolution is successful, this Temp C-RNTI becomes the final C-RNTI.
Step 3: MSG3 – RRC Connection Request
UE sends RRC Connection Request on PUSCH using the allocated UL resources.
Example UE Log:

value UL-CCCH-Message ::=
{
message c1 : rrcSetupRequest :
{
rrcSetupRequest
{
ue-Identity ng-5G-S-TMSI-Part1 : '00011010 00000100 00001000 01011011 0000001'B,
establishmentCause mo-Data,
spare '0'B
}
}
}
Step 4: MSG4 – RRC Connection Setup
gNB replies with:
RRC Connection Setup
Final C-RNTI assignment
SRB configuration

value DL-CCCH-Message ::=
{
message c1 : rrcSetup :
{
rrc-TransactionIdentifier 0,
criticalExtensions rrcSetup :
{
radioBearerConfig
{
srb-ToAddModList
{
{
srb-Identity 1
}
………………….
………………….
………………….
………………….
Benefits/Accomplishments of RACH procedure
1. Establishes Uplink Synchronization
RACH allows the UE to align its timing with the gNB.
The gNB provides a Timing Advance (TA) in the RAR (MSG2) to correct the UE’s transmission timing.
Essential for TDD systems and massive MIMO setups, where precise timing is critical.
2. UE Identification and Temporary C-RNTI Assignment
During the RAR step, the UE receives a temporary C-RNTI, enabling the gNB to distinguish it from others.
This temporary ID is used in subsequent messages (e.g., MSG3 and MSG4) until a final C-RNTI is assigned.
3. Dynamic Resource Allocation
RACH allows the gNB to allocate uplink resources dynamically.
This enables the UE to send its RRC Connection Request even without pre-configured grants.
Supports random access from unknown or new UEs.
4. Supports Mobility and Reselection
After reselection (e.g., in RRC_IDLE → RRC_CONNECTED transition), RACH helps re-establish the uplink path.
Ensures fast reconnection or reattachment during mobility or after losing coverage.
5. Collision Management with Contention Resolution
Contention-based RACH allows many UEs to initiate access simultaneously.
RACH uses a robust contention resolution mechanism (MSG3/MSG4) to manage simultaneous accesses without system crash.
6. Trigger for RRC Connection Establishment
The RACH MSG3 typically carries the RRC Connection Request.
This starts the transition from RRC_IDLE → RRC_CONNECTED, leading to session setup, authentication, etc.
PRACH Parameters Explained (from SIB1)
Let’s break down the key PRACH parameters found in SIB1 → rach-ConfigCommon.
Parameter | Purpose | Typical Value | Example |
prach-ConfigurationIndex | Determines PRACH format, subcarrier spacing, slots | 84 | Format A1 (15 kHz), periodic |
preambleReceivedTargetPower | Starting power for PRACH | -104 dBm | UE uses this for initial Tx |
preambleTransMax | Max number of preamble attempts | 10 | Retry limit |
ra-ResponseWindow | Time to wait for RAR | 5 slots | Must match gNB timing |
ssb-perRACH-Occasion | SSBs linked to PRACH | 1 or 8 | Configures how many beams are mapped |
msg1-FDM | FDM options for MSG1 | 2 or 4 | Determines PRACH frequency domain |
zeroCorrelationZoneConfig | Reduces interference between preambles | 10 | ZCZ config index |
numRA-Preambles | Total available preambles | 64 | 0–63 (standard full set) |
How PRACH Preambles Work in 5G SA
What is a PRACH Preamble?
A PRACH preamble is a specially formatted signal transmitted by the UE on the PRACH occasion. It helps the gNB identify and estimate the uplink timing of the UE.
Each PRACH preamble consists of:
Cyclic Prefix (CP)
Zadoff-Chu (ZC) Sequence — a root sequence,
Format-specific extensions (depending on PRACH Format: A1/A2/B1/C2 etc.)

5G NR introduces enhanced flexibility, broader use cases (e.g., mmWave, beamforming, ultra-low latency), and the need to scale across small to very large cells, which demands a more adaptable PRACH design.
Scenario | Recommended Format | Why? |
Rural, large cells | Long (Format 0–3) | Longer delay spread, large timing uncertainty |
Urban, small cells | Short (A1–B4) | Tighter timing, lower delay |
mmWave, TDD, URLLC | Short (C0–C2) | Ultra-low latency, beam mgmt |
Long Sequence: length 839, four preamble formats(Format 0, 1, 2, 3) that originated from the LTE preambles are supported, mainly targeting large cell deployment scenarios. These formats can only be used in FR1 and have a subcarrier spacing of 1.25 or 5 kHz.
Short sequence: length 139, nine different preamble formats (A1, A2, A3, B1, B2, B3, B4, C0, C2) are introduced in NR, mainly targeting the small/normal cell and indoor deployment scenarios.


How gNB Generates PRACH Preambles
gNB-side Configuration:
PRACH Config Index
Defines slot/frame timing, subcarrier spacing, and PRACH format (via TS 38.211, Table 6.3.3.2-2).
ZC Root Sequences
gNB configures one or more Zadoff-Chu root sequences:
rach-ConfigCommon:
- prach-RootSequenceIndex: 44
- zeroCorrelationZoneConfig: 10
- numRA-Preambles: 64
Correlation Zone and Mapping
gNB uses:
prach-RootSequenceIndex as base
zeroCorrelationZoneConfig to generate up to 64 unique orthogonal preambles
Each UE preamble corresponds to a cyclic shift of the root ZC sequence, ensuring minimal collision.
These determine how often PRACH is available — e.g., once every 10ms, 20ms, etc.
The PRACH occasion must align with the SSB beams via ssb-perRACH-Occasion. 3GPP defines parameters “ssb-perRACH-OccasionAndCB-PreamblesPerSSB”, “msg1-FDM” to align SSB & RACH occasions as shown below.
Example:
prach-ConfigurationIndex = 7
→ PRACH is available every 9th subframe with starting symbol 0.

Frequency Domain Allocation for PRACH:
msg1-FDM: Number of frequency-domain partitions (1, 2, or 4)
frequencyStart: PRB index for PRACH allocation
How Frequency Domain Allocation Works:
Total PRACH bandwidth is split across up to 4 frequency domain locations (FDM).
Each PRACH occasion can be divided into multiple RACH resources (based on FDM) to support more UEs.
UE randomly selects one of these frequency-domain chunks during PRACH.
Example:
msg1-FDM = 2 → PRACH spans 2 frequency regions
frequencyStart = 10 → PRACH starts at PRB 10
If the PRACH occasion is split into 2 FDMs, each domain may occupy a 6 PRB span (for example), allowing two parallel preamble transmissions in a single time slot.
How UE Selects a PRACH Preamble
UE-side Selection Logic:
When RACH is triggered (due to Power ON or Cell Reselection), UE reads rach-ConfigCommon from SIB1, and proceeds as follows:
Determine PRACH Occasion:
Based on:
Slot timing
SSB beam-to-PRACH mapping (via ssb-perRACH-Occasion)
msg1-FDM (1, 2, or 4 frequency-domain multiplexed occasions)

Random Preamble Index Selection:
UE randomly picks one index from the allowed range (e.g., 0–63).
Example:
numRA-Preambles: 64
Random Selection: Index 41
Transmit with Configured Format & Power:
Based on:
PRACH Format (A1, A2, etc.)
SCS: 15 kHz, 30 kHz
Power: preambleReceivedTargetPower (e.g., -104 dBm)
Beam Index (based on best SSB RSRP)
Example UE Log:
5GNR MAC RACH Attempt - SUCCESS
Symbol_Start : 0
Preamble_Format : FORMAT_0 (0)
Prach_Config : 18
Uroot : 401
RAID : 29
FDM : 0
Cyclic_Shift_v : 119
N_CS : 119
Ra_RNTI : 99
Tuning & Troubleshooting
Symptom | Possible Cause | Resolution |
No MSG2 (RAR) | RAR missed or outside response window | Check ra-ResponseWindow, SSB beam alignment |
MSG3 Collision | Same preamble used by multiple UEs | Use more preambles (numRA-Preambles) |
Excessive Retries | Wrong power config or wrong SSB | Adjust preambleReceivedTargetPower or beam mapping |
UE stuck after MSG3 | MSG3 received, but RRC fails | Review PUSCH timing and UL grant |
Summary
The RACH procedure is the handshake that initiates communication between UE and gNB. It combines physical, MAC, and RRC layer coordination. Understanding PRACH configuration and analyzing UE logs is vital for engineers working on modem validation, network optimization, and gNB development.
References
TS 38.211 – PRACH Format and Mapping
TS 38.213 – PRACH Configuration Parameters
TS 38.321 – MAC Layer RACH Procedure
TS 38.331 – RRC Messages and States
https://www.sharetechnote.com/html/5G/5G_RACH.html#RACH_Occasion
IEEE Access, ARVIND CHAKRAPANI “On the Design Details of SS/PBCH, Signal Generation and PRACH in 5G-NR”
Comments