Random Access (4-step & 2-step) in 5G NR
The RACH procedure — preamble, RAR, Msg3 and contention resolution, plus 2-step RA.
Uplink transmission in NR is scheduled and time-aligned. Before the gNB can grant a UE anything, two things must be true: the gNB must know the UE exists, and the UE's uplink transmissions must arrive inside the gNB's receive window despite propagation delay that varies by tens of microseconds across a cell. Random Access is the one procedure in NR that bootstraps both from nothing. It is called random because in the contention-based case the UE picks its opening move -- a preamble sequence -- at random from a pool shared with every other UE in the cell, since the network has no way to pre-assign one to a UE it does not yet know about.
Contents
- 01Why Random Access Exists, and What Triggers It
- 02Contention-Based and Contention-Free
- 034-Step RACH, Message by Message
- 042-Step RACH and the Fallback Mechanism
- 05Before MSG1: Resource and Preamble Selection
- 06PRACH Configuration: Formats, Occasions, Root Sequences
- 07RA-RNTI, MSGB-RNTI, and the Worked Addressing Example
- 08Inside MSG2: RAR MAC PDU Bit Layout
- 09Timing Advance: What the 12-Bit Command Actually Means
- 10Power Control and Ramping
- 11Timers, Counters, and Backoff
- 12Failure Modes and What Each One Means
- 13Configuration Reference (ASN.1 and Ranges)
- 14Illustrative Message Traces
- 15Release Deltas: Rel-15 to Rel-18
- 16Reading RACH in Logs: A Checklist
- 17Glossary
- 18References
1. Why Random Access Exists, and What Triggers It
Uplink transmission in NR is scheduled and time-aligned. Before the gNB can grant a UE anything, two things must be true: the gNB must know the UE exists, and the UE's uplink transmissions must arrive inside the gNB's receive window despite propagation delay that varies by tens of microseconds across a cell. Random Access is the one procedure in NR that bootstraps both from nothing. It is called random because in the contention-based case the UE picks its opening move -- a preamble sequence -- at random from a pool shared with every other UE in the cell, since the network has no way to pre-assign one to a UE it does not yet know about.
TS 38.321 clause 5.1.1 lists the triggers. They matter far more than they first appear, because the same four messages carry completely different consequences depending on which trigger started them:
| Trigger | RRC state | Type | If it fails, the result is |
|---|---|---|---|
| Initial access | RRC_IDLE | CBRA | Connection establishment failure; T300 governs. UE logs a connEstFailReport and reselects. |
| RRC connection re-establishment | CONNECTED -> IDLE transit | CBRA | T301 expiry -> go to RRC_IDLE with release cause. |
| Resume from RRC_INACTIVE | RRC_INACTIVE | CBRA | T319 expiry -> go to RRC_IDLE; context discarded. |
| Handover to target cell | RRC_CONNECTED | CFRA usually | T304 expiry -> handover failure -> re-establishment attempt. |
| DL data arrival, UL out of sync | RRC_CONNECTED | CFRA (PDCCH order) | Contributes to RLF if it exhausts on the SpCell. |
| UL data arrival, no PUCCH SR resource | RRC_CONNECTED | CBRA | SR failure handling; RACH is the fallback SR mechanism. |
timeAlignmentTimer expiry | RRC_CONNECTED | CBRA | UL is unusable until re-sync; HARQ buffers flushed. |
| Beam Failure Recovery | RRC_CONNECTED | CFRA (dedicated BFR preamble) | beamFailureRecoveryTimer expiry -> RLF. |
| SCell addition / secondary TAG alignment | RRC_CONNECTED | CFRA | SCell released; PCell unaffected. |
| Request for Other SI (on-demand SI) | IDLE / INACTIVE / CONNECTED | Either | SI request retried; not a link failure. |
| Consistent LBT failure on SpCell (NR-U) | RRC_CONNECTED | CBRA | Rel-16. Triggers RLF if no usable LBT channel remains. |
Table 1. Random Access triggers, TS 38.321 cl. 5.1.1, with the RRC-level consequence of exhaustion. See §12.
A RACH failure is a MAC event with an RRC meaning. MAC only ever reports "Random Access problem"; it never decides that the link is down. Whether that becomes a connection failure, a handover failure, an SCell release or a full RLF is decided by RRC based on the trigger. Reading a burst of preamble retries without knowing the trigger tells you almost nothing.
2. Contention-Based and Contention-Free
| CBRA | CFRA | |
|---|---|---|
| Preamble source | UE draws at random from the shared pool broadcast in rach-ConfigCommon | Network assigns a specific ra-PreambleIndex in a dedicated RRC message or a PDCCH order |
| Collision possible? | Yes -- two UEs can draw the same preamble in the same RO | No -- the index is unique to one UE |
| Contention resolution needed? | Yes: MSG3 identity + MSG4 echo | No: steps 3-4 are skipped entirely |
| Effective message count | 4 (or 2 with MSGA/MSGB) | 2 -- preamble and response |
| Where configured | SIB1 servingCellConfigCommon -> uplinkConfigCommon -> rach-ConfigCommon | RACH-ConfigDedicated inside reconfigurationWithSync, or BeamFailureRecoveryConfig |
| Typical use | Initial access, re-establishment, resume, SR fallback, TA recovery | Handover, beam failure recovery, DL-data-triggered re-sync, SCell/TAG alignment |
Table 2. CBRA and CFRA differ in exactly one thing -- who chooses the preamble -- and everything else follows from that.
CFRA is not a different procedure so much as the same procedure with the ambiguity removed. Because the gNB knows which UE owns preamble index n, detecting n is itself the identification, so the RAR can carry the real C-RNTI and the UE can go straight to using it. This is why a handover completes in roughly a third of the messages of an initial access, and why handover RACH failures show up in logs as timer expiries (T304) rather than as contention-resolution mismatches.
CFRA preambles are carved out of the same 64-preamble space as CBRA preambles in the cell. totalNumberOfRA-Preambles in RACH-ConfigCommon bounds the contention-based portion; the remainder is what the scheduler has left to hand out for handovers and BFR. Over-provisioning CBRA preambles in a cell with heavy inbound mobility starves CFRA and quietly pushes handovers onto contention-based access.
3. 4-Step RACH, Message by Message
3.1 MSG1 -- the preamble
The UE transmits a Zadoff-Chu-derived preamble sequence on a PRACH occasion. It carries no data at all -- the only information conveyed is which of up to 64 preamble indices was sent, and when and where it was sent. That pair is the entire content of MSG1, and both halves are used: the index becomes the RAPID echoed in the RAR, and the arrival time relative to the expected occasion becomes the timing advance.
- Sequence: generated from
prach-RootSequenceIndexplus a cyclic shift determined byzeroCorrelationZoneConfig. Length 839 for long formats, 139 for short formats TS 38.211 cl. 6.3.3.1. - Power: open-loop, from
preambleReceivedTargetPowerplus the UE's own pathloss estimate, ramped on each retry (§10). - Beam: the preamble is sent using the spatial filter of the SSB the UE selected, which is how the gNB learns which beam to answer on.
3.2 MSG2 -- the Random Access Response
Within ra-ResponseWindow slots of the end of the preamble, the UE monitors Type1-PDCCH common search space for a DCI whose CRC is scrambled with the RA-RNTI it computed from its own PRACH occasion. The scheduled PDSCH carries a RAR MAC PDU, which may hold several MAC RARs (one per preamble the gNB detected in that occasion) plus an optional backoff subheader. The UE walks the subheaders looking for a RAPID equal to the preamble index it sent; anything else in the PDU belongs to other UEs and is discarded. §8 has the bit layout.
A matching RAR gives the UE three things it did not have: a timing advance command so its next transmission lands in the right place, an uplink grant for MSG3, and a Temporary C-RNTI.
3.3 MSG3 -- the first real uplink message
MSG3 is sent on PUSCH using the RAR's grant, scrambled with the TC-RNTI, and is the first transmission that is actually HARQ-protected and power-controlled in closed loop. For initial access it carries RRCSetupRequest on CCCH, whose payload includes a ue-Identity -- either a 5G-S-TMSI-Part1 if the UE has one, or a 39-bit random value. That identity is the token used for contention resolution. For other triggers MSG3 instead carries RRCResumeRequest, RRCReestablishmentRequest, RRCSystemInfoRequest, or, in RRC_CONNECTED, a C-RNTI MAC CE plus buffered data.
MSG3 is deliberately tiny -- 56 to 72 bits of RRC payload is typical -- because it is transmitted before any channel-quality feedback loop exists, on a grant the gNB sized blind. ra-Msg3SizeGroupA exists precisely so a UE that needs a larger MSG3 can signal that fact in its choice of preamble group, before it has any way to ask (§5.3).
3.4 MSG4 -- contention resolution
The gNB echoes back the first 48 bits of the CCCH SDU it received in MSG3, inside a UE Contention Resolution Identity MAC CE TS 38.321 cl. 6.1.3.3. Every UE that sent that same preamble in that same occasion decodes the CE and compares. Exactly one match is possible. The winner considers Random Access successful and promotes its TC-RNTI to C-RNTI; the losers discard the TC-RNTI and restart from MSG1 with the power-ramping counter unchanged -- their preamble was received fine, so ramping further would only raise interference.
For a UE already in RRC_CONNECTED that sent a C-RNTI MAC CE in MSG3, contention resolution is implicit instead: successful reception of a PDCCH addressed to its own C-RNTI is the confirmation, and no CE is needed.
4. 2-Step RACH and the Fallback Mechanism
2-step RACH, added in Rel-16, removes a full round trip by bundling the preamble and the MSG3-equivalent payload into a single transmission. The trade is that the payload is sent before any timing advance has been applied and before any grant has been received, so it only works where the UE's uplink timing error is already within the cyclic prefix and its power estimate is good enough -- in practice, in good coverage, which is why selection is gated on msgA-RSRP-Threshold.
| MSGA | MSGB | |
|---|---|---|
| Composition | PRACH preamble from the msgA preamble group + a PUSCH payload in an associated PUSCH occasion (PO) | Either a successRAR or a fallbackRAR, selected per detected preamble |
| Association | Preamble index -> PO and DMRS port, by msgA-PUSCH-Config TS 38.331 | Addressed by MSGB-RNTI (§7) |
successRAR carries | -- | UE Contention Resolution Identity (48 bits), C-RNTI, TA command, TPC, PUCCH resource indicator, HARQ feedback timing |
fallbackRAR carries | -- | RAPID, TA command, UL grant, TC-RNTI -- byte-for-byte an ordinary RAR |
| Window | -- | msgB-ResponseWindow |
| Attempt counter | msgA-TransMax | -- |
Table 3. MSGA and MSGB contents, TS 38.321 cl. 5.1.3a and 5.1.4a.
Three outcomes are possible after MSGA, and the distinction is exactly what makes 2-step deployable:
1. Preamble and payload both decoded -> successRAR. The UE has a C-RNTI and the procedure is over in two messages.
2. Preamble decoded, payload not -> fallbackRAR. The UE retransmits just the payload on the granted PUSCH, i.e. it completes as 4-step from MSG3 onward. No new preamble, no power re-ramp, no restart.
3. Nothing decoded -> no MSGB inside msgB-ResponseWindow. The UE ramps power and retries MSGA, up to msgA-TransMax, after which it switches to 4-step for the remaining attempts if 4-step is also configured.
The counters are separate but the budget is shared. A UE configured with msgA-TransMax = n4 and preambleTransMax = n10 gets four MSGA attempts and then up to six 4-step attempts -- not fourteen. Sizing these two without reference to each other is a common misconfiguration; it shows up as access that appears to give up early in marginal coverage.
5. Before MSG1: Resource and Preamble Selection
By the time a preamble goes out, the UE has already made four decisions that the gNB will never see directly. Understanding them is what turns an unexplained preamble index in a log into a readable statement about what the UE believed.
5.1 SSB and beam selection
The UE measures SSB RSRP and picks an SSB whose RSRP exceeds rsrp-ThresholdSSB. If none does, it may pick any SSB TS 38.321 cl. 5.1.2. The chosen SSB determines both the spatial filter used for the preamble and, through the SSB-to-RO association, the set of PRACH occasions and preamble indices the UE is allowed to use. This is the mechanism by which a beamformed cell steers uplink access without any uplink measurement having happened yet.
5.2 SSB-to-RO association
ssb-perRACH-OccasionAndCB-PreamblesPerSSB specifies how many SSBs share one RO and how many contention-based preambles each SSB gets. The choice branch names are the ratio: oneEighth means one SSB is mapped across eight consecutive ROs (many occasions per beam, useful for a cell with few beams and heavy load), while sixteen means sixteen SSBs share a single RO (few occasions, many beams). The association repeats over an association period of 1, 2, 4, 8 or 16 PRACH configuration periods, chosen as the shortest that covers all actual SSBs TS 38.213 cl. 8.1.
RA-RNTI is computed from the RO, and the RO is shared by every SSB mapped to it. In a sixteen configuration, sixteen beams' worth of UEs compute the same RA-RNTI, so one RAR MAC PDU can legitimately contain MAC RARs for UEs on completely different beams. A RAR that appears to be "for the wrong beam" in a log is usually this, not an error.
5.3 Preamble group A and group B
When groupBconfigured is present, the 64 preambles are split. Choosing a group B preamble is the UE's way of saying "my MSG3 will be larger than ra-Msg3SizeGroupA and I have enough power headroom to send it well", letting the gNB size the MSG3 grant appropriately from the preamble alone. The UE picks group B only if both conditions hold; if it needs the bigger MSG3 but lacks headroom, it falls back to group A and accepts segmentation. messagePowerOffsetGroupB is the headroom test's threshold offset.
5.4 4-step or 2-step
If both are configured on the selected carrier and the measured SSB RSRP of the selected SSB is above msgA-RSRP-Threshold, the UE uses 2-step; otherwise 4-step. If only one is configured, that one is used. A dedicated CFRA configuration overrides all of this.
6. PRACH Configuration: Formats, Occasions, Root Sequences
6.1 Preamble formats
The format sets sequence length, subcarrier spacing, number of repeated sequences and cyclic prefix length -- and through the CP, the maximum round-trip delay the gNB can absorb, which is the cell radius limit. Long formats use a 839-length sequence at 1.25 or 5 kHz PRACH SCS; short formats use 139 at the same SCS family as the uplink data.
| Format | Len | PRACH SCS | Seq x CP | Duration @15 kHz | Max cell radius | Where it fits |
|---|---|---|---|---|---|---|
| 0 | 839 | 1.25 kHz | 1 x 3168k | 1 ms | ~14.5 km | General-purpose macro; the default many vendors ship |
| 1 | 839 | 1.25 kHz | 2 x 21024k | 3 ms | ~100 km | Very large rural / coastal cells; huge CP |
| 2 | 839 | 1.25 kHz | 4 x 4688k | 3.5 ms | ~22 km | Coverage-limited macro; repetition buys link budget |
| 3 | 839 | 5 kHz | 4 x 3168k | 1 ms | ~14.5 km | High-speed / high-Doppler; wider SCS resists Doppler |
| A1 | 139 | 15-120 kHz | 2 x 288k | 0.14 ms | ~0.94 km | Dense small cell |
| A2 | 139 | 15-120 kHz | 4 x 576k | 0.29 ms | ~2.1 km | Small / micro cell |
| A3 | 139 | 15-120 kHz | 6 x 864k | 0.43 ms | ~3.3 km | Micro cell |
| B1 | 139 | 15-120 kHz | 2 x 216k | 0.13 ms | ~0.59 km | Indoor / very dense |
| B4 | 139 | 15-120 kHz | 12 x 936k | 0.86 ms | ~3.9 km | Coverage-enhanced short format; common on FR1 mid-band |
| C0 | 139 | 15-120 kHz | 1 x 1240k | 0.10 ms | ~5.4 km | One symbol, long CP -- cheapest occasion, decent range |
| C2 | 139 | 15-120 kHz | 4 x 2048k | 0.33 ms | ~9.3 km | Best range available from a short format |
Table 4. Preamble formats, TS 38.211 Tables 6.3.3.1-1 and 6.3.3.1-2. k = 64; durations and radii are at 15 kHz and halve per SCS doubling. Radii are the CP-implied limits, not link-budget limits.
Cell radius here is a timing limit, not a coverage one. The CP must absorb the full round-trip delay of the furthest UE, or that UE's preamble smears into the next occasion. A UE 30 km out in a Format 0 cell can be perfectly audible and still never complete RACH -- the preamble arrives outside the detection window. Symptom: preambles detected with implausible TA values, or not at all, only from distant UEs.
6.2 PRACH occasions in time and frequency
prach-ConfigurationIndex selects a row of a large table TS 38.211 Tables 6.3.3.2-2 to 6.3.3.2-4 giving the format, the system-frame periodicity x and offset y, which subframes or slots within those frames carry ROs, the starting symbol, and how many time-domain ROs per slot. msg1-FDM (one/two/four/eight) then multiplies that in frequency, and msg1-FrequencyStart places the block in the uplink BWP.
msg1-FDM = four and two time-domain ROs. The (s_id, t_id, f_id) triple that identifies each RO is exactly what goes into the RA-RNTI formula in §7.6.3 Root sequences and cyclic shifts
The 64 preambles a cell offers are generated from consecutive logical root sequences starting at prach-RootSequenceIndex, each root yielding several preambles through cyclic shifts. How many shifts fit per root is set by zeroCorrelationZoneConfig (N_CS): a larger zero-correlation zone tolerates more timing uncertainty -- necessary in a big cell -- but yields fewer preambles per root, so more roots are consumed to reach 64. restrictedSetConfig (type A or B) removes shifts that alias under high Doppler, at further cost in preambles per root.
Neighbouring cells must not use overlapping root sequence ranges, or a preamble sent to one cell can be detected by the other, producing RARs the UE never expected and phantom uplink grants. The consumed range per cell is ceil(64 / preambles_per_root) roots, which grows as N_CS grows -- so raising zeroCorrelationZoneConfig for a large cell silently widens its root footprint and can collide with a neighbour that was previously spaced fine.
7. RA-RNTI, MSGB-RNTI, and the Worked Addressing Example
The gNB must address the RAR to a UE whose identity it does not know. It solves this by addressing the occasion instead: both sides can compute the same value from the time and frequency position of the preamble transmission TS 38.321 cl. 5.1.4.
RA-RNTI = 1 + s_id + 14 x t_id + 14 x 80 x f_id + 14 x 80 x 8 x ul_carrier_id MSGB-RNTI = RA-RNTI + 14 x 80 x 8 x 2 s_id first OFDM symbol of the PRACH occasion 0 .. 13 t_id first slot of the PRACH occasion in a system frame 0 .. 79 f_id frequency-domain index of the RO among the FDM'd ones 0 .. 7 ul_carrier_id 0 = normal uplink (NUL), 1 = supplementary uplink (SUL)
7.1 Worked example
A UE transmits its preamble in the RO at symbol 4 of slot 19, frequency-domain index 1, on the normal uplink carrier:
s_id = 4, t_id = 19, f_id = 1, ul_carrier_id = 0
RA-RNTI = 1 + 4 + (14 x 19) + (14 x 80 x 1) + 0
= 1 + 4 + 266 + 1120
= 1391
Had the same UE used 2-step in the same RO:
MSGB-RNTI = 1391 + (14 x 80 x 8 x 2) = 1391 + 17920 = 19311
The gNB scrambles the DCI CRC for that RAR with 1391, and every UE that used that occasion -- regardless of preamble index or beam -- descrambles it successfully and reads the PDU. Disambiguation happens one layer up, at the RAPID subheader, and one layer up again at contention resolution.
The offset in MSGB-RNTI exists so that 2-step and 4-step responses in the same occasion never collide in the RNTI space. The RA-RNTI space is 1..17920 and MSGB-RNTI occupies 17921..35840; both must fit within the 0x0001-0xFFEF RNTI range shared with C-RNTI, P-RNTI, SI-RNTI and the rest TS 38.321 cl. 7.1.
8. Inside MSG2: RAR MAC PDU Bit Layout
A RAR MAC PDU is one or more MAC subPDUs. Each subPDU is a subheader, optionally followed by a payload. There are two subheader shapes, distinguished by the T bit:
- T = 0, backoff subheader:
E | T | R | R | BI(4). Carries no payload. If present it must be first, and it applies to every UE reading the PDU. - T = 1, RAPID subheader:
E | T | RAPID(6). Followed by a 7-octet MAC RAR, except when the RAPID corresponds to an on-demand SI request, in which case there is no payload -- the acknowledgement is the RAPID. - E is the extension bit: 1 means another subPDU follows, 0 means this is the last.
| Field | Bits | Range | Meaning |
|---|---|---|---|
R | 1 | 0 | Reserved, set to zero |
| Timing Advance Command | 12 | 0 .. 3846 | Initial UL timing correction; see §9 for the conversion |
| UL Grant | 27 | -- | Frequency hopping flag (1), PUSCH frequency resource allocation (14), PUSCH time resource allocation (4), MCS (4), TPC command for MSG3 (3), CSI request (1) |
| Temporary C-RNTI | 16 | 0x0001 .. 0xFFEF | Becomes the C-RNTI if this UE wins contention resolution |
Table 5. MAC RAR fields, TS 38.321 cl. 6.2.3. Total 56 bits = 7 octets, fixed.
8.1 The MSGB variant
A MSGB MAC PDU TS 38.321 cl. 6.1.5a can mix successRAR and fallbackRAR subPDUs plus a backoff subheader, because one MSGB answers every MSGA the gNB detected in that occasion and some payloads will have decoded while others did not. A successRAR is larger than a MAC RAR -- it carries the 48-bit contention resolution identity and a C-RNTI, since it must both identify the winner and equip it.
9. Timing Advance: What the 12-Bit Command Actually Means
The RAR's TA command is an absolute value, unlike the 6-bit relative adjustments carried later in Timing Advance Command MAC CEs. It sets:
N_TA = T_A x 16 x 64 / (2^mu) [in units of T_c] T_c = 1 / (480000 x 4096) s ~ 0.509 ns mu = numerology: 0 = 15 kHz, 1 = 30 kHz, 2 = 60 kHz, 3 = 120 kHz T_A = the 12-bit RAR field, 0 .. 3846
T_A = 245, 30 kHz SCS (mu = 1):
N_TA = 245 x 16 x 64 / 2 = 125 440 T_c
= 125 440 x 0.509 ns ~ 63.8 us
One-way propagation is half of that: ~31.9 us, which at c is ~9.6 km of path. The UE now advances every uplink transmission by 63.8 us so it lands aligned at the gNB.
Step size at 30 kHz: 16 x 64 / 2 = 512 T_c ~ 0.26 us ~ 39 m of range resolution.
The maximum T_A of 3846 corresponds to roughly 1 ms of advance at 15 kHz -- about 150 km of one-way path -- which is the ceiling on terrestrial cell size regardless of preamble format. Rel-17 NTN raises this with a separate common TA (ta-Common) applied on top, precisely because the 12-bit field cannot express a satellite's delay.
In logs, a TA command near zero on initial access means the UE is essentially at the antenna; a value that jumps by hundreds between consecutive RACH procedures on the same UE means it moved, changed beam to a differently-delayed path, or -- most often -- was answered by a different cell than you assumed. Correlate TA against the cell's known geometry before believing a mobility story.
10. Power Control and Ramping
PRACH power is open loop -- there is no feedback yet -- so the UE computes it from a target the network broadcasts plus its own downlink pathloss estimate, and increases it on each failed attempt TS 38.213 cl. 7.4:
P_PRACH = min { P_CMAX ,
preambleReceivedTargetPower
+ PL (DL pathloss estimate)
+ DELTA_preamble (format-dependent offset)
+ (COUNTER - 1) x powerRampingStep }
COUNTER = PREAMBLE_POWER_RAMPING_COUNTER, starts at 1preambleReceivedTargetPower = -104 dBm, powerRampingStep = dB4, estimated PL = 118 dB, P_CMAX = 23 dBm:
attempt 1: -104 + 118 + 0 = 14 dBm
attempt 2: -104 + 118 + 4 = 18 dBm
attempt 3: -104 + 118 + 8 = 22 dBm
attempt 4: -104 + 118 + 12 = 26 dBm -> clipped to 23 dBm
From attempt 4 onward the UE is at maximum power and further ramping changes nothing. Attempts 4 through 10 are, in link-budget terms, identical retries -- they only help against collisions and fading, not against pathloss.
PREAMBLE_POWER_RAMPING_COUNTER is not incremented when the UE changes the spatial filter -- i.e. when it selects a different SSB between attempts TS 38.321 cl. 5.1.3. This is correct behaviour (the new beam's pathloss is a fresh estimate, not an under-estimate to correct) but it means a UE oscillating between two marginal beams can burn through preambleTransMax at almost constant power and fail without ever having ramped meaningfully. In logs this looks like ten attempts at the same power -- which is easy to misread as a broken ramping configuration.
11. Timers, Counters, and Backoff
| Parameter | ASN.1 values | Typical | What it does |
|---|---|---|---|
ra-ResponseWindow | sl1, sl2, sl4, sl8, sl10, sl20, sl40, sl80 | sl10 | Slots to monitor for the RAR after the preamble. Starts at the first PDCCH occasion after the preamble ends, not at the preamble. |
msgB-ResponseWindow | sl1 .. sl320 | sl20 | Same, for MSGB. Longer because MSGA payload decoding takes the gNB longer. |
ra-ContentionResolutionTimer | sf8, sf16, sf24, sf32, sf40, sf48, sf56, sf64 | sf64 | Subframes to wait for MSG4 after MSG3. Expiry = contention considered lost, restart from MSG1. |
preambleTransMax | n3, n4, n5, n6, n7, n8, n10, n20, n50, n100, n200 | n10 | Total preamble transmissions before MAC reports a Random Access problem to RRC. |
msgA-TransMax | n1, n2, n4, n8, n16, n32, n64 | n4 | MSGA attempts before switching to 4-step (if configured). |
powerRampingStep | dB0, dB2, dB4, dB6 | dB2 or dB4 | Increment per attempt that did not change spatial filter. |
preambleReceivedTargetPower | -202 .. -60 dBm (1 dB steps) | -104 dBm | Target received power at the gNB; the anchor of the open-loop calculation. |
backoffIndicator | index 0..15 in the RAR | signalled per RAR | Upper bound of a uniform random wait before the next attempt. Load control. |
T300 | ms100 .. ms2000 | ms1000 | RRC: RRCSetupRequest sent -> RRCSetup received. Bounds the whole initial access, RACH included. |
T304 | ms50 .. ms10000 | ms1000 | RRC: handover execution. Bounds the CFRA at the target cell. |
T319 | ms100 .. ms2000 | ms1000 | RRC: RRCResumeRequest sent -> RRCResume received. |
Table 6. RACH-relevant timers and counters, TS 38.331 RACH-ConfigGeneric and UE-TimersAndConstants.
11.1 Backoff indicator values
A gNB under load sets a backoff subheader in the RAR. Every UE reading that PDU -- including UEs whose RAPID is not present -- waits a uniformly random time in [0, BI] before its next attempt, which spreads a thundering herd without any per-UE signalling.
| Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| ms | 0 | 10 | 20 | 30 | 40 | 60 | 80 | 120 |
| Index | 8 | 9 | 10 | 11 | 12 | 13 | 14-15 | |
|---|---|---|---|---|---|---|---|---|
| ms | 160 | 240 | 320 | 480 | 960 | 1920 | reserved |
Table 7. Backoff parameter values, TS 38.321 Table 7.2-1.
12. Failure Modes and What Each One Means
preambleTransMax produces one MAC event with four possible RRC meanings.| Failure | Detected by | Immediate UE action | Diagnostic pointer |
|---|---|---|---|
No RAR within ra-ResponseWindow | MAC | Increment counter, ramp power, draw a new preamble, apply backoff, retry | Uplink coverage, PRACH configuration mismatch, or gNB PRACH detector threshold. If TA values in successful attempts are large, suspect the CP/format limit (§6.1). |
| RAR received but RAPID does not match | MAC | Treat as no RAR for this UE; the PDU belonged to others | Normal under load. Persistent, with high load, means preamble collision -- consider more preambles per SSB or more ROs. |
MSG3 sent, no MSG4 before ra-ContentionResolutionTimer | MAC | Restart from MSG1; counter incremented | MSG3 grant too small or MCS too aggressive; or the UE lost contention. Check whether group B was selected with inadequate headroom. |
| MSG4 CE does not echo own identity | MAC | Contention lost. Restart from MSG1 without incrementing the power ramping counter | Pure collision. The preamble was fine, so ramping would only add interference. |
preambleTransMax reached | MAC -> RRC | Random Access problem indication to RRC; MAC stops | Meaning depends on trigger -- see the table in §1. |
msgB-ResponseWindow expiry (2-step) | MAC | Ramp and retry MSGA up to msgA-TransMax, then fall back to 4-step | msgA-RSRP-Threshold set too permissively for the coverage; UEs are choosing 2-step where the payload cannot survive. |
fallbackRAR received | MAC | Not a failure. Retransmit payload as MSG3 on the granted PUSCH | A high fallback rate is the signal -- it means the preamble link is fine but the MSGA PUSCH is not. |
Table 8. RACH failure modes, what the UE does, and what each one points at.
Two of these -- RAPID mismatch and MSG4 identity mismatch -- are expected in any loaded cell and are not faults. Only their rate is informative. The two that always deserve attention are preambleTransMax exhaustion and contention-resolution-timer expiry, because both cost a full procedure restart.
13. Configuration Reference (ASN.1 and Ranges)
The broadcast configuration lives at SIB1 -> servingCellConfigCommon -> uplinkConfigCommon -> initialUplinkBWP -> rach-ConfigCommon. Abridged to the fields that matter for the procedure:
RACH-ConfigCommon ::= SEQUENCE {
rach-ConfigGeneric RACH-ConfigGeneric,
totalNumberOfRA-Preambles INTEGER (1..63) OPTIONAL,
ssb-perRACH-OccasionAndCB-PreamblesPerSSB CHOICE {
oneEighth ENUMERATED {n4,n8,n12,...,n64},
oneFourth ENUMERATED {n4,n8,n12,...,n64},
oneHalf ENUMERATED {n4,n8,n12,...,n64},
one ENUMERATED {n4,n8,n12,...,n64},
two ENUMERATED {n4,n8,...,n32},
four INTEGER (1..16),
eight INTEGER (1..8),
sixteen INTEGER (1..4)
} OPTIONAL,
groupBconfigured SEQUENCE {
ra-Msg3SizeGroupA ENUMERATED {b56,b144,b208,b256,...,b1000},
messagePowerOffsetGroupB ENUMERATED {minusinfinity,dB0,dB5,...,dB18},
numberOfRA-PreamblesGroupA INTEGER (1..64)
} OPTIONAL,
ra-ContentionResolutionTimer ENUMERATED {sf8,sf16,...,sf64},
rsrp-ThresholdSSB RSRP-Range OPTIONAL,
prach-RootSequenceIndex CHOICE {
l839 INTEGER (0..837),
l139 INTEGER (0..137)
},
msg1-SubcarrierSpacing SubcarrierSpacing OPTIONAL,
restrictedSetConfig ENUMERATED {unrestrictedSet,
restrictedSetTypeA,
restrictedSetTypeB},
msg3-transformPrecoder ENUMERATED {enabled} OPTIONAL
}
RACH-ConfigGeneric ::= SEQUENCE {
prach-ConfigurationIndex INTEGER (0..255),
msg1-FDM ENUMERATED {one,two,four,eight},
msg1-FrequencyStart INTEGER (0..maxNrofPhysicalResourceBlocks-1),
zeroCorrelationZoneConfig INTEGER (0..15),
preambleReceivedTargetPower INTEGER (-202..-60),
preambleTransMax ENUMERATED {n3,n4,n5,n6,n7,n8,n10,
n20,n50,n100,n200},
powerRampingStep ENUMERATED {dB0,dB2,dB4,dB6},
ra-ResponseWindow ENUMERATED {sl1,sl2,sl4,sl8,sl10,
sl20,sl40,sl80}
}Listing 1. Abridged from TS 38.331. ... marks omitted enumeration members and extension markers.
14. Illustrative Message Traces
Illustrative trace. Field names and encodings follow 3GPP; the values are constructed for this document and are not a capture from any deployed or lab network.
14.1 The broadcast configuration the UE starts from
SIB1
servingCellConfigCommon
uplinkConfigCommon
initialUplinkBWP
rach-ConfigCommon
rach-ConfigGeneric
prach-ConfigurationIndex ....... 159 -- format B4, every 10 ms
msg1-FDM ....................... four -- 4 ROs side by side
msg1-FrequencyStart ............ 12 -- PRB offset in the BWP
zeroCorrelationZoneConfig ...... 11
preambleReceivedTargetPower .... -104 -- dBm
preambleTransMax ............... n10
powerRampingStep ............... dB4
ra-ResponseWindow .............. sl10
totalNumberOfRA-Preambles ....... 56 -- 8 reserved for CFRA
ssb-perRACH-OccasionAndCB-PreamblesPerSSB
one ........................... n56
groupBconfigured
ra-Msg3SizeGroupA ............. b56
messagePowerOffsetGroupB ...... dB10
numberOfRA-PreamblesGroupA .... 48
ra-ContentionResolutionTimer .... sf64
rsrp-ThresholdSSB ............... 42 -- RSRP-Range -> -114 dBm
prach-RootSequenceIndex
l139 .......................... 22
restrictedSetConfig ............. unrestrictedSetListing 2. rach-ConfigCommon as it would appear in a decoded SIB1.
14.2 MSG1 and MSG2
12:04:31.882 [MAC-UL] RA procedure initiated
trigger ................ initialAccess (RRC_IDLE)
ra-Type ................ 4-step (2-step not configured)
selected SSB ........... idx 2, RSRP -96 dBm (> -114 threshold)
preamble group ......... A (Msg3 56 bits <= b56)
ra-PreambleIndex ....... 23 (random, 0..47 in group A)
PRACH occasion ......... SFN 132, slot 19, symbol 4, f_id 1
RA-RNTI ................ 1391 (see the worked example, S7)
PREAMBLE_POWER_RAMPING_COUNTER 1
P_PRACH ................ 14.0 dBm (target -104 + PL 118)
12:04:31.887 [PHY-DL] PDCCH found, DCI 1_0, CRC scrambled by RA-RNTI 1391
-> PDSCH 32 PRB, MCS 4
12:04:31.888 [MAC-DL] RAR MAC PDU, 9 octets
subPDU 1 E=1 T=0 BI=3 -- 30 ms backoff advertised
subPDU 2 E=0 T=1 RAPID=23 -- our preamble, match
MAC RAR
R ...................... 0
Timing Advance Command . 245 -> N_TA 125440 T_c ~ 63.8 us
UL Grant ............... 0x0A3C81
freq hopping ......... 0
PUSCH freq alloc ..... 6 PRB from PRB 18
PUSCH time alloc ..... k2=3, S=0, L=14
MCS .................. 2
TPC for MSG3 ......... 0 dB
CSI request .......... 0
Temporary C-RNTI ....... 0x4601
-- RAPID matched: stop ra-ResponseWindow, apply TA, send MSG3Listing 3. Preamble transmission and a matching RAR, including the backoff subheader that a loaded cell would set.
14.3 MSG3 and MSG4
12:04:31.892 [MAC-UL] MSG3 on PUSCH, TC-RNTI 0x4601, 8 octets
CCCH SDU (48 bits carried onward for contention resolution)
RRCSetupRequest
ue-Identity
randomValue .......... 0x3F2A19C4B7 -- 39-bit random
establishmentCause ..... mo-Signalling
spare .................. 0
12:04:31.902 [MAC-DL] PDSCH to TC-RNTI 0x4601, 42 octets
MAC subheader LCID=62 (UE Contention Resolution Identity)
UE Contention Resolution Identity 48 bits
= 0x1F3F2A19C4B7 -- first 48 bits of our MSG3 CCCH SDU
MAC subheader LCID=0 (CCCH)
RRCSetup
rrc-TransactionIdentifier .. 0
radioBearerConfig
srb-ToAddModList srb-Identity 1
masterCellGroup ............ (SEQUENCE, 214 bytes)
12:04:31.902 [MAC] Contention Resolution Identity matches own MSG3
-> RA procedure successfully completed
-> TC-RNTI 0x4601 promoted to C-RNTI
-> stop ra-ContentionResolutionTimer
12:04:31.910 [RRC-UL] RRCSetupComplete on SRB1 (DCCH)
selectedPLMN-Identity ...... 1
dedicatedNAS-Message ....... (NAS Registration Request)Listing 4. Contention resolution succeeding: the echoed 48-bit identity is the whole mechanism.
14.4 A failing procedure
12:07:14.201 [MAC-UL] RA initiated trigger=initialAccess SSB idx 5 RSRP -119 dBm
12:07:14.201 [MAC-UL] preamble 31 counter 1 P_PRACH 19.0 dBm
12:07:14.211 [MAC] ra-ResponseWindow expired, no RAR
12:07:14.229 [MAC-UL] preamble 07 counter 2 P_PRACH 23.0 dBm (P_CMAX)
12:07:14.239 [MAC] ra-ResponseWindow expired, no RAR
12:07:14.244 [MAC] SSB reselected: idx 5 -> idx 6, RSRP -117 dBm
12:07:14.244 [MAC] spatial filter changed -> counter NOT incremented
12:07:14.262 [MAC-UL] preamble 44 counter 2 P_PRACH 23.0 dBm
... attempts 4..9 elided, all at 23.0 dBm ...
12:07:14.612 [MAC-UL] preamble 12 counter 10 P_PRACH 23.0 dBm
12:07:14.622 [MAC] ra-ResponseWindow expired, no RAR
12:07:14.622 [MAC] PREAMBLE_TRANSMISSION_COUNTER = preambleTransMax (n10)
12:07:14.622 [MAC] -> Random Access problem indication to RRC
12:07:14.622 [RRC] T300 still running; RA problem during establishment
12:07:14.622 [RRC] -> connection establishment failure
12:07:14.622 [RRC] -> store connEstFailReport (measured RSRP, numberOfPreamblesSent 10)
12:07:14.623 [RRC] -> to RRC_IDLE, perform cell reselectionListing 5. Ten attempts, eight of them at maximum power, ending in a connection establishment failure rather than an RLF -- because the trigger was initial access.
Note the counter behaviour at 12:07:14.244. The SSB change means attempt 3 reuses counter value 2, so the power is unchanged. Nine of the ten attempts in this trace were transmitted at P_CMAX -- the ramping configuration had no effect on the outcome, and tuning powerRampingStep would not have helped. The connEstFailReport the UE stores here is retrievable by the next cell it connects to, which is the intended way to diagnose exactly this.
15. Release Deltas: Rel-15 to Rel-18
| Release | Change | Why it matters when reading RACH |
|---|---|---|
| Rel-15 | 4-step CBRA and CFRA; SSB-to-RO association; group A/B; long and short preamble formats | The baseline. Everything in §3 and §5 is Rel-15. |
| Rel-16 | 2-step RACH (MSGA/MSGB, msgA-* configuration, MSGB-RNTI, fallbackRAR) | Two response windows and two attempt counters now coexist; a trace can switch flavour mid-procedure. |
| Rel-16 | NR-U: consistent LBT failure as an RA trigger; RACH on unlicensed spectrum | A RACH failure can now be a channel access failure with no radio problem at all. |
| Rel-17 | RedCap: separate initialUplinkBWP-RedCap, separate PRACH resources, featureCombination gating | Two UE classes can use disjoint RACH resources in the same cell; preamble indices are no longer cell-unique across classes. |
| Rel-17 | Small Data Transmission (RA-SDT) -- user data in MSGA/MSG3 from RRC_INACTIVE | A completed RACH no longer implies a transition to RRC_CONNECTED. |
| Rel-17 | NTN: ta-Common, extended ra-ResponseWindow, UE-computed pre-compensation | The 12-bit TA field alone no longer describes the total advance (§9). |
| Rel-17 | Slice-based and coverage-based RACH prioritisation (ra-PrioritizationFor*) | Two UEs in the same cell can legitimately show different backoff and ramping behaviour. |
| Rel-18 | LTM (L1/L2-triggered mobility) -- cell switch with or without RACH at the target | A successful mobility event may contain no RACH at all; absence of RACH is no longer evidence of no handover. |
| Rel-18 | Network-controlled repeaters; further NTN and energy-saving refinements | Repeater-side timing adds delay that appears in TA without any UE movement. |
Table 9. RACH-relevant changes by release. Feature presence should always be confirmed against the UE capability exchange -- see the companion UE Capability document.
16. Reading RACH in Logs: A Checklist
1. Find the trigger first. Everything downstream is interpreted differently depending on it (§1). If the log does not state it, infer it from what RRC was doing: T300 running means initial access, T304 means handover, T319 means resume.
2. Establish CBRA or CFRA. A dedicated ra-PreambleIndex in a preceding reconfigurationWithSync or PDCCH order means CFRA, and contention resolution should be absent. Its presence in a supposed handover means the CFRA resource was unavailable -- worth investigating on its own.
3. Check the preamble index against the group boundary. An index below numberOfRA-PreamblesGroupA is group A; at or above it is group B and implies a large MSG3 with adequate headroom.
4. Recompute the RA-RNTI from the logged occasion (§7). A mismatch against the RNTI the UE actually monitored is a configuration or frame-timing problem, and it is silent otherwise.
5. Read the TA command as a distance (§9) and sanity-check it against the cell you believe answered.
6. Count attempts, then check the power on each. Many attempts at constant power means either powerRampingStep = dB0, or P_CMAX clipping, or repeated spatial filter changes suppressing the counter (§10). These three look identical in a naive read and have entirely different fixes.
7. Distinguish the four no-progress cases: no RAR, RAPID mismatch, no MSG4, MSG4 identity mismatch (§12). They are four different problems and only the first two can be helped by more power.
8. For 2-step, count fallbacks separately from failures. A fallbackRAR is a successful preamble. A high fallback rate with a low failure rate means msgA-RSRP-Threshold is too low, not that coverage is bad.
17. Glossary
| Term | Expansion | Meaning in this document |
|---|---|---|
| PRACH | Physical Random Access Channel | The uplink physical channel that carries preambles; occupies specific PRBs and symbols set by prach-ConfigurationIndex and msg1-FDM. |
| RO | PRACH Occasion | One time-frequency instance in which a preamble may be sent, identified by (s_id, t_id, f_id). |
| RAPID | Random Access Preamble Identifier | The 6-bit echo of the transmitted preamble index in a RAR subheader; how a UE finds its own RAR in a shared PDU. |
| RA-RNTI | Random Access RNTI | Computed from the RO, not from any UE identity. Addresses MSG2. |
| MSGB-RNTI | -- | The 2-step equivalent, offset by 17920 so the two never collide. |
| TC-RNTI | Temporary C-RNTI | Assigned in the RAR; becomes the C-RNTI on winning contention resolution, discarded on losing. |
| CBRA / CFRA | Contention-Based / Contention-Free Random Access | Distinguished solely by who chose the preamble (§2). |
| MSGA / MSGB | -- | The 2-step messages: preamble+payload, and the combined response. |
| N_CS | Zero-correlation zone size | Set by zeroCorrelationZoneConfig. Governs cyclic shift spacing, and so preambles per root sequence. |
| Zadoff-Chu | -- | Constant-amplitude zero-autocorrelation sequence family; cyclic shifts of one root stay mutually orthogonal, which is what lets many preambles share one occasion. |
| N_TA | Timing advance in T_c units | The uplink transmission advance the UE applies; derived from the RAR TA command (§9). |
| P_CMAX | UE maximum configured output power | The ceiling that makes late ramping steps ineffective (§10). |
18. References
- 3GPP TS 38.321 -- NR MAC protocol specification. Clause 5.1 (Random Access procedure), 5.1.1 (initialisation and triggers), 5.1.2 (resource selection), 5.1.3 / 5.1.3a (preamble / MSGA transmission), 5.1.4 / 5.1.4a (RAR / MSGB reception, RA-RNTI and MSGB-RNTI), 5.1.5 (contention resolution), 5.1.6 (completion), 6.1.5 / 6.1.5a (RAR and MSGB MAC PDU), 6.2.3 (MAC RAR), 6.1.3.3 (UE Contention Resolution Identity CE), Table 7.2-1 (backoff values).
- 3GPP TS 38.213 -- Physical layer procedures for control. Clause 4.2 (timing advance), clause 7.4 (PRACH power control), clause 8 (random access procedure, SSB-to-RO association, RAR window).
- 3GPP TS 38.211 -- Physical channels and modulation. Clause 6.3.3 (preamble generation), Tables 6.3.3.1-1 / 6.3.3.1-2 (formats), Tables 6.3.3.2-2 to 6.3.3.2-4 (PRACH configuration index).
- 3GPP TS 38.331 -- RRC protocol specification.
RACH-ConfigCommon,RACH-ConfigGeneric,RACH-ConfigDedicated,MsgA-ConfigCommon,BeamFailureRecoveryConfig,UE-TimersAndConstants. - 3GPP TS 38.300 -- NR overall description. Clause 9.2.6 (random access procedure overview and its place in the state model).
- 3GPP TS 38.104 / 38.133 -- RF and RRM requirements, for the measurement accuracy that underpins
rsrp-ThresholdSSBandmsgA-RSRP-Thresholddecisions.
Companion documents in this set
- 01 Registration Process -- what MSG3's NAS payload goes on to do.
- 02 Radio Frame Structure -- SFN, slots and the symbol numbering that s_id and t_id index.
- 04 Timing Advance -- the TA maintenance loop after the initial command in §9.
- 06 Channel Mapping -- how CCCH/UL-SCH/PUSCH relate for MSG3.
- 07 MAC PDU and Control Elements -- the general subheader format that §8 specialises.
- 10 BSR, PHR, SR -- the SR mechanism that RACH substitutes for.
- 12 Beam Failure Recovery -- a CFRA user.
- 16 RLM and RLF -- where
preambleTransMaxexhaustion goes in RRC_CONNECTED. - 17 System Information / 18 MIB and SIB1 IEs -- where
rach-ConfigCommonis broadcast. - 22-25 Handover documents -- the largest CFRA user.