Logic Level Converter Not Needed

Thread Starter

PIC-User

Joined Sep 25, 2015
104
Hi. I have the design shown below in the drawing. I know that I need to use a level converter for the I2C communication to work. I was planning to use the MOSFET 2N7000 to make the level converter. However, to my surprise the circuit shown below is working perfectly fine. Both chips can communicate back and forth without any problems. Why is this circuit working fine without the level converter? Is this a reliable circuit design?

I2C.png
 

Papabravo

Joined Feb 24, 2006
22,058
Because SDA and SCL are open drain outputs.

The two wires used to interconnect with I2C are SDA (serial data) and SCL (serial clock). Both lines are open-drain, meaning that the output drivers can only pull the signal line to ground. They cannot drive it high. This has the advantage that more than one device connected to a signal line may pull it low.

https://udamonic.com/i2c-overview.html#:~:text=The two wires used to interconnect with I2C,to a signal line may pull it low.

Under some conditions you might have trouble when SDA from the device cannot exceed the logic threshold on the +5V PIC. Check the datasheet for threshold details.
 

Thread Starter

PIC-User

Joined Sep 25, 2015
104
Under some conditions you might have trouble when SDA from the device cannot exceed the logic threshold on the +5V PIC. Check the datasheet for threshold details.
Yes, that makes sense the output being an open-drain. The V-high from the device is 3.3 Volts and that is detected as a 1 by the 5V PIC. So, pretty much can I make 100 boards with this circuit without any issues, right? The level converter is not necessary in this circuit.
 

Papabravo

Joined Feb 24, 2006
22,058
Yes, that makes sense the output being an open-drain. The V-high from the device is 3.3 Volts and that is detected as a 1 by the 5V PIC. So, pretty much can I make 100 boards with this circuit without any issues, right? The level converter is not necessary in this circuit.
I mentioned this in my previous post. The INPUT threshold on the +5V PIC should specify a minimum value for a logic 1. That value should be at least several hundred millivolts below 3.3V. This will be the weakest link and may bite you in a noisy environment. You NEED to check the datasheet carefully and know what the margins are.
 

paoloberno

Joined May 3, 2021
13
The minimum threshold for high level of I2C inputs is 0.7Vdd which in this case is 3.5V so the circuit is working but outside specifications.
This means that a correct operation is not guaranteed by the manufacturer and you have to test the reliability of this solution.
A few years ago i developed a circuit with a pic12 (min Vdd of 1.8V) working with a Vdd of 1.6V but i had to extensively test it in the expected working conditions.
 

Papabravo

Joined Feb 24, 2006
22,058
The minimum threshold for high level of I2C inputs is 0.7Vdd which in this case is 3.5V so the circuit is working but outside specifications.
This means that a correct operation is not guaranteed by the manufacturer and you have to test the reliability of this solution.
A few years ago i developed a circuit with a pic12 (min Vdd of 1.8V) working with a Vdd of 1.6V but i had to extensively test it in the expected working conditions.
Thanks, @paoloberno for doing the legwork, but I would have preferred that the TS had been compelled to do it. When you do things like this for yourself you tend to remember them and why it is important to never let your guard down when taking shortcuts. Maybe this will work, and maybe you'll get away with it this time, but for 100 boards I would not be comfortable with this solution. Reworking 100 boards is going to take a substantial amount of technician time if it has to happen. It also gives you BIG BLACK EYE if you have to do it at the customer's site in front of them while they tap their collective feet and give the poor technician the "stink eye".
 

Papabravo

Joined Feb 24, 2006
22,058
Thanks, @paoloberno for doing the legwork, but I would have preferred that the TS had been compelled to do it. When you do things like this for yourself you tend to remember them and why it is important to never let your guard down when taking shortcuts. Maybe this will work, and maybe you'll get away with it this time, but for 100 boards I would not be comfortable with this solution. Reworking 100 boards is going to take a substantial amount of technician time if it has to happen. It also gives you BIG BLACK EYE if you have to do it at the customer's site in front of them while they tap their collective feet and give the poor technician the "stink eye".
Is it possible that the 3.3V peripheral has inputs that are +5 V tolerant? That might be a preferable alternative. They do make parts with a 3.3V Vcc, that have +5 V tolerant inputs.
 

Thread Starter

PIC-User

Joined Sep 25, 2015
104
Thanks, @paoloberno for doing the legwork, but I would have preferred that the TS had been compelled to do it.
I did check the datasheet. I'm not using the PIC hardware peripherals I2C ports. I'm using a software I2C version on a I/O port. If I'm reading this correctly, the minimum value is 2V for a high 1. I'm using PORTD.4 and PORTD.5 for the I2C communication. See pictures below. I think I'm good with this design if I'm reading this right. What do you think?

Unfortunately, the NT3H2111 port can't take a value greater than 4.5V for the I2C pins.
1634156183144.png

1634156466015.png
 

Attachments

Papabravo

Joined Feb 24, 2006
22,058
Good job. You have a pin with the traditional TTL thresholds, where 2.0 V or more is a logic 1. This gives you 1.3 volts of margin between the threshold and Vcc for the I2C peripheral device. You also have to accept that 0.8 V is the maximum value for a logic 0. This is not likely to be a problem with I2C because you have an active pulldown. One last thing, make sure you select the I2C pullup resistors appropriately. You should be able to compute a minimum and a maximum resistance value.

https://www.ti.com/lit/an/slva689/slva689.pdf

Good luck with your rockets!
 

Thread Starter

PIC-User

Joined Sep 25, 2015
104
Good job. You have a pin with the traditional TTL thresholds, where 2.0 V or more is a logic 1. This gives you 1.3 volts of margin between the threshold and Vcc for the I2C peripheral device. You also have to accept that 0.8 V is the maximum value for a logic 0. This is not likely to be a problem with I2C because you have an active pulldown. One last thing, make sure you select the I2C pullup resistors appropriately. You should be able to compute a minimum and a maximum resistance value.

https://www.ti.com/lit/an/slva689/slva689.pdf

Good luck with your rockets!
Thanks a lot. You definitely pointed me in the right direction.
 
Top