There is a I2c slave device(0x73) is connected to T104x across a I2C mux device(0x70) on our board. We found i2c bus is held low more then 30 milliseconds by T104x after receive ACK. Could you please explain why T1042x held SCL to low so long time? It may cause i2c slave device entering reset status.
I attached the i2c wave(i2c_write.zip) captured from oscilloscope.
green: scl before i2c mux
red: scl after i2c mux
blue: sda before i2c mux
yellow: sda after i2c mux
Here are the steps for t104x writing data to slave device(0x73):
1. select i2c mux channel
write 0x20 to i2c mux(0x70)
2. write slave device(0x73) register 0x0 to 0x2 with smbus protocol. 0xbd is PEC.
write 0x73 0x00 0x02 0xbd
3. de-select i2c mux
write 0x0 to i2c mux(0x70)
It looks like that your I2C slave tied SCL low before ACK sending.
See wait-state insertion in I2C Specification. Find the Section 3.1.5 in the following document:
Thanks Pavel.
You're right. I2c slave tied SCL to low before ACK sending. That's to say i2c slave is busy and force i2c master into wait status. and the duration of SCL to low before ACK sending is about 300 microseconds. Do you think it's a i2c slave issue?
My question is why t104x held SCL to low more than 30ms from received ACK to stop the transaction.
If the I2Cx_I2CCR[MSTA] bit is changed from 1 to 0, the T1040x generates a STOP condition on I2C bus. See the Section 23.4.3 of the T1040 Reference Manual.
Check your I2C driver code for generation STOP condition on I2C bus,
Hi Pavel,
We're using standard linux driver for T104x i2c(drivers/i2c/busses/i2c-mpc.c). And i2c driver is working with irq mode. We set i2c wait event timeout to 50ms in driver for function i2c_wait().
We added some debug timestamp before and after function i2c_wait(). And found sometimes the execution of function i2c_wait() is exceed 20ms.
two possible reason to cause this issue:
1. t104x i2c interrupt handle did not be trigger by i2c irq.
2. linux system is very busy and cannot wakeup i2c wait event.
Do we have approach to set the priority of t104x i2c irq? thanks.
It looks like that your opinion is correct.
Try to change the priority of t104x i2c irq.
Do you know how to set the priority of t104x i2c irq? thanks.
See the following pages about kernel driver priority:
https://www.avrfreaks.net/forum/how-set-priority-kernel-driver
https://lwn.net/Articles/818388/
https://stackoverflow.com/questions/7676900/priority-of-kernel-modules-and-sched-rr-threads