5G NR MAC Random Access Procedure
Random access is the MAC procedure used when the UE needs to obtain or re-obtain uplink access and move into a state where scheduled uplink signaling or data transmission can continue. Use it together with the 5G NR MAC Overview page when you want the wider MAC context.
This page focuses on the MAC view of NR random access. PHY handles the PRACH preamble transmission and related radio resources, but MAC is where Random Access Response handling, Msg3 use, contention resolution, and timing-alignment continuation become visible. For engineers, random access is one of the most important MAC procedures because many access failures happen after preamble detection, not before it.
| Technology | 5G NR |
|---|---|
| Protocol area | MAC procedure |
| Main specification | 3GPP TS 38.321 |
| Architecture context | 3GPP TS 38.300 |
| Release baseline | Release 18 |
| Procedure families | 4-step random access and 2-step random access |
| Main messages or entities | PRACH preamble, Random Access Response, Msg3, contention resolution, MsgA, MsgB |
| Why it matters | Initial access, uplink synchronization, recovery, re-entry, and many access-failure investigations depend on it |
Procedure purpose
Random access is used when the UE must establish or recover the ability to send uplink information under network control. At MAC level, that means obtaining the necessary response, using the granted uplink opportunity correctly, and reaching a state where later signaling or traffic can continue. That later continuation often leads directly into RRC connection setup or another higher-layer recovery path.
In practice, random access is not only an entry procedure. It is also part of uplink synchronization maintenance, recovery, and several mobility or re-entry cases where the UE cannot simply start sending scheduled uplink traffic without first re-establishing the required MAC and PHY conditions. That makes it closely related to Timing Advance and the broader MAC procedure set.
Preconditions
- The UE needs uplink access, re-entry, or timing-related continuation that cannot proceed with ordinary scheduled uplink use alone.
- The random access configuration is provided through higher-layer signaling and cell configuration context, typically with relevant setup visible through RRC configuration.
- The UE has an applicable random access occasion and knows the relevant parameters for the active access method.
- Procedure interpretation must distinguish whether the case is 4-step or 2-step random access.
Trigger conditions
| Trigger area | Why random access starts |
|---|---|
| Initial access | The UE needs to start the access chain before normal dedicated signaling can continue. |
| Uplink synchronization recovery | The UE needs to recover timing-aligned uplink operation, often alongside Timing Advance interpretation. |
| Re-entry or recovery case | The UE needs a controlled way to resume uplink procedure progression. |
| Mobility-related context | The procedure or target-cell state requires access continuation before later signaling proceeds. |
4-step and 2-step random access
| Variant | Main MAC view | Why it matters in logs |
|---|---|---|
| 4-step random access | Classical sequence with Random Access Response, Msg3, and contention resolution. | Most detailed failure analysis happens across response handling, Msg3 progression, and contention resolution. |
| 2-step random access | Compressed access method using MsgA and MsgB. | Failure visibility and timing interpretation differ from the classical 4-step sequence and must be analyzed differently. |
Step-by-step flow
For 4-step random access, the PHY-side preamble is only the beginning. MAC becomes central when the UE processes the Random Access Response, receives or derives the relevant uplink grant and timing context, transmits Msg3 on UL-SCH, and then waits for successful contention resolution before later signaling proceeds.
For 2-step random access, MsgA and MsgB compress the procedure structure. That changes where timing, response interpretation, and failure visibility appear. Engineers should therefore confirm the active access type before diagnosing a trace, then correlate it with PHY initial access and the later RRC continuation flow.
4-step random access
PRACH preamble -> Random Access Response -> Msg3 on UL-SCH -> Contention Resolution -> later signaling continues
2-step random access
MsgA -> MsgB -> later signaling continues Messages, channels, and identifiers
| Item | Role in random access | Engineering note |
|---|---|---|
| PRACH preamble | PHY-side access indication used to begin the random access attempt. | Important, but not sufficient to prove successful procedure completion. |
| Random Access Response (RAR) | Provides the MAC-visible response that enables continuation after the preamble. | RAR interpretation is one of the most critical checks in 4-step RA. |
| Msg3 | Uplink message sent using the granted opportunity after RAR. | Many practical failures occur here or immediately after it. |
| Contention resolution | Confirms the access attempt resolved correctly so later signaling can continue. | If this does not complete correctly, the procedure may look partially successful but still fail. |
| MsgA and MsgB | Key combined procedure elements in 2-step RA. | They change where procedure visibility appears compared with 4-step RA. |
| RA-RNTI, TC-RNTI, C-RNTI context | Identifiers used during access progression and later continuation. | Identifier interpretation is important in detailed trace analysis. |
| RACH and UL-SCH | Transport-channel context used during access progression. | RACH is not a normal payload path; Msg3 uses UL-SCH after the response stage. |
Success path
A successful random access attempt means more than preamble detection. The response must be handled correctly, the granted uplink opportunity must be used correctly, timing-related continuation must remain valid, and the procedure must reach a state where later RRC or user-plane progression can continue as expected.
In 4-step random access, that usually means the UE reaches successful progression beyond Msg3 and contention resolution. In 2-step random access, success means the compressed procedure provides a stable continuation into later signaling.
Failure paths
| Failure point | What usually goes wrong | Why engineers care |
|---|---|---|
| Response stage | The Random Access Response is not received, not interpreted correctly, or does not lead to stable continuation. | This is a common reason why preamble success does not become procedure success. |
| Msg3 stage | The UE does not transmit Msg3 correctly or the network does not decode or continue it correctly. | Many setup failures are effectively Msg3-path failures. |
| Contention resolution stage | The procedure never resolves into a stable success state. | The trace can look partially successful while later signaling still fails. |
| Timing-alignment continuation | The access attempt starts but uplink timing does not remain usable for later progression. | This often explains early success followed by unstable uplink continuation and should be checked with Timing Advance. |
| 2-step interpretation | The procedure is analyzed as if it were 4-step, or vice versa. | Wrong procedure assumptions can invalidate the whole diagnosis. |
Call-flow placement
| Procedure area | How random access appears |
|---|---|
| Initial access and setup | Random access provides the entry path before later dedicated signaling can proceed. |
| RRC connection establishment | Msg3 and later continuation are part of the early connected-mode setup chain. |
| Recovery or re-entry | Random access may be used to regain usable uplink procedure state. |
| Mobility-related continuation | Certain mobility cases require access progression before later signaling continues. |
Log-analysis notes
When reading logs, separate PHY success from MAC success. A visible preamble only proves that the access attempt started. It does not prove that Random Access Response handling, Msg3 progression, contention resolution, or timing alignment succeeded. Use the PHY initial access view and the channel-mapping reference together when decoding the full sequence.
A good random-access analysis follows the full continuation chain and correlates it with the later RRC procedure. If the later setup or resume signaling stalls, the access attempt may have failed at MAC even when the earliest radio indicators looked healthy. The most common next step is to correlate the trace with RRC Connection Setup and Timing Advance.
Troubleshooting
| Symptom | MAC area to inspect | Why |
|---|---|---|
| Preamble activity is visible but setup does not continue | Random Access Response handling and immediate continuation | The failure may be after preamble detection rather than in the PHY access trigger itself. |
| Early uplink appears but connected signaling never stabilizes | Msg3 progression and contention resolution | Partial access success often fails in these later MAC stages. |
| Access works sometimes but not consistently | Timing alignment continuation, response timing, and procedure type | Intermittent access issues often involve timing sensitivity or wrong assumptions about the active RA variant. |
| The UE seems to reach the cell but uplink remains unusable | Timing Advance context and post-access uplink state | Random access must produce usable uplink continuation, not only a detected attempt. Check Timing Advance. |
| A 2-step trace looks inconsistent when analyzed like 4-step RA | Procedure-family interpretation | Using the wrong procedure model leads to wrong conclusions very quickly. |
FAQ
What is 5G NR MAC random access?
It is the MAC procedure used when the UE needs to obtain or re-obtain uplink access and continue into stable, scheduler-controlled uplink procedure progression.
Is random access only a PHY topic?
No. PHY handles the preamble transmission and early radio resources, but MAC is central for Random Access Response handling, Msg3 use, contention resolution, and timing-related continuation.
Why can random access fail after the preamble succeeds?
Because later MAC stages such as response handling, Msg3 progression, contention resolution, or timing-alignment continuation may still fail even when the preamble was detected.
What is Msg3 in random access?
Msg3 is the uplink message transmitted after the Random Access Response using the granted uplink opportunity in the 4-step random access procedure.
Why should 2-step and 4-step random access be analyzed differently?
Because the procedure structure changes where delay, signaling visibility, identifiers, and failure patterns appear in the trace.
Why is timing alignment important in random access?
Because the goal is not only to begin access but to continue into usable uplink operation. A detected attempt without stable timing-aligned continuation is not a complete success.