← Protocols Interviews

Interview Question · Concept

Sharing MISO Between Peripherals

L1 Juniorspitopology

The Question

The interviewer asks

Three SPI peripherals share one MISO line. What must each do when its chip select is high, and what goes wrong if one does not?

Reveal the Model Answer

A deselected peripheral must put MISO in high impedance, so only the selected one drives it. The W25Q128JV floats its outputs whenever /CS is high. If a deselected device keeps driving, two outputs fight. Simulation shows x on the bits where they disagree. A board shows mid-rail levels, wrong bits and extra current. Clock, MOSI and MISO are shared; each device has its own active-low select.

MISO Fans In: Only the Selected Peripheral DrivesThree peripherals share CLK, MOSI and MISO; each has its own select. The driver view lanes oe[0..2] show who drives MISO.
MISO fans in: only the selected peripheral drivesThree peripherals share CLK, MOSI and MISO; each has its own select. The driver view lanes oe[0..2] show who drives MISO. component Controller CLK, MOSI, CS0..CS2 component p0 selected: drives MISO component p1 deselected: releases component p2 deselected: releases component MISO one driver at a time oe[0] = 1oe[1] = 0oe[2] = 0
  1. Correct

    p0 is selected and drives; p1 and p2 hold their outputs at z. The controller reads p0 alone.

  2. The twin

    p1 keeps driving although deselected. Wherever p0 drives 1 and p1 drives 0 the line is x: p0's A5h reads x0x00x0x.

Read the diagram as text
  • Controller: CLK, MOSI, CS0..CS2
  • p0: selected: drives MISO
  • p1: deselected: releases
  • p2: deselected: releases
  • MISO: one driver at a time
  • p0 → MISO: oe[0] = 1
  • p1 → MISO: oe[1] = 0
  • p2 → MISO: oe[2] = 0
  • MISO → Controller

Arrows are drivers onto MISO. CLK and MOSI fan out from the controller to all three and are not drawn.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Junior)

A good junior answer says a deselected device puts MISO in high impedance, and each device has its own select. It knows two drivers on one line fight.

Cross-Questions

Where the interviewer goes next. Open a node to practise that follow-up.

