背景
在通过I2C读SFP 模块的时候发现读到数据不对,现象是感觉丢掉了几个bit。
调查
通过测试波形,发现异常。
原因
有经验的同事指出是I2C 的stretching。
简单说:从设备跟不上主设备的速度,想要跑慢一点。就可以通过拉低住时钟信号来实现。
In an I2C communication, the master device determines the clock speed. Unlike RS232 the I2C bus provides an explicit clock signal which relieves master and slave from synchronizing exactly to a predefined baud rate.
However, there are situations where an I2C slave is not able to co-operate with the clock speed given by the master and needs to slow down a little. This is done by a mechanism referred to as clock stretching.
An I2C slave is allowed to hold down the clock if it needs to reduce the bus speed. The master, on the other hand, is required to read back the clock signal after releasing it to the high state and wait until the line has actually gone high.
搜索相关资料:
I2C Clock Stretch
clock-stretching/
网友评论