FPGA-I2C-Minion icon indicating copy to clipboard operation
FPGA-I2C-Minion copied to clipboard

The sda line can be activly driven high

Open Rogash1 opened this issue 5 years ago • 1 comments

In the "read" state (READ: send data to master): "sda_o_reg" can be set to one depending on the data. "sda_wen_reg" is set to one in this state too. If you look at how the output is written to, you see that this leads to the data line being actively driven high: sda <= sda_o_reg when sda_wen_reg = '1' else 'Z';

Devices on the I2C bus aren't allowed to actively dive the data lines.

I would change this line of code to: sda <= '0' when (sda_o_reg='0' and sda_wen_reg = '1') else 'Z'; to prevent this behaviour.

I haven't checked the testbenches but the change might lead to an undefined bus-state if you don't drive the bus with an 'H' signal if neither the master nor the slave is pulling the bus low.

If I misunderstood the code, please correct me, I am just a VHDL beginner.

Rogash1 avatar Oct 15 '19 10:10 Rogash1

Great catch, thank you! I believe, it will take more than just that one line to fix it.

oetr avatar Oct 17 '19 21:10 oetr