APB Series — APB-03: Write Transfers — VLSI Trainers
APB Series · APB-03

Write Transfers

The complete mechanics of an APB write transfer — Setup phase, Access phase, how PREADY inserts wait states, which signals must remain stable and for how long, and back-to-back write transfers to the same peripheral.

📋 The Two-Phase Transfer Model

Every APB transfer — read or write — follows the same two-phase structure. Understanding this structure is the foundation for everything else in the APB protocol.

Idle
PSELx = 0
PENABLE = 0
No transfer in progress
Setup Phase
PSELx = 1
PENABLE = 0
Address, control, data presented
Always exactly 1 cycle
Access Phase
PSELx = 1
PENABLE = 1
Transfer completes when PREADY = 1
1+ cycles (wait states if PREADY=0)
Idle / Next
PENABLE deasserted
PSELx deasserted (or new Setup)
Transfer done

The Setup phase always lasts exactly one clock cycle. There are no wait states during Setup — PENABLE is always asserted on the very next rising edge after PSELx. The Requester uses the Setup cycle to present the address, write data, and control signals to the Completer so the peripheral has one full cycle to decode the address and prepare for the transfer.

The Access phase lasts at least one cycle. If the Completer deasserts PREADY, additional cycles are inserted. There is no maximum on the number of wait state cycles — a peripheral could theoretically hold PREADY LOW indefinitely (though this would deadlock the system bus and is never done in practice).

At the end of the Access phase (when PREADY goes HIGH), PENABLE is deasserted. If another transfer to the same peripheral follows immediately, PSELx remains asserted and Setup begins again on the next cycle. If no further transfer is required, PSELx is also deasserted and the interface returns to IDLE.

Write with No Wait States

The simplest APB write: the Completer asserts PREADY in the first Access cycle, completing the transfer in exactly two clock cycles total.

PCLK PADDR PWRITE PSELx PENABLE PWDATA PREADY T0 T1 T2 T3 T4 SETUP ACCESS Addr 1 Data 1 Setup: PSEL↑ PENABLE=0 Access: PENABLE↑ PREADY=1 Transfer complete
Figure 1 — Write transfer with no wait states. T1: Setup phase begins — PSELx asserted, PADDR/PWRITE/PWDATA valid. T2: Access phase begins — PENABLE asserted, PREADY=1 immediately. T3: Transfer completes — write data accepted, PSELx and PENABLE deasserted.

Walking through each clock edge:

Write with Wait States

A Completer that needs more than one Access cycle drives PREADY LOW during the Access phase. Each cycle with PREADY=0 inserts one wait state. The number of wait states is unlimited — the Completer can hold PREADY LOW for as many cycles as it needs.

T0 T1 T2 T3 T4 T5 T6 SETUP ACCESS (with wait states) PCLK PADDR PWRITE PSELx PENABLE PWDATA PREADY Addr 1 Data 1 PREADY=0 — wait states — all signals must hold Setup Wait Wait Complete
Figure 2 — Write transfer with two wait states. T2: Access phase begins, PENABLE asserted. T3–T4: Completer holds PREADY=0, inserting two wait states. All bus signals (PADDR, PWRITE, PWDATA, PSELx, PENABLE) must remain completely stable. T5: PREADY asserted — transfer completes on this rising edge. T6: Interface returns to IDLE.

The key thing to understand about wait states: the entire APB bus is frozen while PREADY is LOW. Nothing changes — not the address, not the write data, not the direction, not the select or enable signals. The Completer is the only thing that can change state, and it does so internally while keeping PREADY LOW. When it is ready to accept the write, it drives PREADY HIGH and the transfer completes on the next rising edge.

The Requester (bridge) cannot abort a transfer once PENABLE is asserted. Once the Access phase has started, the bridge must hold all signals stable and wait for PREADY regardless of how long it takes. If a timeout mechanism exists, it is implemented in the bridge’s own logic — not in the APB protocol itself.

📋 Signal Stability Rules

The spec defines precisely which signals must remain stable during a write transfer. This is one of the most important rules for implementers — violating it causes undefined peripheral behaviour.

