I2C problem on Dragonboard 410c


#1

Hi,

I have developed an app to use JNI to control a self-developed I2C device but encounter some problems. The I2C device can accept at most 37.5kHz, so that I modify the clock rate in device tree.

  1. The app will keep write to the I2C every 20ms and will not do anything when it does not receive ACK from the device. When the I2C device is disconnected, the board can still work. But when I change the polling period to 10ms or less, the board will freeze after receiving many NACK. Before the board freezes, the system slow down and the mouse is lagging behind. If I add more debug messages in i2c-msm-v2, the board also freezes easily.

  2. The app will write 16 bytes data to the device. Monitor the waveform with oscilloscope and find that sometimes the clock and data will drift a little at the middle of a byte transfer. The I2C bus has one device only. Also, I can see that there is i2c_lock_adapter(adap) in the code to protect it from concurrent access.

Can anyone advise how to debug the above problems?

Many thank in advance!


#2

Hi,

I inspect the source code of i2c-msm-v2 and find nothing strange.
I compile the i2c-tools and write a script file to write the i2c device repeatedly.
#!/system/bin/sh
while true
do
i2cset -y 0 0x50 0x80 0x1
done

The board will freeze in a short time.
Do anyone have idea what’s going wrong?

Many thanks!


#3

Hi,
I’m also planning to work with I2C soon enough.
Did you figure out what’s the issue with the i2c? Are you running this on Android system?

Thanks,
Mike


#4

Hi Mike,

No solution yet. There is no problem if i2c device replies normally.