What IfProve ItCompareScale It

  1. Sharing MISO Between Peripherals
  2. CompareSeparate Selects or a Daisy ChainL1 JuniorL2 Mid-Level

    Compare one chip select per device with a daisy chain.

    Reveal the Model Answer

    Separate selects cost one pin per device, but let you talk to any device alone, at its own mode and length. A daisy chain uses one select, and each device's output feeds the next device's input. So the chain is one long shift register, and every update shifts through every device. One broken device breaks the chain, and every device must support pass-through. It suits strings of identical parts, such as LED drivers or shift registers.

    A Daisy Chain: Three 8-bit Registers, One 24-bit Shift RegisterOne select for all three. MISO of each device feeds MOSI of the next, and the last device drives the controller's MISO.
    A daisy chain: three 8-bit registers, one 24-bit shift registerOne select for all three. MISO of each device feeds MOSI of the next, and the last device drives the controller's MISO. component Controller sends 11h, 22h, 33h component p0 ends up with 33h component p1 ends up with 22h component p2 ends up with 11h component MISO last device tocontroller MOSIq0q1
    1. One 24-clock frame

      The first byte sent travels furthest: after 24 clocks 11h sits in p2, 22h in p1, 33h in p0.

    2. What comes back

      Meanwhile the old contents shift out of p2 into the controller, oldest first.

    Read the diagram as text
    • Controller: sends 11h, 22h, 33h
    • p0: ends up with 33h
    • p1: ends up with 22h
    • p2: ends up with 11h
    • MISO: last device to controller
    • Controller → p0: MOSI
    • p0 → p1: q0
    • p1 → p2: q1
    • p2 → MISO
    • MISO → Controller

    Arrows are the path of the bits. Measured: p0 33, p1 22, p2 11.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Junior)

    A good junior answer weighs the pin count against being able to reach each device alone.

  3. Prove ItSolve P7.4.2: Load Three Devices Through One ChainSimulator-graded

    Show it, don't just say it: this Silicon Lab problem is graded by the simulator.

    Open Problem P7.4.2

  4. What IfSwitching from One Device to the NextL2 Mid-Level

    How soon after one select rises may the controller select another device and read it?

    Reveal the Model Answer

    The first device needs its output-disable time to let go of MISO: 7 ns maximum (tSHQZ) on the W25Q128JV. The next device's first driven bit must come later than that. The same device also has its own minimum deselect time before it accepts a new command. On that flash it is 10 ns after a read and 50 ns after a program, erase or write.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Mid-Level)

    A good mid-level answer names two limits. One is the old device's output-disable time; the other is a device's minimum deselect time.

  5. Scale ItVerifying an SPI Flash ControllerL2 Mid-LevelL3 Senior

    You verify a QSPI flash controller that does reads, page programs and erases. What is in your bench, and which bugs would still escape?

    Reveal the Model Answer

    Use a wire monitor for every supported mode and lane width. Add wire checks that need no data: idle level, MISO and IO release, CS timing and whole bytes on writes. A strict flash model refuses what the datasheet forbids: programs without WEL, quad reads with QE clear, commands while BUSY. A scoreboard compares readback with a reference memory. Bugs escape through a lenient model, page-wrap writes, off-by-one dummy counts and turnaround timing.

    The Bug-Hunt BenchStimulus programs drive the controller; the flash answers; the checker watches the enables; each program reads its result back.
    The bug-hunt benchStimulus programs drive the controller; the flash answers; the checker watches the enables; each program reads its result back. component Stimulus programs seven tasks component Controller six faults component Flash model five faults component Contentionchecker ctrl_oe & flash_oe component Readback data ok or WRONG component Flash trace line command, clocks,bytes task callspinsctrl_oeflash_oeexpected bytes
    1. The wire eye

      The checker reads both enables on every clock. It catches a fight for the lanes and nothing else.

    2. The readback eye

      Each program knows what the flash should hold and reads it back. It catches what the flash did, legal wire or not.

    3. The record

      The flash prints a line per command. It rules on nothing; it is the evidence the other two eyes point at.

    Read the diagram as text
    • Stimulus programs: seven tasks
    • Controller: six faults
    • Flash model: five faults
    • Contention checker: ctrl_oe & flash_oe
    • Readback: data ok or WRONG
    • Flash trace line: command, clocks, bytes
    • Stimulus programs → Controller: task calls
    • Controller → Flash model: pins
    • Controller → Contention checker: ctrl_oe
    • Flash model → Contention checker: flash_oe
    • Flash model → Flash trace line
    • Stimulus programs → Readback: expected bytes

    Arrows are calls, pins and the values each observer reads.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Mid-Level)

    A good mid-level answer names the parts of the bench: a wire monitor, wire checks, a flash model and a readback scoreboard.

  6. Prove ItSolve P7.10.1: Check the Controller and Its Flash ModelSimulator-graded

    Show it, don't just say it: this Silicon Lab problem is graded by the simulator.

    Open Problem P7.10.1

  7. Prove ItShowing the Flash Bench Catches Each FaultL2 Mid-LevelL3 Senior

    Prove it: how do you show that your QSPI bench catches each class of fault, not just that the tests pass?

    Reveal the Model Answer

    Plant one fault per class, such as a missing WEL, a late IO release or a page-wrap error. Run every test against every fault and record which check fires. A fault with no mark is a hole, so add a program for it. On the lesson bench the wire checker caught 1 fault of 11, and readbacks caught the rest.

    Self-Check

    Tick each key point you covered in your answer.

    Tool as Truth

    "The wire checker is clean, so the controller is right."

    Most flash faults keep the wires legal. Only a readback against the datasheet rule shows what the flash did.

    Source Lesson P7.10 key points

  8. Prove ItSolve P7.4.1: Release MISO When DeselectedSimulator-graded

    Show it, don't just say it: this Silicon Lab problem is graded by the simulator.

    Open Problem P7.4.1

What People Get Wrong

Common wrong answers and why they fail.

Missed Corner

"If two devices drove MISO, every simulation would show x."

x appears only on bits where the two drivers disagree. Equal bits look clean, and a 2-state simulator (only 0 and 1) shows no x at all. So a test that reads matching data can hide contention. Check the release explicitly.

Source ASIC Point lesson P7.4 (measured contended byte on Icarus Verilog 12; contention shows x wherever the two drivers disagree)

Half-Truth

"Devices with different SPI modes cannot share a bus."

They can. Only one device is selected at a time. The controller reprograms CPOL and CPHA between frames for the device it selects.

Learn It, Then Prove It