0

I am using a Compute Module 4 running Raspbian Bulleye (32 bit version). I configured I2C-4 using these lines in /boot/config.txt :

dtparam=i2c_arm=on
dtoverlay=i2c-gpio,bus=4,i2c_gpio_sda=6,i2c_gpio_scl=7
dtparam=i2c_baudrate=400000

The slave is an arduino. I am able to use i2cdetect to view the slave on the bus, write data to it, etc.

The problems is when I reboot the CM4 board, if I try to do an i2cdetect -y 4, the command ends with an I/O error. If I try again the command, it ends successfully and show me the slave address.

On hardware side, there is pull-up with 4k7 Ohm on both SDA and SCL lines. There is no other devices on the bus.

I tried to :

  • reduce the bus speed from 400 khz to 100 khz
  • reopen the slave communication on the arduino (using a new call to slave.begin(scl, sda)) before each reboot of the CM4

What might be the solution to avoid the problem explained before (bus is only responding the second time) ?

Thansk for your help.

2
  • Have you looked at the bus during these commands? Why are you assuming the problem is at the Pi end? Arduino I2C software is pretty flakey.
    – joan
    Aug 1, 2022 at 15:26
  • Is there a reason you use I2C to communicate with the Arduino? Just use the USB connection and many things will be much easier.
    – PMF
    Aug 3, 2022 at 14:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.