SignalMust be stable fromUntilNotes
PADDRStart of Setup phaseTransfer completes (PREADY=1)Must not change during wait states
PWRITEStart of Setup phaseTransfer completesMust be HIGH for entire write transfer
PSELxStart of Setup phaseTransfer completesMust not be deasserted during wait states
PENABLEStart of Access phaseTransfer completesAlready asserted; must stay asserted through wait states
PWDATAStart of Setup phaseTransfer completesActive write byte lanes must be valid and stable
PSTRBStart of Setup phaseTransfer completesAPB4+ only; must stay stable like PWDATA
PPROTStart of Setup phaseTransfer completesAPB4+ only; same stability requirement as PADDR
PAUSERStart of Setup phaseTransfer completesAPB5+ only; must be same in Setup and Access
PWUSERStart of Setup phaseTransfer completesAPB5+ only; write only; must be same in Setup and Access

The spec states these signals must be stable across all wait state cycles — not just between Setup and Access. A peripheral’s register write logic typically latches PWDATA on the cycle where PSELx, PENABLE, and PREADY are all HIGH. If PWDATA changes during a wait state, the peripheral’s latch would capture the wrong data.

PREADY can take any value when PENABLE is LOW. This means PREADY is irrelevant during the Setup phase. Peripherals that tie PREADY permanently HIGH are fully spec-compliant — they simply always complete in the minimum two cycles.

📋 Back-to-Back Write Transfers

When the APB bridge needs to write to the same peripheral on consecutive cycles, it can keep PSELx asserted and immediately start a new Setup phase after the previous transfer completes. This saves the one idle cycle that would otherwise occur between separate transfers.

T0 T1 T2 T3 T4 T5 SETUP 1 ACCESS 1 SETUP 2 ACCESS 2 PCLK PADDR PSELx PENABLE PWDATA Addr 1 Addr 2 Data 1 Data 2 ↑ PENABLE deasserted new Setup begins
Figure 3 — Back-to-back write transfers to the same peripheral. PSELx remains HIGH throughout. PENABLE is deasserted for one cycle at T3 (the Setup phase of transfer 2), then reasserted at T4 (Access phase of transfer 2). PADDR and PWDATA change at T3 to reflect the new transfer’s address and data.

The critical point: PENABLE must be deasserted between every transfer, even in back-to-back mode. The Setup phase is mandatory for every transfer. The Completer uses the deasserted PENABLE as the signal that a new transfer is beginning — it distinguishes a new write from a wait state of the previous write.

Back-to-back only works to the same Completer. If the second transfer targets a different peripheral, the bridge must also change PSELx — deassert the old Completer’s PSELx and assert the new one. Typically the bridge goes through one IDLE cycle between transfers to different peripherals, though the spec does not require it.

📋 APB2 vs APB3 Write Behaviour

The key difference between APB2 and APB3 write transfers is PREADY:

AspectAPB2APB3+
PREADY signalNot present — Completer does not have this signalPresent — Completer drives PREADY
Transfer durationAlways exactly 2 cycles (fixed)2+ cycles (variable, controlled by PREADY)
Wait statesNot possible — no mechanism to extendInserted by driving PREADY=0 during Access
Connection to APB3 bridgeTie PREADY input HIGH at bridge. Default value = 1’b1.Connect PREADY output from peripheral to bridge
Error reportingNot possible — no PSLVERR signalPSLVERR asserted with PREADY to signal error

When you have an APB3 bridge and an APB2 peripheral, the solution is always the same: tie the PREADY input for that peripheral’s slot to 1’b1. This makes the bridge behave as if PREADY is always asserted — effectively a two-cycle fixed transfer for every access to that peripheral.

📋 Quick Reference

ItemRule
Minimum write transfer duration2 cycles — one Setup + one Access with PREADY=1
Setup phase durationAlways exactly 1 cycle — no wait states during Setup
Access phase duration1 cycle minimum; extended by 1 per PREADY=0 cycle
PENABLE during SetupMust be LOW (deasserted)
PENABLE during AccessMust be HIGH (asserted) and remain HIGH through all wait states
PREADY during SetupIrrelevant — can be any value; ignored by Requester
Transfer completes whenPSELx=1 AND PENABLE=1 AND PREADY=1 on rising PCLK edge
Signals stable during wait statesPADDR, PWRITE, PSELx, PENABLE, PWDATA, PSTRB, PPROT, PAUSER, PWUSER
APB2 peripheral with APB3 bridgeTie PREADY=1 for that peripheral — fixed 2-cycle transfers
Back-to-back same peripheralPSELx stays HIGH; PENABLE deasserted for 1 cycle (new Setup), then asserted again
Back-to-back different peripheralPSELx changes; typically one IDLE cycle between transfers
Data latched by Completer atRising PCLK edge when PSELx=1, PENABLE=1, PREADY=1, PWRITE=1
Scroll to Top