Full/Half/3-Wire SPI: SDIO Multiplexing & Direction Control
← Back to: I²C / SPI / UART — Serial Peripheral Buses
3-wire SPI is reliable only when SDIO drive ownership is strictly exclusive: enforce a defined Hi-Z turn-around window and a deterministic first-byte/dummy policy.
Use measurable TA budgets, bounded timeouts/recovery, and phase-aware logs so contention becomes preventable and diagnosable.
Scope & Definitions: Full / Half / 3-Wire SPI
This page defines signal ownership and direction handoff across Full-duplex, Half-duplex, and 3-wire (SDIO) SPI variants. The focus is direction control, turn-around (TA), tri-state windows, contention failure modes, and verification hooks.
- “3-wire” describes physical wiring + ownership switching (SDIO), not “3-bit” data width.
- Half-duplex describes time-division (TX phase vs RX phase), which may exist with separate lines or a shared line.
- Wires: MOSI and MISO are separate.
- Ownership: MOSI is master-driven; MISO is slave-driven (natural mutual exclusion).
- Time organization: TX/RX can overlap by clocking; actual overlap depends on device protocol.
- Wires: may still have separate MOSI/MISO, but only one direction is valid per phase.
- Ownership: direction changes across phases; TA/dummy cycles may be required by device.
- Time organization: command/address → TX phase → TA → RX phase (or reverse).
- Wires: SDIO (shared data), SCLK, CS (plus optional OE/DIR control).
- Ownership: SDIO is master-driven in some phases and slave-driven in others (explicit handoff required).
- Time organization: must define TA + tri-state window to prevent contention (bus fight).
- Direction control: when and how SDIO changes between TX and RX.
- Turn-around (TA): the required gap for one driver to release and the other to safely take over.
- Tri-state window: the “Hi-Z” interval that prevents overlap driving.
- Contention risk: failure modes caused by overlap driving (wrong data, heating, EMI anomalies).
- Phase organization: command/address/TA/data partitioning and who owns SDIO in each phase.
- CPOL/CPHA modes: define sampling edge, but do not define SDIO ownership. → link to the “CPOL/CPHA Modes (0–3)” subpage
- SCLK quality & skew: affects sampling margin, separate from direction handoff rules. → link to the “SCLK Quality & Skew” subpage
- Long-trace SI / termination: deals with reflections/edge integrity; this page focuses on ownership timing. → link to the “Long-Trace SI” subpage
- DMA & throughput tuning: system throughput optimization is handled elsewhere. → link to the “DMA & High Throughput” subpage
| Dimension | Full-duplex | Half-duplex | 3-wire (SDIO) |
|---|---|---|---|
| Wires / pins | MOSI + MISO + SCLK + CS | Often same pins, but TX/RX are time-division | SDIO + SCLK + CS (optional OE/DIR) |
| Ownership model | Naturally separated (low contention risk) | Phase-dependent direction (protocol-driven) | Explicit handoff required (highest contention risk) |
| Required TA / Hi-Z | Usually none for ownership | May require dummy/TA by device spec | Always plan TA + tri-state window |
| Primary limiter | Sampling margin + device timing | Phase scheduling overhead | TA budget + handoff correctness |
| Typical failure mode | Mode mismatch, sampling timing issues | Missing dummy/phase rule, direction phase error | Contention (bus fight), wrong ownership timing |
Note: “primary limiter” is stated at the ownership/timing level. Signal-integrity-specific limits belong to the dedicated SI subpage.
When to Use Which: Decision Rules & Tradeoffs
Selecting Full-duplex, Half-duplex, or 3-wire SPI is primarily a choice about pin budget, throughput pattern, and verification risk. Use the rules below to converge quickly, then validate direction handoff with a turn-around margin check.
- Pin/connector savings: fewer data pins, simpler connectors, fewer isolation channels.
- Cable/route simplification: fewer high-activity nets reduces routing congestion and potential coupling hotspots.
- System-level cost: fewer channels may reduce BOM and assembly complexity.
- Cost trade: direction control + TA constraints increase firmware/verification burden and raise the risk of intermittent faults.
- Choose Full-duplex when sustained throughput matters, bidirectional exchange is frequent, or lowest handoff risk is required.
- Choose Half-duplex when traffic is naturally phased (write then read), devices mandate dummy/TA cycles, or direction changes are infrequent but acceptable.
- Choose 3-wire (SDIO) when pin/isolation/channel cost dominates and the design can enforce strict SDIO ownership, safe defaults, and robust TA margin.
- Avoid 3-wire when multi-slave collisions are likely, streaming is required, or validation bandwidth is limited (intermittent contention is expensive to chase).
- Read-heavy or write-heavy? Direction handoff cost scales with how often the bus changes owners.
- Streaming required? Continuous, low-latency streams often favor Full-duplex or well-structured Half-duplex.
- Shared bus with many slaves? Shared SDIO raises collision risk; strict CS discipline is mandatory.
- Cross-board / cable involved? Handoff margins become more sensitive; prioritize ownership correctness and recovery hooks.
- Validation budget available? 3-wire demands explicit contention testing and TA margin verification across corners.
- Ownership contract: define who drives SDIO in each phase (CMD/ADDR/DATA) and enforce it.
- TA + Hi-Z window: explicitly allocate turn-around time (threshold placeholder: TA ≥ X ns).
- Safe defaults: power-up and reset must default SDIO to input/Hi-Z until ownership is proven.
- Contention containment: add practical protection (e.g., series resistance placeholder: R = X Ω) to limit bus-fight current.
- Verification hooks: logic analyzer triggers for TA, ownership transitions, and intermittent error counters.
3-Wire Signaling Model: SDIO Ownership, Tri-State, Turn-Around
A 3-wire (SDIO) bus is safe only when ownership is explicit: in each phase, exactly one side may actively drive SDIO, and transitions must include a turn-around (TA) interval where SDIO is Hi-Z. The practical goal is to make “who drives SDIO, when” unambiguous, measurable, and enforceable.
| Phase | SDIO Driver | Required condition | Typical failure if violated |
|---|---|---|---|
| CMD | Master | Slave output must be disabled | Contention, corrupt command |
| ADDR | Usually Master | Follow device phase definition | Wrong target, wrong direction |
| TA (turn-around) | Hi-Z (both) | TA ≥ X ns (placeholder) | Intermittent bit errors, heating |
| DATA (Write) | Master | Slave must remain disabled | Write corruption or bus fight |
| DATA (Read) | Slave | Master must be input/Hi-Z | 0xFF/0x00 reads, bit-slip |
- Ownership changes only at phase boundaries (never mid-bit).
- TA is mandatory whenever ownership changes.
- One active driver at a time; the other side must guarantee output-disable.
- Disable master output (GPIO→input or OE=0).
- Wait tDIS(M) (placeholder: X ns or X cycles).
- Allow line to settle (placeholder: tLINE_settle = X ns).
- Enable slave output and begin sampling in the defined window.
- Disable slave output (device or OE=0).
- Wait tDIS(S) (placeholder: X ns).
- Allow line to settle (same settle budget class as above).
- Enable master output only after Hi-Z is confirmed by timing.
Direction handoff is defined as a timing contract. Signal-integrity phenomena are folded into tLINE_settle and handled on the dedicated SI subpage.
- Mechanism: output ↔ input transitions at phase boundaries.
- Critical parameter: mux/config latency (folded into tDIS/tEN).
- Verification hook: confirm SDIO is Hi-Z during TA using timing + logic analyzer.
- Mechanism: OE gates which side can drive SDIO.
- Critical parameter: buffer disable/enable delays (tPZ/tPLZ).
- Verification hook: ensure OE changes only inside TA.
- Mechanism: connect/disconnect SDIO path to prevent overlap driving.
- Critical parameter: enable/disable timing + on-resistance effects (kept at ownership level here).
- Verification hook: confirm stable logic levels before sampling window.
- Reads stuck at 0xFF / 0x00: master did not reach input/Hi-Z before slave drives.
- Intermittent bit errors at higher SCLK: TA margin collapsed (tDIS + settle + tSU not covered).
- First transaction fails after reset: unsafe power-up default (SDIO still output-enabled).
- Device heating or unexpected EMI: brief contention inside TA caused overlap driving.
- Random glitches in Hi-Z window: floating SDIO without a weak bias (define idle level cautiously).
- Contention only on some boards: timing variation in mux latency / buffer tPZ/tPLZ across lots and corners.
Timing Budget: Turn-Around Margin & Sampling Windows
In 3-wire SPI, the usable high-speed limit is often set by turn-around budget, not by the nominal SCLK frequency. A safe handoff requires TA to cover driver release, line settling, and receiver setup before the sampling window opens.
Where tDIS includes MCU mux latency and/or buffer tri-state delay, tLINE_settle is the observable time until SDIO becomes stable, and tSU is the receiver setup requirement before sampling.
- MCU IO switching delay: output-disable and input-enable may take multiple cycles (platform-dependent).
- Tri-state buffer delays: tPZ/tPLZ (disable/enable) add deterministic overhead.
- Bias recovery: weak pull-up/down (if used) needs time to restore a defined level during Hi-Z.
- Input threshold behavior: Schmitt vs CMOS threshold changes what “stable enough” means for sampling.
- Sampling window placement: the receiver must sample only after stability + setup are satisfied (mode specifics are handled elsewhere).
| Term | Represents | Where to get it | Placeholder | If underestimated |
|---|---|---|---|---|
| tDIS(M) | Master output disable → true Hi-Z | MCU datasheet + scope/LA | X ns | Contention in TA, read corruption |
| tPZ/tPLZ | Tri-state buffer disable/enable delay | Buffer datasheet timing | X ns | TA consumed, margin collapses |
| tLINE_settle | Time until SDIO becomes stable enough | Scope measure on SDIO | X ns | Edge not settled at sampling |
| tSU(RX) | Receiver setup before sampling window | Device timing spec | X ns | Sampling too early, bit errors |
| Margin | Remaining TA after all contributors | Computed from filled values | X ns | Intermittent failures across corners |
Hardware Patterns: MCU/FPGA Pin Tricks, OE Buffers, Analog Switches
Stable 3-wire (SDIO) hardware is built around one rule: mutual-exclusion on SDIO driving. The patterns below provide repeatable reference architectures without expanding into long-trace termination details (handled on the SI subpage).
| Pattern | Mutual-exclusion strength | TA overhead driver | Typical risk | Best fit |
|---|---|---|---|---|
| MCU/FPGA direct (pin-mux) | Software-enforced | IO config latency | Missed input/Hi-Z → contention | Lowest BOM, short traces |
| OE tri-state buffer | Hardware-gated | tPZ/tPLZ + OE timing | OE not aligned to TA | Higher SCLK, robust bring-up |
| Analog switch | Path-gated | Enable/disable + settle | Ron/Cpar affects settle | Contention-sensitive systems |
Long-trace termination and detailed SI are handled on the Long-Trace SI subpage; this section focuses on ownership enforcement and contention control.
- Mechanism: the same SDIO pin switches output ↔ input at phase boundaries.
- Key constraint: configuration writes are not instantaneous; the effective delay contributes to tDIS/tEN.
- Must-have: a safe default state (reset/power-up SDIO = input/Hi-Z) before any transaction.
- Verification hook: confirm Hi-Z during TA with timing + logic analyzer, then validate read data stability at the sampling window.
- Mechanism: OE gates which side is allowed to drive SDIO (ownership becomes hardware-enforced).
- Key constraint: buffer disable/enable timing (tPZ/tPLZ) consumes TA and must be budgeted.
- Control rule: OE transitions must occur only inside TA (no mid-data switching).
- Verification hook: monitor OE vs SDIO to ensure zero overlap driving across process/voltage/temperature corners.
- Mechanism: connect/disconnect SDIO path to prevent simultaneous strong driving.
- Key constraint: on-resistance and parasitics (Ron/Cpar) may increase settle time (modeled as tLINE_settle here).
- Control rule: switch state changes only in TA; allow stability before sampling.
- Verification hook: verify logic levels remain valid across temperature and supply variation during read windows.
- Must: safe power-up default (SDIO input/Hi-Z) + explicit TA cycles.
- Recommended: series-R current limiting (X–Y Ω placeholder) and a weak bias if SDIO floats during Hi-Z.
- Optional: short-tolerant drivers / thermal protection / current sensing (system-dependent).
Contention & Line Conditioning: How to Avoid Bus Fight in 3-Wire
Contention (“bus fight”) happens when both sides drive SDIO with opposing values. It is a common field failure because it can be intermittent, temperature-sensitive, and highly dependent on timing corners. The strategy is to recognize contention symptoms early, confirm with fast checks, and apply layered mitigations.
- Stuck reads (0xFF / 0x00): SDIO never truly released before the slave drives.
- Intermittent CRC/bit errors: short overlap driving inside TA causes sporadic corruption.
- Unexpected heating: repeated high-current overlap events during direction changes.
- EMI anomalies: contention creates sharp current transients and supply/ground noise.
- Timing too early/late: TA does not cover tDIS + settle + tSU.
- IO configuration error: SDIO remains output-enabled when it must be input/Hi-Z.
- OE sequencing mismatch: OE toggles outside TA or multiple modules fight over OE control.
- Unsafe defaults: power-up/reset states allow both sides to drive before the first transaction.
- Must: safe default (SDIO input/Hi-Z) + explicit TA cycles + ownership transitions only at phase boundaries.
- Recommended: series-R current limiting (X–Y Ω), weak bias if SDIO floats, single OE controller.
- Optional: contention detection via current/temperature/error counters and event logging for field diagnostics.
Firmware State Machine: Direction Control, Timeouts, Recovery
A robust 3-wire (SDIO) implementation treats direction changes as a first-class state transition. Every wait has a timeout, every failure has a bounded retry policy, and recovery always returns SDIO to a safe known state (input/Hi-Z) before restarting.
- Transaction layer: CMD/ADDR/DATA sequencing and protocol framing.
- Ownership/IO layer: pin-mux / OE / switch control; enforces “one driver at a time.”
- Contract between layers: explicit requests (MASTER_DRIVE / SLAVE_DRIVE / Hi-Z(TA)) with timeout-based acknowledgements.
CPOL/CPHA and detailed sampling-edge rules remain on the SPI mode subpage; this section focuses on ownership transitions, timeouts, and recovery.
- IDLE: SDIO = input/Hi-Z; CS deasserted; clear transaction context.
- CMD / ADDR: request MASTER_DRIVE; transmit command/address; validate framing.
- TA_ENTER: gate/hold SCLK; request Hi-Z(TA); wait for tDIS + settle.
- RX/TX: request SLAVE_DRIVE for reads or MASTER_DRIVE for writes; apply optional dummy/discard rules.
- END: deassert CS; force SDIO input/Hi-Z; record stats; return to IDLE.
- ERROR → RECOVERY: bounded retries; then recovery ladder; always exit with SDIO input/Hi-Z.
- Before switching: stop/gate SCLK (or keep quiet), then enter TA and disable the current driver.
- During TA: wait tDIS(driver_off) + tLINE_settle before enabling the new driver.
- After switching: support optional dummy cycles or discard-first-bit/byte if the target requires alignment.
- At any failure: force SDIO to input/Hi-Z first; then apply recovery steps.
| Parameter | Purpose | Where it comes from | Placeholder | If too small | If too large |
|---|---|---|---|---|---|
| T_OWNERSHIP_TIMEOUT | Max time to complete pin-mux / OE / switch transition | MCU/FPGA timing + buffer tPZ/tPLZ + measurement | X us | False timeouts, excessive retries | Slow recovery from real faults |
| T_DATA_VALID_TIMEOUT | Max time to wait for stable read window | tEN + settle budget + system margin | X us | Intermittent read corruption | Long stalls on missing device |
| T_TRANSACTION_TIMEOUT | Upper bound for a full transaction (frame) | System watchdog policy + expected payload | X ms | Premature abort under load | Slow failure detection |
| RETRY_LIMIT | Maximum retries before recovery | System reliability policy | N | Recovery entered too often | Wastes time on unrecoverable faults |
| DUMMY_CYCLES / DISCARD_FIRST | Alignment after direction switch (device-defined) | Device timing/protocol requirements | X | Bit/byte misalignment | Throughput loss |
Detailed DMA throughput tuning is handled on the DMA subpage; this table focuses on robustness parameters that prevent hangs and silent corruption.
- Level 0 (soft exit): deassert CS → SDIO input/Hi-Z → clear context → restart.
- Level 1 (device soft reset): issue device reset command/register write (device-defined) → wait X ms.
- Level 2 (CS pulse sequence): toggle CS X times with a guard delay to exit stuck internal states.
- Level 3 (bus release): force SDIO input/Hi-Z for X us; re-enter IDLE; retry with safe TA.
- Level 4 (system reset): last resort; use watchdog/power-cycle policy.
Multi-Slave & Shared SDIO: Collision Rules and CS Discipline
Shared SDIO becomes fragile when more than one slave can drive the same wire. The safety condition is strict: only one slave may ever obtain drive permission at a time, and CS transitions must not create transient overlap. CS fanout trees and daisy-chains are handled on the Chip-Select & Fanout subpage; this section defines the discipline and failure patterns.
- One active CS: at most one CS asserted for any SDIO transaction.
- Hi-Z when not selected: each slave must guarantee SDIO output is tri-stated when CS is inactive.
- Safe power-up defaults: all CS lines default to “not selected” (defined pull state).
- Guard time: enforce TA_GUARD = X cycles around CS changes and direction changes.
- Single owner controller: one state machine controls CS + ownership transitions (no competing writers).
- Recovery order: deassert CS first, then force SDIO input/Hi-Z before attempting retries.
- CS guard time: add a guard delay around CS edges (X us placeholder) to avoid overlap selection.
- Defined CS defaults: ensure power-up CS = not selected via pull states; avoid floating CS.
- Enforced TA_GUARD: treat TA as a mandatory protection period for both direction change and CS switching.
- Centralized control: one state machine owns CS + ownership decisions; prevent competing firmware writers.
H2-9 · Power-Up, Brown-Out, Hot-Plug: Preventing Accidental Select and Ghost Power
Risk checklist (real-world failure mechanisms)
- Power-up tri-state: MCU pins may start as Hi-Z. If CS floats, narrow pulses or unintended levels can accidentally select sensitive devices (flash/config/PMIC-like targets).
- Brown-out split reset: some devices reset while others remain partially alive. Bus state machines become out-of-sync, and legal-looking fragments can occur during recovery.
- Hot-plug transients: connect order and ground bounce can create CS glitches or partial frames before the system is stable.
- Ghost powering: IO injection through CS/MOSI/MISO can partially power a device into a half-awake state, causing non-Hi-Z behavior or unexpected bus loading.
Fast observable signs: first-transaction failures after reset, “impossible” IDs, CS pulses captured during power ramp, or a supposedly unpowered module still influencing MISO level.
Hardware mitigations (default-safe first)
1) Bias CS to a safe inactive level
- Use pull-up/pull-down bias so CS does not float during MCU Hi-Z windows.
- Verify the inactive polarity per slave; keep the entire tree aligned with “all inactive” as the default state.
2) Add a global enable gate (SAFE/EN)
- Treat EN as the real “CS master gate” for decode/buffer trees.
- Make EN default OFF with passive bias, then only release it after power-good and reset are stable.
3) Control hot-plug and brown-out entry/exit
- Hold all CS inactive during attach/detach windows; do not allow partial frames while rails settle.
- If modules can be unpowered while signals remain present, consider bus switches or isolation switches to physically disconnect CS/MISO paths.
4) Block ghost power paths (IO injection)
- Ensure unpowered modules do not receive active CS/MOSI that can back-feed via protection structures.
- Prefer designs where ground/power are established before signal eligibility is granted (via SAFE/EN gate).
Pass criteria (placeholders): during power-up/brown-out/hot-plug tests, CS-active events = 0 before SAFE/EN is released; no unintended writes/side effects; no “half-awake” device drives MISO while unselected.
Firmware mitigations (boot order + recovery sequences)
- Boot priority: configure all CS pins as explicit inactive outputs as early as possible; keep SAFE/EN asserted OFF until ready.
- Pre-transaction gate: only start SPI frames after system power-good/reset are stable and the bus is in an all-inactive idle.
- Brown-out handling: on detection, enter a deterministic bus reset sequence (disable engine → all CS inactive → re-init → re-enable SAFE/EN).
- Sensitive targets: require explicit “unlock then write” flows (or hardware write-protect usage) so accidental selects cannot cause persistent damage.
Quick check: if “first transaction after reset” fails but subsequent attempts pass, treat it as a strong indicator of unstable default states or split-reset sequencing. Validate SAFE/EN behavior and CS biasing before tuning timing.
Diagram · Power-up Hi-Z can float CS unless SAFE/EN gates selection
H2-10 · Bring-Up & Debug: Analyzer Triggers, Signature Patterns, and Fast Isolation
The 3-step isolation method (fast, repeatable)
Step 1 — Narrow the scope
- Capture traffic per-CS and correlate failures with a specific CS line or transaction type.
- Trigger on CS edges and count transactions to identify “only fails on CSx” vs “system-wide” issues.
- Add a short-pulse/glitch trigger to detect accidental selects.
Step 2 — Validate signatures (“who is talking”)
- Read a stable identity/version register as a signature (method, not vendor-specific values).
- If multiple CS lines return the same signature, suspect decode/mapping or selection leakage.
- If a single CS returns random data, suspect contention or timing-window collapse.
Step 3 — Prove the root cause with minimal changes
- Contention: force only one CS enabled; optionally add/enable a MISO mux and retest.
- Glitch: close SAFE/EN, stabilize address lines, then open the gate; confirm glitch events disappear.
- Timing: increase turnaround gaps, reduce SCLK, or add inter-frame delay; watch for trend improvement.
- Wrong select: build a CS→signature mapping list; any mismatch is a wiring/decoder mapping fault.
Pass criteria (placeholders): no CS glitch events; per-CS signature is stable across N reads; no duplicate signature across different CS lines unless intentionally shared; contention indicators disappear when other CS are forced inactive.
Analyzer trigger templates (CS-focused)
- CS edge + protocol decode: run per-CS decode sessions and compare transaction counts and error ratios.
- Glitch capture: trigger on pulses shorter than a defined width (or use a “runt pulse” detector if available).
- Frame boundary break: trigger when CS toggles during an active transfer or mid-byte.
- Turnaround window audit: measure time between CS deassert and next CS assert; compare to the required safe window budget.
Signature patterns → likely cause (fast interpretation)
Same signature under different CS
Likely decode mapping fault, enable-gate misuse, or selection leakage. Verify SAFE/EN gating and CS routing mapping.
Random data on one CS, stable on others
Suspect MISO contention or insufficient timing margin for that branch. Force single-slave mode and/or add MISO gating to prove it.
First transaction fails after reset, then passes
Treat as unstable default state or split-reset sequencing. Re-verify “all CS inactive” before SAFE/EN release, and check ghost-power behavior.
Errors correlate with CS switching only
Suspect turnaround budget not met, CS overlap, or decoder glitch. Audit CS-to-CS gaps and glitch events.
Diagram · Debug flow: symptom → checks → fix path (contention / glitch / timing / wrong select)
Engineering Checklist (Design → Bring-Up → Production)
Acceptance is based on objective evidence: CS/SCLK/SDIO waveforms (LA/scope), bounded timeouts & recovery (firmware), and repeatable statistics (logs). This checklist stays focused on 3-wire ownership, TA margins, contention safety, and field robustness.
- Ownership contract is explicit: which phase drives SDIO (CMD/ADDR/DATA) and when TA is inserted.
- TA guard is defined: TA_GUARD = X cycles (placeholder) and includes disable/enable + line settle + receiver setup.
- Safe default states: at power-up/reset SDIO is forced to input/Hi-Z; all CS lines default to not-selected.
- Contention energy is limited: series-R (X–Y Ω placeholder) and/or OE gating isolates drivers during TA.
- Dummy/discard hooks exist: configurable dummy cycles and/or discard-first-bit/byte after handoff.
- Recovery ladder exists: L0/L1/L2 recovery steps; all exits end with CS deasserted and SDIO Hi-Z.
- Logging fields are reserved: txn_id, phase_fail, error_code, retries, duration_us, own_grant_us, recovery_level.
- Multi-slave discipline is enforceable: exactly one active CS at a time; CS guard time around switching.
- Probe points are planned: access to CS/SCLK/SDIO (and optional OE/DIR) for bring-up and production.
- OE tri-state buffer (SDIO isolation): TI SN74LVC1G125 / SN74LVC1G126 (family), onsemi NC7WZ125 (family), Nexperia 74LVC1G125 (family) — verify suffix/package.
- Bus switch w/ OE (low Ron, contention-friendly): TI SN74CB3T1G125, Nexperia 74CBT1G125 (family) — verify Ioff/enable behavior per suffix.
- Direction-controlled level translator (DIR + OE for SDIO): TI SN74AXC1T45 (1-bit), TI SN74AXC2T45 (2-bit), TI SN74LVC1T45 (family) — verify DIR/OE truth table.
- Analog SPDT switch (ownership gating / mux): TI TS5A23157, Analog Devices ADG772, onsemi NC7SB3157 — verify Ron/bandwidth/leakage for SDIO edges.
- Low-cap ESD protection (at connector/edge): TI TPD1E10B06 (1-ch), TI TPD2E007 (2-ch), Nexperia PESD5V0S1UL — check Cdiff/Cline vs timing margin.
- Series-R / bias resistors (examples): 22 Ω 0402: Yageo RC0402FR-0722RL, Panasonic ERJ-2RKF22R0X, Vishay CRCW040222R0FKED · 100 kΩ 0402 (weak bias): Yageo RC0402FR-07100KL, Vishay CRCW0402100KFKED — verify value/power/tolerance.
Quick check: schematic + firmware interface review confirms TA_GUARD, Hi-Z defaults, one-owner rule.
Fix: add OE/switch + series-R, enforce CS not-selected defaults, add dummy/discard + recovery ladder.
Pass criteria: TA_GUARD defined (X cycles); boot defaults force SDIO input/Hi-Z; recovery exits with CS deassert + SDIO Hi-Z.
- Capture the minimum set: CS, SCLK, SDIO (plus optional OE/DIR).
- TA Hi-Z proof: SDIO has no drive activity inside TA; trigger on CS edge + TA window.
- Handoff glitch proof: no short spikes/pulses on SDIO at TA enter/exit.
- First-byte stability: verify whether dummy cycles / discard-first is required; confirm with first-byte anomaly trigger.
- Fault injection A (direction stuck): intentionally prevent direction switch; verify bounded timeout and recovery (no deadlock).
- Fault injection B (reduce TA): reduce TA_GUARD; confirm errors increase in the expected window (proves sensitivity and tooling).
- Boundary sweep: sweep SCLK from low to high; record first-fail frequency and failure phase (CMD/TA/RX/TX).
- Recovery ladder exercise: verify L0/L1/L2 recovery returns to IDLE (CS deasserted, SDIO Hi-Z) within X ms (placeholder).
Quick check: LA proof that SDIO is Hi-Z in TA; scope confirms no handoff spikes; logs confirm bounded retries/timeouts.
Fix: increase TA_GUARD (X cycles), align dummy/discard policy, correct OE/DIR timing, enforce CS guard time.
Pass criteria: TA Hi-Z holds for all tested SCLK ≤ X; first-byte error rate ≤ X ppm; recovery returns to IDLE ≤ X ms.
- Corner coverage: validate across temperature/voltage corners; record phase_fail distribution.
- Lot-to-lot consistency: compare boundary sweep results and retry/timeout rates between lots.
- Production test mode: fixed pattern write/read (or read-only) that exercises TA and first-byte regions.
- Minimum logging retained: txn_id, phase_fail, error_code, retries, duration_us, recovery_level.
- Thresholds (placeholders): retry rate ≤ X ppm; timeout rate ≤ X ppm; transaction duration P99 ≤ X us.
- Failure triage: define an action when thresholds are exceeded (retest/repair/derate mode), without allowing indefinite stalls.
Quick check: compare corner logs (phase_fail + retries) and confirm TA Hi-Z still holds at test conditions.
Fix: increase TA_GUARD (X), enforce stricter CS guard, adjust dummy/discard policy, or switch to OE-buffer topology.
Pass criteria: corner error rates ≤ X ppm; boundary sweep ≥ X; recovery never exceeds X ms; logs are complete and traceable.
Applications & IC Selection Notes (Only 3-Wire-Relevant)
Selection here is intentionally narrow: only attributes that directly affect SDIO ownership, tri-state timing (tDIS/tEN), contention tolerance, and reset/default Hi-Z behavior. General SPI throughput topics and CS fanout topology belong to other subpages.
- Sensors and mixed-signal peripherals that expose a single SDIO pin to save package pins (direction and dummy rules vary by vendor).
- Tightly pin-limited modules where a single isolation channel or single connector pin is preferred.
- Multi-drop boards where contention safety and reset defaults dominate overall reliability more than raw SCLK.
| Dimension | Yes/No | What to verify (3-wire-specific) | Concrete examples (material numbers) |
|---|---|---|---|
| Explicit SDIO / 3-wire support | Yes / No | Datasheet must define when the slave drives SDIO and when it is Hi-Z. If not explicit, shared SDIO is high risk. | Use external ownership hardware if ambiguous: TI SN74LVC1G125, TI SN74CB3T1G125, TI SN74AXC1T45 |
| Dummy cycles / discard-first required | Yes / No | Check if the first bit/byte after ownership changes is defined; confirm X dummy cycles and whether discard-first is needed. | Firmware hook + trigger tooling (no extra IC required). If adding gating: TI TS5A23157 / ADI ADG772 (clean handoff path) |
| Tri-state timing (tDIS / tEN) available | Yes / No | If peripheral does not specify tri-state timing, the system must budget TA conservatively (X cycles). If using OE buffers/switches, include their disable/enable timing too. | OE buffer: TI SN74LVC1G125 · Bus switch: TI SN74CB3T1G125 · Translator: TI SN74AXC1T45 |
| Reset/default state is Hi-Z safe | Yes / No | Confirm SDIO is not actively driven during reset and while CS is inactive. If uncertain, enforce SDIO Hi-Z with external OE gating. | OE gating: TI SN74LVC1G125 · Weak bias: Yageo RC0402FR-07100KL |
| Contention tolerance / protection strategy | Yes / No | Provide at least one layer that limits fight energy: TA discipline (must), plus series-R and/or OE isolation (recommended). Add low-cap ESD at exposed ports. | Series-R: Yageo RC0402FR-0722RL · ESD: TI TPD2E007, Nexperia PESD5V0S1UL |
| Isolation channel count (if required) | Optional | 3-wire can reduce isolator channel count, but propagation delay and default-state behavior must still preserve TA and Hi-Z. | TI ISO7741 (4-ch), Analog Devices ADuM140E (4-ch) — verify default output states. |
- No explicit statement of when the slave drives SDIO vs Hi-Z (ownership contract is ambiguous).
- CS inactive behavior is not guaranteed to be Hi-Z (multi-slave SDIO becomes unsafe).
- No tri-state timing guidance (tDIS/tEN absent) and system refuses to budget TA conservatively.
- Reset/power-up defaults allow active drive (first transaction fails or contention occurs at boot).
Recommended topics you might also need
Request a Quote
FAQs (3-Wire SPI)
Each answer uses a fixed, measurable structure: Likely cause / Quick check / Fix / Pass criteria (threshold placeholders: X cycles / X ns / X ppm / X ms).
3-wire reads are always 0xFF / 0x00 — direction not switched or TA too short?
Quick check: Capture CS/SCLK/SDIO and verify SDIO is Hi-Z for ≥ X ns during TA; force SDIO input before sampling and add TA_GUARD=X cycles.
Fix: Insert/extend TA_GUARD, enforce “master disable → settle → slave enable” ordering, and add discard-first-byte or dummy cycles if the peripheral requires it.
Pass criteria: TA Hi-Z holds (≥ X ns) and readback mismatch rate ≤ X ppm over X transactions at SCLK ≤ X MHz.
Low speed is stable, high speed has rare errors — check tDIS/tEN first or dummy cycles first?
Quick check: Run two A/B tests: (A) add dummy=X cycles or discard-first-byte; (B) double TA_GUARD (X→2X). If errors track TA, it is margin; if they track dummy, it is phase/first-byte behavior.
Fix: Budget TA with worst-case disable/enable + settle, then lock a conservative TA_GUARD; implement configurable dummy/discard hooks per device profile.
Pass criteria: At target SCLK ≤ X MHz, error rate ≤ X ppm; changing TA_GUARD by +X cycles changes error rate by ≤ X% (stable margin).
The slave sometimes runs hot — how to confirm bus fight fastest?
Quick check: Measure supply current/temperature while capturing SDIO around TA; look for correlated spikes and SDIO “stuck-high/low” or short glitches at TA boundaries.
Fix: Enforce Hi-Z inside TA, add series-R=X Ω to limit fight current, and/or isolate SDIO with OE buffer/bus switch controlled by a single state machine.
Pass criteria: Additional current during worst-case injection ≤ X mA, no sustained contention > X ns, and thermal rise ≤ X °C over X min.
First transaction after power-up always fails, then works — defaults or first-read dummy?
Quick check: Trigger capture on the first transaction after reset deassert; verify CS is not-selected by default and SDIO is Hi-Z before the transaction. Add an explicit “first-read dummy=X” and compare.
Fix: Force SDIO input/Hi-Z during reset, add CS pull-ups/deglitch if needed, and implement a deterministic first-transaction sequence (delay X ms + dummy/discard policy).
Pass criteria: First-transaction pass rate ≥ (1 − X ppm) across X power cycles; reset-to-first-transaction delay ≥ X ms is documented and enforced.
Two slaves occasionally respond at the same time — CS bounce or decode glitch?
Quick check: Capture CS1/CS2 (or decoder outputs) with SDIO; verify “active CS count” is always 1 and overlap time is 0. Add CS guard time = X cycles and see if failures disappear.
Fix: Debounce/deglitch CS, ensure power-up defaults keep all CS deasserted, and enforce a guard interval before enabling SDIO ownership for the newly selected slave.
Pass criteria: CS overlap ≤ X ns (prefer 0), and dual-response incidents ≤ X ppm over X slave-switch events.
Logic analyzer shows short SDIO glitches — GPIO mode switch or OE timing?
Quick check: If OE/DIR exists, capture OE/DIR alongside SDIO and correlate glitch timing; otherwise capture the handoff edge and add “stop clock + TA_GUARD=X” to see if glitch disappears.
Fix: Sequence control as “disable driver → wait settle → enable other side” and keep OE owned by one state machine; add small series-R=X Ω if needed to reduce fight energy.
Pass criteria: SDIO glitch width ≤ X ns and does not create CRC/misalignment errors (≤ X ppm) at SCLK ≤ X MHz.
Writes work, reads fail — is the ownership switch placed in the wrong phase?
Quick check: Verify that the “master disable” event occurs before the first read sample by ≥ X ns; add TA_GUARD and optionally discard the first byte to confirm phase alignment.
Fix: Move the ownership switch to the correct boundary (CMD/ADDR end → TA → DATA) and enforce a deterministic TA and first-byte policy per device.
Pass criteria: Read success rate ≥ (1 − X ppm) across X reads; no evidence of dual-drive around handoff in captured waveforms.
Different MCU platforms behave differently — pin-mux latency or edge sampling differences?
Quick check: Log and compare own_grant_us (time from “release” request to SDIO actually Hi-Z) and phase_fail distribution; in waveforms, measure handoff delay and jitter on each platform.
Fix: Use a platform-independent TA_GUARD sized for the slowest platform, and drive ownership via OE buffer/bus switch when MCU pad timing is not deterministic.
Pass criteria: own_grant_us P99 ≤ X us and cross-platform delta ≤ X us; error rate ≤ X ppm on all supported MCUs.
After reset the bus is “stuck” — how to force SDIO release and recover?
Quick check: Execute L0: deassert all CS, force SDIO input/Hi-Z, wait X us, then retry a known-safe transaction. If still stuck, escalate to L1/L2 with bounded timers.
Fix: Implement a recovery ladder with hard timeouts: L0 bus release → L1 soft reset sequence → L2 re-init and rate-derate; ensure all exits return to IDLE with CS deassert + SDIO Hi-Z.
Pass criteria: Recovery completes within ≤ X ms and subsequent X transactions are error-free (≤ X ppm).
The device likely needs dummy cycles but the documentation is unclear — how to confirm by waveforms/reads?
Quick check: Sweep dummy cycles (0/1/2/4/8/…) and plot read mismatch rate vs dummy; capture SDIO to see when the slave begins driving stable data relative to TA end.
Fix: Lock a per-device profile: dummy=X, discard-first-byte=Yes/No, and TA_GUARD=X; keep the policy configurable in firmware.
Pass criteria: Chosen dummy value yields mismatch rate ≤ X ppm across X reads and holds across temperature/voltage corners (same profile).
SDIO behaves oddly in multi-voltage designs — could level shifting create contention during direction changes?
Quick check: Identify whether the translator has explicit DIR+OE control; compare A/B with a same-voltage direct connection (or forced Hi-Z via OE) to see if the anomaly disappears.
Fix: Use DIR/OE-controlled translation for SDIO (no auto-direction for 3-wire ownership), and ensure TA includes translator disable/enable timing; follow the dedicated Level Translation page for domain-level design.
Pass criteria: No dual-drive evidence during handoff; mismatch rate ≤ X ppm at SCLK ≤ X MHz with the final level-translation configuration.
Production failures are rare and hard to reproduce in the lab — what statistics should be logged?
Quick check: Log a minimum set per transaction: txn_id, phase_fail, error_code, retries, duration_us, own_grant_us, recovery_level; compute P99 duration and error rate per phase.
Fix: Add bounded retries/timeouts and a recovery ladder; tie production gating to numeric thresholds and require evidence that fixes reduce the dominant phase_fail bucket.
Pass criteria: Logging coverage = 100%; timeout rate ≤ X ppm, retry rate ≤ X ppm, and recovery completes ≤ X ms for all recorded events.