-1

I need to add 2 additional gpio buses. I'm using the usual i2c for a port expander and also need to read/write two different external eeproms that need to be plugged in on different pins.

Adding a line in config.txt like this only works once and the bus is always #3. dtoverlay=i2c_gpio,i2c_gpio_sda=27,i2c_gpio_scl=22

After reboot you can see the device using i2cdetect -y -a 3 But adding a second line for another set of pins in config.txt doesn't work.

So, where is that bus number specified and is it possible for me to add another one and perhaps make a separate dtoverlay for it? I looked at the dts source file for the i2c_gpio overlay on github, but I didn't see anywhere in that file where the bus number was set.

Thanks for any help on this, Jerry

1 Answer 1

0

I would suggest using the pigpio library to avoid the problem entirely. It allows you to specify any pair of GPIO pins to be used as an I2C interface and provides very easy to use I2C commands. See my answer to a previous question for an example of using pigpio.

1
  • Ok, I'll give that a try. I didn't realize you could use pigpio without an already assigned i2c bus number. Commented Feb 16, 2018 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.