Main Content

Troubleshoot Raspberry Pi I2C Interface

Trying to create a connection with an I2C device produces an error:

addr = scanI2CBus(mypi,'i2c-1')
i2csensor = i2cdev(mypi,'i2c-1',char(addr))
Error using raspi.internal.i2cdev (line 67)
An active connection to I2C device at address 0x62 already exists.
You cannot create another connection.

Error in raspi/i2cdev (line 507)
            i2cObj = raspi.internal.i2cdev(obj, varargin{:});

Another connection to the device at that address exists. Create a connection to a device that has a different address, or clear the handle for the current connection.