0

Issue with Adafruit_LiquidCrystal and wire lib
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Issue with Adafruit_LiquidCrystal and wire lib

by taprik on Wed Nov 18, 2020 1:57 pm

Hello there,
I'm having issue with Adafruit_LiquidCrystal library and the wire library.
The schematic :
I'm using a LCD display connected with the i2c backpack (like describe at https://learn.adafruit.com/i2c-spi-lcd- ... no-i2c-use). I've used it many times in my projects since few years and I'm very satisfied of this product.
This time I had a SparkFun Differential I2C Breakout in the i2c chain (https://www.sparkfun.com/products/14589).
Every thing is fine when nothing is requested on the i2c port of the sparkfun breakout. But when the other distant board is requesting data, there is some issue on the lcd display.
I've also use the i2C breakout on many projects without any issues. But the two together is not working.
The data are well transmitted between the 2 Sparkfun I2C breakout.
The code used is the i2c helloworld example with some addtionnal code for the i2c communication on the sparkfun breakout.
I've tried to put delay in the loop. It changes nothing.
Any ideas ?
Code: Select all | TOGGLE FULL SIZE
/*
  LiquidCrystal Library - Hello World
 
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 25 July 2009
 by David A. Mellis
 
 
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include "Wire.h"
#include "Adafruit_LiquidCrystal.h"

int sendInts[2];

// initialize the library with the numbers of the interface pins
Adafruit_LiquidCrystal lcd(0);

void setup() {
  // set up the LCD's number of rows and columns:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");

  Wire.begin(20);                // join i2c bus with address #8
  Wire.onRequest(requestEvent); // register event

  sendInts[0] = 123;
  sendInts[1] = 456;
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

//---------------------------------------------------
void requestEvent()
{
  //Envoi d'un entier seul
  /*int temp = int(watt);
  byte msb = (temp) >> 8;
  byte lsb = temp & 0x00FF;
  Wire.write( msb );
  Wire.write( lsb );*/
  //Envoi d'une array d'entier
  Wire.write((uint8_t*)&sendInts, sizeof(sendInts));
}
Attachments
PXL_20201118_173847758.jpg
PXL_20201118_173847758.jpg (768.13 KiB) Viewed 179 times

taprik
 
Posts: 10
Joined: Fri Oct 07, 2016 8:45 am

Re: Issue with Adafruit_LiquidCrystal and wire lib

by adafruit_support_carter on Fri Nov 20, 2020 2:46 pm

I've also use the i2C breakout on many projects without any issues. But the two together is not working.

And just to be clear - it only happens with the combo? If you connect that specific LCD directly (without the I2C extender), it works as expected?

adafruit_support_carter
 
Posts: 20535
Joined: Tue Nov 29, 2016 2:45 pm

Re: Issue with Adafruit_LiquidCrystal and wire lib

by taprik on Fri Nov 20, 2020 4:35 pm

I didn't try the lcd without the I2C backpack as the two are soldered together.

I'm trying to find a way with the two on the i2C bus. it's an upgrade of an existing project. I'm adding the sparkfun i2c breakout to add new features and I want to keep the original project unchanged.

The i2c backpack is supposed (in code) to "be" at address 0.
The i2c breakout is configured to be at address 20.

The issue is only happening when the other I2c breakout request data to the arduino connected with lcd & sparkfun breakout on i2c bus

taprik
 
Posts: 10
Joined: Fri Oct 07, 2016 8:45 am

Re: Issue with Adafruit_LiquidCrystal and wire lib

by adafruit_support_carter on Fri Nov 20, 2020 4:54 pm

Sorry, by combo I meant with the I2C extender. Not the LCD+backpack combo.

If you wire it up without the extender, what happens? Like what's shown in the guide you linked:
https://learn.adafruit.com/i2c-spi-lcd- ... no-i2c-use

adafruit_support_carter
 
Posts: 20535
Joined: Tue Nov 29, 2016 2:45 pm

Re: Issue with Adafruit_LiquidCrystal and wire lib

by taprik on Sun Nov 22, 2020 11:41 am

Yes it's working without the sparkfun i2C extender but not with.
I've used the sparkfun i2c extender on many projects without any issue,
I've used the lcd + I2c backpack on many projects without any issue,
but together the lcd is not displaying the correct sentence, and the i2c extender is working normally

taprik
 
Posts: 10
Joined: Fri Oct 07, 2016 8:45 am

Re: Issue with Adafruit_LiquidCrystal and wire lib

by adafruit_support_carter on Mon Nov 23, 2020 1:57 pm

The issue is only happening when the other I2c breakout request data to the arduino connected with lcd & sparkfun breakout on i2c bus


The breakout you mention here is something other than the I2C extender?

Or to ask another way - how many items are on the I2C bus?

adafruit_support_carter
 
Posts: 20535
Joined: Tue Nov 29, 2016 2:45 pm

Re: Issue with Adafruit_LiquidCrystal and wire lib

by taprik on Tue Nov 24, 2020 8:23 am

There is two items on the i2c bus :
The lcd with i2c backpack and the sparkfun i2c breakout.
I've try the lcd first, then in second position. I've tried many i2c adresses for the i2c breakout. It's the same.
Attachments
292-012.jpg
292-012.jpg (661.81 KiB) Viewed 115 times

taprik
 
Posts: 10
Joined: Fri Oct 07, 2016 8:45 am

Re: Issue with Adafruit_LiquidCrystal and wire lib

by adafruit_support_carter on Tue Nov 24, 2020 2:36 pm

Interesting, you aren't actually even using the differential transceiver. just passing through I2C on the Qwiic connectors.

Seems like there is something about that breakout that's causing interference with passing through I2C devices on the Qwiic connectors like that. I wouldn't initially think it would be the additional pull ups. Maybe it's power related? Not sure. Have you tried contacting Sparkfun to see if they have any ideas?

adafruit_support_carter
 
Posts: 20535
Joined: Tue Nov 29, 2016 2:45 pm

Re: Issue with Adafruit_LiquidCrystal and wire lib

by taprik on Tue Nov 24, 2020 2:52 pm

I'll do that.

Actually I use this board to transmit i2c data on long distance. I have the same i2c breakout far away which is connected to this one with ethernet cable.
I've also try with or without the internal pullup resistor, but it's the same (you have jumpers you can cut on the board).
Best

taprik
 
Posts: 10
Joined: Fri Oct 07, 2016 8:45 am

Please be positive and constructive with your questions and comments.