Go Down

Topic: LCD I2C Strangeness (waveform included) (Read 1 time) previous topic - next topic

GlacialWanderer

I'm trying to interface this I2C LCD (http://www.newhavendisplay.com/specs/NHD-C0216CiZ-FSW-FBW-3V3.pdf) with the Arduino.  I'm pretty sure I have all the wiring hooked up correctly (including a mosfet based level conversion) from looking at the waveforms on a scope.

Here is some initialization code I got from a library by Francisco (had to modify a few things for my LCD).
Code: [Select]

  Wire.begin();
  Wire.beginTransmission ( _i2cAddress );
  Wire.write ( (byte)0x0 );   // Send command to the display
  Wire.write ( FUNC_SET_TBL0 );
  delay (10);
  Wire.write ( FUNC_SET_TBL1 );
  delay (10);
  Wire.write ( 0x14 );  // Set BIAS - 1/5
  Wire.write ( 0x78 );  // Set contrast low byte
  Wire.write ( 0x5E );  // ICON disp on, Booster on, Contrast high byte
  Wire.write ( 0x6D );  // Follower circuit (internal), amp ratio (6)
  Wire.write ( 0x0C );  // Display on
  Wire.write ( 0x01 );  // Clear display
  Wire.write ( 0x06 );  // Entry mode set - increment
  delay(10);
  _status = Wire.endTransmission ();
 
  Serial.println(_status);


If I look at the waveform with a logic analyzer I'm getting a valid ACK from the LCD for the slave address byte.  Here's that image: http://www.glacialwanderer.com/_blog/blog2012/April/i2c_debug.png

I have tried putting in the wrong slave address and then I get the NAK.  So it really seems like the LCD is sending the ACK back.  Basically this looks good to me, but everything after this slave address byte and ack is broken.  In the code above I'm writing a lot more bytes and none of that shows up on the waveform.  Also the _status that I'm printing out in the code is 2 (failure from address NAK).  So for some reason it seems that the Arduino is failing to send the bytes after the intial address and I don't know why.  Does anyone have any ideas on what is going wrong?

GlacialWanderer

I'm trying to interface this I2C LCD (http://www.newhavendisplay.com/specs/NHD-C0216CiZ-FSW-FBW-3V3.pdf) with the Arduino.

I have found more information.  Previously I was looking at the 3.3 side of the i2c bus which looks fine.  But, when I look at the 5V side of the bus (master/arduino) I don't get the ack and it fails.

Here is my level conversion circuit:


The only things that could possibly matter are the mosfets.  This is what I'm using there: http://www.mouser.com/ProductDetail/Fairchild-Semiconductor/FQN1N50CTA/?qs=sGAEpiMZZMsrr1kXJis%252bJwANxo1JtN8aMQxukBeGcxU%3d

Does anyone have an idea what's going wrong and why when the 3.3 side of the i2c bus is pulled low the 5v side of the bus is not pulled low?

GlacialWanderer

I think the max gs voltage is too high on the mosfet I choose.  I need this to have a max of 1.7V and my mosfet has 2-4 volt value.  More info about this is here: http://ics.nxp.com/support/documents/interface/pdf/an97055.pdf

Time to order a new mosfet and see if that fixes the problem...

Go Up