Skip to main content
2 of 2
added 376 characters in body
joan
  • 71.7k
  • 5
  • 74
  • 107

There are various debug steps you can take.

  1. bit bang on the hardware I2C GPIO. If it works for SMBus then it should work with bit bang. It eliminates wiring and the pull-ups being a problem.
  2. use pigs to implement the code. If that works that would suggest the Python module is faulty. pigs bi2co 4 17 9600 then pigs bi2cz 4 4 0x68 2 6 7 3 0
  3. Switch on internal pigpio daemon debugging and try to trace the Python execution. pigs csi 4 then cat /dev/pigerr& to see the trace.
  4. Use the Pi's slave I2C bus to emulate the device. To do this connect the SDA GPIO to GPIO 18 and the SCL GPIO to GPIO 19. Use the command pigs bscx 0x680305 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 to set the slave as I2C address 0x68 and load the FIFO with 1 to 16. Then run the Python code and you should see byte values 1 to 16 (then 16 repeatedly) being returned.

In this case I suspect 1. will work as I expect the weak (50k) internal pulls are not good enough for the I2C bus.

joan
  • 71.7k
  • 5
  • 74
  • 107