Go Down

Topic: I2C setup with level converter (Read 128 times) previous topic - next topic

penderam

Greetings!

I have a FPGA using a 2.8 volt reference for its pins and a arduino UNO using 5 volt. I have a level converter between the two and set it up with the correct voltage references. I have tested it, and it works correctly. I can read '0' or '1' from both the FPGA and the UNO from each other.

I need to setup I2C interface between the two. Currently using a microblaze with drivers on the FPGA and the UNOs I2C library. I have 4.7K pullup resistors. This is going to seem like a simple question, but do I need to pull up both sides of the level converter too the reference voltage being used on that side?

For example on the arduino side, both SDA and SCL would be pulled up to 5 volts thru 4.7Kohm resistors. And on the FPGAs side its SDA and SCL would be pulled up to 2.8 Volts.

At the moment the master is the arduino UNO in my setup for code.

Thanks!

pylon

Quote
Currently using a microblaze with drivers on the FPGA and the UNOs I2C library. I have 4.7K pullup resistors.
With most level shifters you don't need pull-ups because they are integrated into the level shifter. You forgot the link to the hardware you're using, so you have to check that yourself.

Quote
This is going to seem like a simple question, but do I need to pull up both sides of the level converter too the reference voltage being used on that side?
Yes, but in most cases these pull-ups are part of the level shifter/converter.

freaklabs

Since I2C is an open collector pin, you would need a pullup on both sides. That's because the converter is in between and you can't rely on it to pull the pins to the correct voltage. Actually the open collector was supposed to adapt the bus to interface different voltages. Hence you can tie it to whatever the system voltage is. In your case, if the ATMega328P can detect digital transitions at 2.8V, then I would actually get rid of the converter and tie the I2C bus pullups to 2.8V. Definitely the AVR can detect transitions at 3.3V.
FreakLabs
Wireless Technology for the environment, wildlife, and agriculture
https://freaklabs.org
https://hackerfarm.jp
Twitter: @freaklabs

pylon

Quote
Since I2C is an open collector pin, you would need a pullup on both sides. That's because the converter is in between and you can't rely on it to pull the pins to the correct voltage. Actually the open collector was supposed to adapt the bus to interface different voltages. Hence you can tie it to whatever the system voltage is. In your case, if the ATMega328P can detect digital transitions at 2.8V, then I would actually get rid of the converter and tie the I2C bus pullups to 2.8V. Definitely the AVR can detect transitions at 3.3V.
This might be true for your ATmega328 system but OP is using an Arduino environment. The Arduino Wire library activates the internal pullups so with no level converter the FPGA might get fried as it gets a higher voltage than it's designed for.

As for the HIGH value the datasheet says it needs at least 0.6*Vcc so on a 5V system 2.8V won't be (reliably) detected as HIGH.

freaklabs

Good call on that. I didn't look at the ATMega328P datasheet for the exact spec level detection voltage.
FreakLabs
Wireless Technology for the environment, wildlife, and agriculture
https://freaklabs.org
https://hackerfarm.jp
Twitter: @freaklabs

Go Up