0

The June 4, 2018 Instructables article Raspberry Pi Multiple I2C Devices by Jacco Slabbert says

The latest raspbian kernel support the creation of multiple I2C busses using GPIO pins.

See also in GitHub.

This allows you to define additional SMBus objects:

import smbus

bus3 = smbus.SMBus(3)          #Aditional 12c bus, configured in config.txt
bus4 = smbus.SMBus(4)          #Aditional 12c bus, configured in config.txt 

by adding "the following lines to your config.txt file"

dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=2,i2c_gpio_sda=23,i2c_gpio_scl=24

dtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=2,i2c_gpio_sda=17,i2c_gpio_scl=27

Here two new pairs of GPIO pins are given sda and scl functions, so even if you have several I2C devices that use the same address, you can connect them all to your GPIO without an additional hardware multiplexer, or without using i2c bitbanging with pigpio, thought pigpio bitbanging the various kinds of communication is really useful once you start to use it.

Question: How can one check one's Pi 3's "Raspbian kernel" to see if it will support this? Is there a particular version number where this support started? Has this support been announced and documented somewhere where I can read further?

1

Nothing to do with kernel. This is enabled in Device Tree

Name:   i2c-gpio
Info:   Adds support for software i2c controller on gpio pins
Load:   dtoverlay=i2c-gpio,<param>=<val>

/boot/overlays/README describes the supported Device Tree overlays
lsmod will list loaded modules

  • I'm confident that your answer is correct but I don't understand it. For a person who knows neither what a kernel nor a device tree is, could you explain what I need to do to find out if my RPi 3 will work this way in simple, non-developer terms? In the mean time, I will refrain from panic. – uhoh Jul 12 '18 at 7:30
  • For example I can find things written about Device Tree, e.g. raspberrypi.org/documentation/configuration/device-tree.md but after reading through once, I still don't understand if I am looking to view a particular text file, or if I need to update something associated with the system by connecting to the internet. – uhoh Jul 12 '18 at 7:40
  • Look at /boot/overlays/README which describes the supported overlays. DT configures the GPIO pins and loads any module required. There is probably a LKM in the firmware (try it and see what modules are loaded). This feature was introduced along with the 4.14 kernel – Milliways Jul 12 '18 at 7:42
  • I'm sure this is crystal clear to people who work with the os regularly. I'll try to look for someone who can tell me what an LKM is and how to try to see what modules are loaded. If there was a particular line or statement or keyword I should be looking-out for, that would be helpful to know. Nonetheless, thanks for the information! – uhoh Jul 12 '18 at 7:51
  • Loadable Kernel Module (I am sure google would have told you this). In the bad old days you had to compile a kernel to add new modules, now there are a large number which can be loaded on demand. Your problem is getting involved with kernel, rather than just asking a simple question. There are whole libraries i.e. collections of books written on kernel. Note I don't pretend to understand all this and haven't compiled a kernel for decades - but you don't need to know this to use Linux. – Milliways Jul 12 '18 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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