You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context
Raspberry Pi : v4 Model B
pigpio C library : v78
Use multiple MCP23017 devices with I2C protocol.
Problem
When initializing multiple devices, first device with handle 0 (returned by i2cOpen) can be used without problem. I can write with i2cWriteByteData.
But using another device with handle 1, I can't write anymore as the library returns a PI_BAD_HANDLE error code when using i2cWriteByteData. While the call to i2cOpen for second device, returned a valid handle 1.
You can fix it by replacing i with slot. I guess i is no longer in sync with slot after the loop. After changing it on local, I no longer have this issue.
The text was updated successfully, but these errors were encountered:
Context
Raspberry Pi : v4 Model B
pigpio C library : v78
Use multiple MCP23017 devices with I2C protocol.
Problem
When initializing multiple devices, first device with handle 0 (returned by
i2cOpen
) can be used without problem. I can write withi2cWriteByteData
.But using another device with handle 1, I can't write anymore as the library returns a PI_BAD_HANDLE error code when using
i2cWriteByteData
. While the call toi2cOpen
for second device, returned a valid handle 1.Example
Solution
After analyzing the code in
pigpio.c
. There is a mistake in thei2cOpen
function :pigpio/pigpio.c
Line 4119 in cc17196
You can fix it by replacing
i
withslot
. I guessi
is no longer in sync withslot
after the loop. After changing it on local, I no longer have this issue.The text was updated successfully, but these errors were encountered: