pozz
2022-11-08 15:08:52 UTC
I wanted to implement an I2C bus recovery during initialization. The
reason is well known in literature[1].
I read the function i2c_generic_recovery[2] of Linux kernel, but I don't
understand one thing.
The bus recovery is necessary to bring a slave to the end of a byte
transmission that could be interrupted for some reason.
However the slave could be transmitting 0xFF, so why the above function
breaks the loop if SDA is detected high?
[Line 620] /* Break if SDA is high */
Maybe it's better to send 9 clock cycles whatever the level of SDA line.
And what about STOP condition at the end of the 9 clock cycles? Is it
necessary? It should be (SCL is already high): set SDA low, pause, set
SDA high.
Do you use this sort of bus recovery?
[1]
https://www.analog.com/media/en/technical-documentation/application-notes/54305147357414AN686_0.pdf
[2] https://elixir.bootlin.com/linux/v4.5/source/drivers/i2c/i2c-core.c#L604
reason is well known in literature[1].
I read the function i2c_generic_recovery[2] of Linux kernel, but I don't
understand one thing.
The bus recovery is necessary to bring a slave to the end of a byte
transmission that could be interrupted for some reason.
However the slave could be transmitting 0xFF, so why the above function
breaks the loop if SDA is detected high?
[Line 620] /* Break if SDA is high */
Maybe it's better to send 9 clock cycles whatever the level of SDA line.
And what about STOP condition at the end of the 9 clock cycles? Is it
necessary? It should be (SCL is already high): set SDA low, pause, set
SDA high.
Do you use this sort of bus recovery?
[1]
https://www.analog.com/media/en/technical-documentation/application-notes/54305147357414AN686_0.pdf
[2] https://elixir.bootlin.com/linux/v4.5/source/drivers/i2c/i2c-core.c#L604