Prev Problem
Next Problem

23. Open-Drain I2C SDA line

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

 

Code


/*

The SDA line is NOT driven high by devices

Instead:

Devices can only pull the line LOW
Otherwise, they release it

And when everyone releases it:

The line goes HIGH automatically due to a pull-up resistor

👉 So HIGH comes from external pull-up, not from the device

| Value | Meaning                     |
| ----- | --------------------------- |
| `0`   | Actively pulling line LOW   |
| `1`   | Actively driving HIGH       |
| `Z`   | Disconnected / left floating / released |
*/

module i2c_line(
    input drive_low,
    output tri1 sda
);

assign sda = drive_low ? 1'b0 :1'bz; 

endmodule
Was this helpful?
Upvote
Downvote