Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Grand Central I2C issue
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Grand Central I2C issue

by DougU on Tue Jul 21, 2020 5:38 pm

I have what I think is an issue with my project with I2C on the GrandCentral. I'm using a 16x2 LCD with the Ada I2C backpack (0x70) and a servo 16 channel shield (0x40). With both connected, I can demonstrate the LCD (using an example program), and I can scan and see both I2C addresses. With the LCD hardwired (ie. not I2C), the servo shield works. But when I try to initialize both as I2C devices in my program, I get an error "D20 in use" (SDA). If I swap the order of initialization of the LCD and the Servo shield I get "D21 in use" (SCL). I added 10k pullups to both the LCD I2C lines, with no change. The servo shield relies on the ServoKit library, and the LCD on the Character_LCD library. Is there an incompatibility here that I don't realize? Is there a work-around, other than returning to parallel data operation for the LCD?

DougU
 
Posts: 4
Joined: Mon May 25, 2020 4:51 pm

Re: Grand Central I2C issue

by adafruit_support_carter on Wed Jul 22, 2020 2:18 pm

That looks like a CircuitPython message. And what happens when you try to recreate the I2C bus a second time. The general idea is to create the I2C bus once, and then pass that in to each item using it.

Make sure you have only one line that looks like this:
Code: Select all | TOGGLE FULL SIZE
i2c = busio.I2C(board.SCL, board.SDA)

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

Re: Grand Central I2C issue

by DougU on Thu Jul 23, 2020 12:41 pm

Ok, I modified the ServoKit initialization with:
kit = ServoKit(channels=16, i2c=i2c)
Things now work like a champ! Thanks,
Doug

DougU
 
Posts: 4
Joined: Mon May 25, 2020 4:51 pm

Please be positive and constructive with your questions and comments.