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.