Problem with I2C voltage level translator

Hardware incubation. See also our in development projects wiki.

Problem with I2C voltage level translator

Postby erdabyz » Thu Jan 26, 2012 4:40 pm

I have a problem that's driving me nuts. I'm designing a robotics platform based on arduino for a very basic robotics course. The idea is to have an arduino with extras, like an H-bridge, some infrared sensors, an accelerometer, a color sensor, some battery charger and things like that, in a robot chassis shaped PCB. So you have a chassis PCB, you assemble the motors and there you go.

Also, I wanted to design it stealing as few pins as possible to the arduino. So everything uses an I2C bus to communicate. There's a secondary PIC16F677 microcontroller to handle the infrared sensors and some other stuff, and it interfaces to the ATMEGA via I2C. The color sensor and the accelerometer are also I2C and require 3.3V signals.

So I'm using an I2C voltage level translator/isolator to translate the 5V from the ATMEGA328 into 3.3V, and those 3.3V I2C lines are distributed to the sensors and the PIC.

So here comes the problem. The PCA9306 is pass-transistor based and requires pretty low value pull-ups to drive enough current through the pass transistor and allow proper operation (with the load imposed by my three devices, the thing should work at 100kHz with 10K pullups, but the use of the PCA forces me to use 1K pullups). It looks like the ATMEGA328 I2C open collector drivers have pretty weak transistors too. So the VOL in the arduino side is somewhat around 180mV (checked with o-scope). For some reason, the VOL in the 3.3V side gets multiplied and it's about 300mV. The accelerometer recognizes that as a 0 and works perfectly, the color sensor does it most of the times (but operates with some glitches) but the PIC doesn't recognize that as a 0 and therefore doesn't work. Well, to be fair it answered two or three times to its slave address in one of the tests, but then no more. I'm using the hardware SSP of the PIC.

I know that the PIC doesn't recognize the zeroes because I made a small testing program which made the I2C bus spit lots of zeroes, and I programmed the PIC to light a LED every time it detected a zero, and the LED just gave random pulses of light, and its activation signal didn't look as the I2C stream at all.

So next step, go for another bus translator. This time a TXS0102 from TI which I had on hand. Also pass-transistor based, but it requires far less current. The problem gets better but the PIC still doesn't recognize the zeroes with a VOL of 200mV.

So the whole project is based on I2C and it's the only part that doesn't work. Any advice? I'm thinking about trying an I2C translator WITH repeater like the PCA9517...
Any advice?
erdabyz
Full Member
Full Member
 
Posts: 172
Joined: Wed May 25, 2011 8:13 am

Re: Problem with I2C voltage level translator

Postby Sleepwalker3 » Fri Jan 27, 2012 8:01 am

If I were you I'd try going a bit higher in the pullup on the 3V3 side, as from what you're saying it sounds like your problem is lack of pull-down. You could try going to 2.2k, 3.3k or even 4.7k and see how you go, it may go a bit low on the pullup then, but it's certainly easier to try that than swapping around translators. You could try a FXMA2102, it's designed to do the job.
I'd be interested to hear how you go, so please drop back and let us know.
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 505
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: Problem with I2C voltage level translator

Postby erdabyz » Fri Jan 27, 2012 10:19 am

Problem solved. I introduced a bug in the PIC's code after swapping the translator to the TXS0102. It's working perfectly now with the TXS.
erdabyz
Full Member
Full Member
 
Posts: 172
Joined: Wed May 25, 2011 8:13 am

Re: Problem with I2C voltage level translator

Postby schazamp » Fri Jan 27, 2012 11:37 am

[edit:] Glad you fixed it, gotta learn to refresh between "read" and "reply" time. Or, you know, just look at the preview.

Have you looked at using a MOSFET-based circuit, like the one described in app note AN97055 from Phillips: http://ics.nxp.com/support/documents/in ... n97055.pdf ?

I have used it, it is simple and straightforward, and they go into detail about the different logic thresholds on the two sides of the bus.
schazamp
Full Member
Full Member
 
Posts: 225
Joined: Wed Jan 19, 2011 9:51 am
Location: St. Louis, MO

Re: Problem with I2C voltage level translator

Postby jone » Fri Jan 27, 2012 11:59 am

schazamp wrote:Have you looked at using a MOSFET-based circuit, like the one described in app note AN97055 from Phillips: http://ics.nxp.com/support/documents/in ... n97055.pdf ?

Heh, that's neat - thanks!
jone
Jr. Member
Jr. Member
 
Posts: 64
Joined: Mon Jul 19, 2010 6:55 am

Re: Problem with I2C voltage level translator

Postby ketulbarot » Thu Jan 24, 2013 2:00 am

@erdabyz

I have the same problem as you were facing. I am using a PIC18F25K22 which is a 5V Controller with NXP's PCF2129A RTC which runs on 3.3V have used PCA9306 for voltage translation can you please tell me what were the code changes in PIC you did to run your system.

It would be of great help
ketulbarot
Newbie
Newbie
 
Posts: 2
Joined: Thu Jan 24, 2013 1:54 am

Re: Problem with I2C voltage level translator

Postby erdabyz » Thu Jan 24, 2013 5:52 pm

ketulbarot wrote:@erdabyz

I have the same problem as you were facing. I am using a PIC18F25K22 which is a 5V Controller with NXP's PCF2129A RTC which runs on 3.3V have used PCA9306 for voltage translation can you please tell me what were the code changes in PIC you did to run your system.

It would be of great help


Well, I used two different translators. With the PCA9306 things weren't working because PIC wasn't recognizing the zeroes.

In between tests I bugged the PIC's code so the I2C wasn't functional anymore but I didn't noticed because well, the thing wasn't working anyways. Can't remember what the bug was, but it was something major like a complete misconfiguration of the SSP.

Then I switched to TXS0102. The voltage levels for 0's were smaller and I thought the PIC would have to recognize them, but it didn't because of the software bug. I corrected it and things started to work.

Then I switched back to PCA9306 to try and see why the hell I had such high 0 voltages and I found the initial hardware bug. I had mistaken the pullup resistors on the arduino side and they were far too large. Switched them to 1K and all worked fine.

So try and place some external pullpups in both the PIC side and in the PCF side, tied to the proper voltages on each side. Seems like the PCA9306 requires strong pull-ups in both sides to work.

Anyways, my I2C bus was loaded with 4 devices so that might have also contributed to the effect.
erdabyz
Full Member
Full Member
 
Posts: 172
Joined: Wed May 25, 2011 8:13 am

Re: Problem with I2C voltage level translator

Postby ketulbarot » Fri Jan 25, 2013 7:03 am

Thanx erdabyz for your post.

I changed the pull ups to 1K on both the side of PCA9306. And also did a little bit of code change in PIC now my PIC is communicating with the PCF. Thank you for your help
ketulbarot
Newbie
Newbie
 
Posts: 2
Joined: Thu Jan 24, 2013 1:54 am


Return to Project development, ideas, and suggestions