Hello,
I am trying to create 2 i2c bus instances using the circuit python board library as shown below on rpi4b:
i2c1 = busio.I2C(board.SCL, board.SDA)
i2c2 = busio.I2C(board.D24, board.D23)
i2c1 runs on the default bus 1 but I have added an addtional bus on bus 2 (i2c2) on gpio pins 23 and 24 and activated it in the boot/config.txt as well. My pi is able to recocognize both sensors on both buses when I run i2cdetect -y 1 and i2cdetect -y 2.
But when I run my script it says that there are no hardware i2c port on gpio pins 23 and 24. I have confirmed that board.D23 and board.D24 are the correct pins by running dir(board)
On the Circuit Python website about the board library it states:
"The board.I2C(), board.SPI(), and board.UART() singletons do not exist on all boards. They exist if there are board markings for the default pins for those devices." Link: https://learn.adafruit.com/circuitpytho ... nd-modules
Any suggestions?
Thanks,
Arya
Circuit python adding I2C bus
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- danhalbert
- Posts: 4653
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Circuit python adding I2C bus
Which board is this? Since you are using `i2cdetect`, I assume this is an RPi or other Linux single board computer.
- danhalbert
- Posts: 4653
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Circuit python adding I2C bus
Have you followed instructions like this? Could you report the exact error message you are seeing, and show us your code?
Note that you don't necessarily need two buses for two devices. You can have multiple devices on a single bus as long as they don't have duplicate addresses.
Note that you don't necessarily need two buses for two devices. You can have multiple devices on a single bus as long as they don't have duplicate addresses.
Please be positive and constructive with your questions and comments.