-
Updated for Pi4
09/18/2020 at 03:07 • 0 commentsI have updated this overlay to work with the Pi4 and more recent Raspian releases.
-
The virtues of software I2C on the Raspberry Pi
10/09/2018 at 22:41 • 0 commentsTested most recently with Raspbian Stretch. This is most useful for devices that are SMbus compliant ( <=100khz clock ) or have fixed addresses that prevent using more than one on the same bus. This is also a good work-around on the Raspberry Pi for the clock-stretching bug that some devices (AM2315 for instance) misbehave with the clock artifacts from the hardware ARM I2c bus. Control the clock speed by modifying the delay ( i2c_gpio_delay_us ).
This software bus provides some additional SMbus support.
### I2C-ARM
pi@raspberry:~ $ sudo i2cdetect -F 1
Functionalities implemented by /dev/i2c-1:
I2C yes
SMBus Quick Command yes
SMBus Send Byte yes
SMBus Receive Byte yes
SMBus Write Byte yes
SMBus Read Byte yes
SMBus Write Word yes
SMBus Read Word yes
SMBus Process Call yes
SMBus Block Write yes
SMBus Block Read no
SMBus Block Process Call no
SMBus PEC yes
I2C Block Write yes
I2C Block Read yes### Software-I2C
pi@raspberry:~ $ sudo i2cdetect -F 3
Functionalities implemented by /dev/i2c-3:
I2C yes
SMBus Quick Command yes
SMBus Send Byte yes
SMBus Receive Byte yes
SMBus Write Byte yes
SMBus Read Byte yes
SMBus Write Word yes
SMBus Read Word yes
SMBus Process Call yes
SMBus Block Write yes
SMBus Block Read yes
SMBus Block Process Call yes
SMBus PEC yes
I2C Block Write yes
I2C Block Read yesMany sensor devices are not capable of using a I2C clock over 100khz or have trouble with certain limitations of the hardware implementation of I2C in the Raspberry Pi.
When the data sheet has SMBus or I2c_ModBus mentioned, the device is probably going to need SW I2C. It is sort of an indication of the age of the design. Also mention of a maximum 100khz clock. New compliant designs clock at 400khz or better.
This app note discusses how SMBus != I2C