Interviews
I2C Interview Questions
Practise the question, then the follow-ups an interviewer asks next.
Start with a Question TreeAI Mock Interview
- 6
- Question trees
- 32
- Follow-ups
- 25
- Wrong answers explained
- 6
- Runnable on a simulator
Flagship Questions · With follow-ups
Question Trees
Each question opens into the follow-ups an interviewer asks next, the wrong answers people give, and what a fresher's and a senior's answer sound like.
-
Why I2C Is Open Drain
I2C outputs are open drain with pull-up resistors. Why not ordinary push-pull outputs, and what does that choice cost? 5 follow-ups · 4 pitfalls- Likely at Google
-
The Ninth Clock: ACK and NACK
Draw one I2C byte with its acknowledge. Who drives SDA in the ninth clock on a write, and on a read? Why does the controller NACK the last byte it reads? 5 follow-ups · 6 pitfalls · 1 runnable- Likely at Analog Devices
-
Clock Stretching
What is clock stretching in I2C, and what must the controller do for it to work? 5 follow-ups · 4 pitfalls · 1 runnable -
I2C Multi-Controller Arbitration
Two controllers start a transfer at the same moment, one to 0x50 and one to 0x58. How does I2C decide who wins, and what happens to the loser's message? 5 follow-ups · 4 pitfalls · 2 runnable -
Reading a Register with Repeated START
Walk me through reading register 0x3C of an I2C target at address 0x50. Why is there a repeated START in the middle? 6 follow-ups · 3 pitfalls -
Recovering a Stuck I2C Bus
After a watchdog reset of the SoC, the I2C bus is dead: SDA reads low forever, SCL is high. What happened and how does the controller recover? 6 follow-ups · 4 pitfalls · 2 runnable
No question matches these filters.
Quick revision · One flat list
Question Bank
All 32 I2C questions, main and follow-up. Open a track, then a topic. Answer out loud first, then open the short answer.
Jump to a Track
32 questions · 6 topicsI2C
Why I2C Is Open Drain5
I2C outputs are open drain with pull-up resistors. Why not ordinary push-pull outputs, and what does that choice cost? L0L1
Each device can only pull a line low or let go. A pull-up resistor raises the line when every device lets go. So the line is the wired-AND of all devices, and two drivers never fight. That makes clock stretching, clock synchronisation and multi-controller arbitration possible. It also lets parts on different supplies share a bus. The cost is the rising edge: a resistor charges the bus capacitance, which limits speed and bus size.
QuestionPractise Why I2C Is Open Drain →A new target drives SDA high actively whenever it is not pulling low. What happens on the bus? L0L1
The first time another device pulls SDA low while this one drives high, two outputs fight. In simulation the line resolves to x. On a board, the two transistors set a voltage, often between VIL and VIH, so receivers disagree. ACKs, arbitration and the controller's own bits all break. The fight can also damage drivers.
Follow-upPractise A Push-Pull Device on SDA →You have a Fast-mode bus at 3.3 V with about 100 pF. How do you choose the pull-up resistor? L1L2
Two bounds. Rp(max) comes from the rise-time limit: tr = 0.8473 Rp Cb. With 300 ns and 100 pF, Rp is at most about 3.5 kΩ. Rp(min) comes from the sink current: (VDD − 0.4 V) / 3 mA, about 967 Ω. Pick inside that window, toward the high end if supply current matters. At 400 pF in Fast-mode the window is empty, so a resistor alone cannot work.
Follow-upPractise Sizing the I2C Pull-Up →The sensor cable makes your bus 800 pF, twice the Fast-mode limit. What are your options, and what does each cost? L2L3
UM10204 lists four options. Run a slower SCL so the rise fits, or use higher-drive parts, such as Fm+ devices, with a stronger pull-up. Split the bus with buffers, multiplexers or switches so each segment stays under the limit, or add a switched pull-up. Buffers add delay to every edge and may bring their own VIL/VOL rules. Fm+ still stops at 550 pF and 1 MHz.
Follow-upPractise An 800 pF I2C Bus →Your I2C timing checker in simulation is clean. Does that prove the bus meets UM10204 timing? L2
No. A digital checker measures edge-to-edge times such as tLOW, tHIGH, tSU;DAT and tBUF on 0/1 pins. Rise time, fall time, spike width and bus capacitance are analog. In RTL the pins switch instantly, so a pull-up that is far too weak still passes. Those rows need SPICE or a board measurement, plus the pull-up arithmetic.
Follow-upPractise What a Digital I2C Checker Cannot See →The Ninth Clock: ACK and NACK5
Draw one I2C byte with its acknowledge. Who drives SDA in the ninth clock on a write, and on a read? Why does the controller NACK the last byte it reads? L0L1
The controller makes all nine clocks. In the ninth, the transmitter releases SDA. The receiver pulls it low (ACK) and holds it through the high phase; SDA left high is a NACK. On a write the target ACKs, and on a read the controller does. The controller NACKs the last read byte so the target stops driving. An ACK would tell the target to send the next byte, which may hold SDA low and block the STOP.
QuestionPractise The Ninth Clock: ACK and NACK →Your driver gets a NACK after the address byte. What could it mean, and what should the controller do? L1
After an address, most likely no device answers at that address, or the target is busy with a real-time task. Later in a transfer, a NACK can mean the target did not understand the byte or cannot take more. A controller-receiver also NACKs on purpose to end a read. Whatever the reason, the controller ends with STOP or tries again with a repeated START. Software decides whether to retry.
Follow-upPractise What a NACK Means →A target keeps pulling SDA low after its ACK slot, into the next bit. What does a correct controller report, and how do you find the culprit? L2
A correct controller that sends a 1 and reads a 0 decides it lost arbitration. So the log says "arbitration lost", even on a single-controller bus. The wires alone cannot say who pulled. You need the driver view, meaning each device's pull-low enable. It shows the target's lane still active after the ninth clock.
Follow-upPractise An ACK That Overstays →In I2C the ninth bit of a data byte is the receiver's ACK. What is it in I3C SDR? L1L2
The transmitter drives it. On a write, it is odd parity from the controller: the XOR of the eight data bits with 1. Parity lets the target detect a corrupted byte. On a read, it is end-of-data from the target: 0 ends the message, and 1 offers more. So the target decides how much it returns, though the controller may abort after a 1 with a repeated START.
Follow-upPractise The I3C T-Bit Versus the I2C ACK →What if the target sees a parity error on a byte the controller wrote? What does it do, and how does the controller find out? L2
It cannot NACK the byte, because the ninth bit belongs to the controller. Error type S2 says the target ignores the rest and waits for a STOP or a repeated START. The controller sees nothing on the wire. It learns of the error later, from the Protocol Error bit that GETSTATUS returns.
Follow-upPractise A Parity Error on a Written Byte →Clock Stretching5
What is clock stretching in I2C, and what must the controller do for it to work? L1L2
A target that needs time holds SCL low. SCL is a wired-AND, so the line stays low after the controller lets go. The controller must read SCL back, and start timing its HIGH only once SCL really is high. A controller that times HIGH from its own release samples SDA too early. The target still holds the clock, so the controller reads a wrong byte. Stretching is optional for targets and has no time limit in I2C.
QuestionPractise Clock Stretching →The same "read SCL back" rule makes clock synchronisation between two controllers work. Explain how. L2
On a wired-AND SCL, every controller starts counting LOW when the line falls. But the line rises only when the last one lets go. Each waits for SCL high before counting HIGH, and the first to finish HIGH pulls it low again. So the bus clock gets the longest LOW and the shortest HIGH of all controllers. A stretching target is just another device with a long LOW.
Follow-upPractise One Rule, Two Features →A target holds SCL low and never releases it. I2C has no time-out. What should your controller do, and how would you verify it? L2L3
I2C sets no limit, so the controller IP should carry its own configurable time-out. It should give up and report, not hang. With SCL stuck low, clocking out is impossible, so UM10204 points to a hardware reset input or a power cycle. To verify, use a target model that never releases. Check that the controller times out, flags the error and leaves SCL released.
Follow-upPractise A Target That Never Lets Go →Break it: you set the controller's stretch time-out to 1 ms. Which legal target does that break? L2
Any target whose datasheet allows a longer stretch. I2C sets no limit on stretching, so a 1 ms limit turns legal behaviour into a reported error. Set the limit from the slowest target's datasheet. Use SMBus's 35 ms only when the system really uses SMBus devices.
Follow-upPractise A Clock-Stretch Time-Out That Is Too Short →Can a target stretch the clock on I3C? What replaces it? L1L2
No. In I3C only the controller drives SCL, and legacy I2C targets on an I3C bus may not stretch. The controller may stall instead, holding SCL low in only four places. They are the ACK/NACK slot, a write's parity bit, a read's T-bit and the first bit of an assigned address in DAA. The absolute maximum stall is 15 ms.
Follow-upPractise Stretching on I3C →I2C Multi-Controller Arbitration5
Two controllers start a transfer at the same moment, one to 0x50 and one to 0x58. How does I2C decide who wins, and what happens to the loser's message? L1L2
Both drive SDA bit by bit, and compare the wired-AND line with what they sent while SCL is high. The first controller to send a 1 and read a 0 has lost, and it releases SDA at once. Until then both sent identical bits, so nothing is lost and the winner's message is intact. Address 0x58 loses on the fourth address bit. The loser may clock to the end of that byte, and retries when the bus is free.
QuestionPractise I2C Multi-Controller Arbitration →Your controller also has a target address. It loses arbitration during the address byte. What must it do next, and why? L2
It must switch to target mode at once and keep decoding the address. The winner may be addressing this very device. If it waits as an idle controller until the bus is free, it misses its own address. The winner then sees a NACK. Separately, it must not drive any more bits of its own message.
Follow-upPractise The Loser May Be the Target →What if the losing controller starts its own transfer again right after it loses? L2
It must wait until the bus is free. The bus counts as busy from the START until a set time after the STOP, and a repeated START keeps it busy. So the loser waits for the winner's STOP and the bus-free time. A START any earlier breaks the winner's message.
Follow-upPractise When the Losing Controller May Retry →Is there any collision I2C arbitration cannot resolve? L2L3
Yes. UM10204 leaves three collisions undefined while arbitration is still running. In two of them, one controller sends a repeated START or a STOP while the other sends a data bit. In the third, one sends a repeated START against a STOP. Arbitration works only when both still send bits in the same position of the same format.
Follow-upPractise Where Arbitration Is Undefined →You own a multi-controller I2C controller IP. How do you verify arbitration and clock synchronisation to sign-off? L3L4
Build a two-controller bench with a reference controller and the DUT on wired-AND lines. Cover a loss at every address and data bit position and identical messages that complete together. Add a loss while addressed as a target, the clock-to-end-of-byte rule, and unequal LOW/HIGH periods for synchronisation. Check from the driver view that the loser never drives after losing. Back it with a formal proof on an abstraction.
Follow-upPractise Verifying a Multi-Controller I2C IP →Reading a Register with Repeated START6
Walk me through reading register 0x3C of an I2C target at address 0x50. Why is there a repeated START in the middle? L0L1
The frame is S, 0x50 with W, ACK, the pointer 0x3C, ACK. Then comes a repeated START, 0x50 with R, ACK, the data byte, NACK, STOP. The write sets the target's internal pointer, and the read returns data from it. The repeated START changes direction without releasing the bus. A STOP would free the bus. On a multi-controller bus, another controller could then take it and move the pointer before the read.
QuestionPractise Reading a Register with Repeated START →What concretely goes wrong if you send STOP then START between the pointer write and the read? L1
After the STOP and the bus-free time, another controller may win the bus. It may access the same target, move its pointer or change the register. Your read then returns data from the wrong place, with no error anywhere. STOP then START works on a single-controller bus, with a target that keeps its pointer. Sr makes it safe without relying on either assumption.
Follow-upPractise STOP Plus START Instead of Sr →Register writes work, but every combined-format read returns 0xFF. The target ACKs the pointer. What do you suspect? L1L2
The target does not detect the repeated START. It treats the Sr and the next address byte as more write data, and never answers the read address. So the controller reads the released line: 0xFF. UM10204 requires devices to reset their bus logic on any START or repeated START, and expect an address. A test that only writes, or reads with STOP plus START, never exercises it.
Follow-upPractise A Target That Ignores Sr →Prove it: which directed test exposes a target that misses the repeated START? L1L2
A combined-format read: write the register pointer, send Sr, send the read address, then read. Check that the target ACKs the read address and returns the register value, not 0xFF. Cover Sr in the monitor, so coverage shows that this format really ran.
Follow-upPractise A Test That Exposes a Missed Repeated START →How does a register read change with a 10-bit target address? L2
The address takes two bytes: 1111 0XX plus W, then the low eight bits. Here XX are the top two address bits. Several targets may ACK the first byte, but only one ACKs the second. After the pointer write, the controller sends Sr and repeats only the first byte, with R. The target that matched both bytes earlier stays addressed and answers.
Follow-upPractise A 10-Bit Address Read →You write an I2C monitor. When does it publish a transaction, and what goes wrong if you publish at START? L2L3
Sample data at SCL rises, and detect START and STOP as SDA edges while SCL is high. Close the current transaction at a repeated START or a STOP. A monitor that publishes at START publishes the previous transaction late. On the first START, it publishes a byte it shifted in before the address. Treat Sr as both the end of one transfer and the start of the next.
Follow-upPractise Where an I2C Monitor Closes a Transaction →Recovering a Stuck I2C Bus6
After a watchdog reset of the SoC, the I2C bus is dead: SDA reads low forever, SCL is high. What happened and how does the controller recover? L2L3
The controller reset in the middle of a read, while a target was sending a 0. The target waits for SCL edges to finish its byte. No STOP can form while it holds SDA low. To recover, clock SCL up to nine times, checking SDA before each pulse. Each falling edge moves the target to its next bit, and it lets go at a 1 or its ACK slot. Then send a STOP, and if SDA stays low, use a hardware reset or power cycle.
QuestionPractise Recovering a Stuck I2C Bus →Why does the bus clear use up to nine clocks, and why stop early? L2
Every falling SCL edge moves a stuck transmitter to its next bit. Within a byte's eight bits and its acknowledge slot, it must reach a 1 or the ACK slot. There it lets go of SDA, so nine pulses cover any position. Stop as soon as SDA reads high. Extra pulses after that just clock a target further into a transfer the controller no longer wants.
Follow-upPractise Why up to Nine Clocks →What if SDA is still low after the nine clock pulses? L2
Then the target is not just waiting for clocks; it may be hung. Stop pulsing and report the failure. UM10204 then points to the device's hardware reset input, or a power cycle to trigger its power-on reset.
Follow-upPractise SDA Still Low After Nine Clocks →Now SCL is stuck low instead of SDA. Does the nine-clock trick help? L2L3
No. The controller cannot make SCL pulses if something holds SCL low. UM10204 says to use the devices' hardware reset inputs. Or cycle their power to trigger the mandatory power-on reset. So the controller must detect the fault with a time-out and report it. The board also needs a reset path to the I2C devices, a system design decision made early.
Follow-upPractise When SCL Is the Stuck Line →Name the bugs you have seen, or would expect, in a bus-clear implementation. L2
One bug sends only eight pulses, one short for a target that needs nine. Another sends no STOP after SDA comes back, so devices still think a transfer is open. A third pulses without reading SDA, so it claims success while the line is still low. A fourth waits forever when SCL is held, instead of timing out. Each needs its own stuck-target scenario to show up.
Follow-upPractise Bugs in a Bus-Clear Routine →Walk me through your verification plan for an I2C controller and target pair. How do you know you are done? L3L4
I use four kinds of checking, starting with data checks against a model derived from the wire. The others are a timing checker for the Table 11 edge times, a driver-view checker and a two-controller bench. Directed programs target each fault: wrong addresses, pointer wraps, Sr, stretching, collisions and a stuck bus. Done means every seeded fault is caught, legal variations stay silent and coverage closes.
Follow-upPractise Signing off an I2C Controller →Your Review Queue
Saved review reminders are coming soon.