Due to a board layout error, I need to use the i2c character LCD backpack on the I2C1 bus (SCL = P9-17, SDA = P9-18) instead of the default I2C2 bus (SCL = P9-19, SDA = P9-20).
If I use config-pin to make P9-17 & 18 into I2C pins (aware that this is only a temporary solution), I can detect the backpack when I do an i2cdetect -y -r 1, but when I run the test example code, I get a "no device at address 20" error.
What's the best way to get the Adafruit library to talk to the backpack on IC21? I see that the old library allowed the user to set the bus, and I see that the current library defaults to board.SDA and board.SCL, but I didn't find where those values are set.
Thanks,
Don
BBB and I2C Backpack, Use I2C1?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dpancoe
- Posts: 18
- Joined: Thu Sep 06, 2012 10:28 am
Re: BBB and I2C Backpack, Use I2C1?
Here are two workarounds I found. Both worked for me.
For the first, I modified my code as follows...For the second, I modified beaglebone_black.py as follows, from...
to...
then I only had to modify my code as follows...
Don
For the first, I modified my code as follows...
Code: Select all
from adafruit_blinka.microcontroller.am335x import pin
...
i2c = busio.I2C(pin.I2C1_SCL, pin.I2C1_SDA) # was (board.SLC, board.SDA)
Code: Select all
123 SDA = pin.I2C2_SDA # P9_19
124 SCL = pin.I2C2_SCL # P9_20
Code: Select all
123 SDA1 = pin.I2C1_SDA # P9_17
124 SCL1 = pin.I2C1_SCL # P9_18
125 SDA2 = pin.I2C2_SDA # P9_19
126 SCL2 = pin.I2C2_SCL # P9_20
Code: Select all
i2c = busio.I2C(board.SCL1, board.SDA1) # was (board.SLC, board.SDA)
- dpancoe
- Posts: 18
- Joined: Thu Sep 06, 2012 10:28 am
Re: BBB and I2C Backpack, Use I2C1?
As a side note, since I am using the BeagleBone Black Industrial (extended temperature range, but otherwise the same), I had to add the following lines to board.py
Code: Select all
elif board_id == ap_board.BEAGLEBONE_BLACK_INDUSTRIAL:
from adafruit_blinka.board.beaglebone_black import *
- drewfustini
- Posts: 944
- Joined: Sat Dec 26, 2015 1:19 pm
Re: BBB and I2C Backpack, Use I2C1?
Could you raise a pull request to add the Industrial to Adafruit_Blinka like you did in your local version?
Thanks!
Thanks!
- dpancoe
- Posts: 18
- Joined: Thu Sep 06, 2012 10:28 am
Re: BBB and I2C Backpack, Use I2C1?
Done. Didn't push my other changes since those would create problems with other published code.
Don
Don
Please be positive and constructive with your questions and comments.