Challenge - 5 Problems
I2C Controller Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output of this I2C start condition process?
Consider the following VHDL process that generates an I2C start condition on SDA and SCL lines. What will be the value of SDA and SCL signals after the process completes?
VHDL
process
begin
SCL <= '1';
SDA <= '1';
wait for 10 ns;
SDA <= '0'; -- Start condition: SDA goes low while SCL is high
wait for 10 ns;
SCL <= '0';
wait;
end process;Attempts:
2 left
💡 Hint
Remember the I2C start condition requires SDA to go low while SCL is high, then SCL goes low.
✗ Incorrect
The process sets SCL and SDA high initially, then pulls SDA low while SCL is still high to create the start condition. Finally, SCL is pulled low. So the final values are SCL='0' and SDA='0'.
🧠 Conceptual
intermediateWhich signal transition defines the I2C stop condition?
In I2C communication, the stop condition is a specific change on the SDA and SCL lines. Which of the following correctly describes the stop condition?
Attempts:
2 left
💡 Hint
Think about how the stop condition signals the end of communication by releasing the bus.
✗ Incorrect
The stop condition occurs when SDA transitions from low to high while SCL is high, signaling the end of the data transfer.
🔧 Debug
advancedWhy does this VHDL code fail to generate a proper I2C clock?
Examine the following VHDL code snippet intended to generate a 100 kHz I2C clock on SCL. Identify the reason it does not produce the correct clock signal.
VHDL
process
begin
SCL <= '0';
wait for 5 us;
SCL <= '1';
wait for 5 us;
end process;Attempts:
2 left
💡 Hint
Consider how VHDL processes behave without loops or sensitivity lists.
✗ Incorrect
Without a loop, the process executes once and then stops, so the clock toggling happens only once instead of continuously.
📝 Syntax
advancedWhich VHDL code correctly implements an I2C SDA line release (open-drain behavior)?
In I2C, the SDA line is open-drain and should be driven low or released (high impedance). Which code snippet correctly models releasing the SDA line in VHDL?
Attempts:
2 left
💡 Hint
Open-drain means the line is not driven high but left floating (high impedance).
✗ Incorrect
Assigning 'Z' to SDA releases the line, allowing the pull-up resistor to pull it high, which models open-drain behavior.
🚀 Application
expertHow many clock pulses are generated by this I2C bit transmission process?
Given the following VHDL process that transmits 8 bits over I2C by toggling SCL, how many rising edges of SCL occur during the transmission?
VHDL
process variable i : integer := 0; begin for i in 0 to 7 loop SDA <= data(i); SCL <= '0'; wait for 5 us; SCL <= '1'; -- Rising edge wait for 5 us; end loop; wait; end process;
Attempts:
2 left
💡 Hint
Count how many times SCL goes from '0' to '1' inside the loop.
✗ Incorrect
The loop runs 8 times, and each iteration generates one rising edge of SCL, so total 8 rising edges.
