在线时间0 小时
UID166254
注册时间2010-1-3
NXP金币0
该用户从未签到
新手上路

- 积分
- 42
- 最后登录
- 1970-1-1
|
发表于 2010-9-16 14:11:13
|
显示全部楼层
回复:有个52235的I2C的问题想请大家帮我看看怎么解决:
回复第 6 楼 居颖轶于2010-08-31 12:36:39发表:
这个问题,芯片手册上有提到,在27.4.1,如下:
NOTE
If I2SR[IBB] is set when the I2C bus module is enabled, execute the following pseudocode sequence before proceeding with normal initialization code. This issues a STOP command to the slave device, placing it in idle state as if it were power-cycled on.
I2CR = 0x0
I2CR = 0xA0
dummy read of I2DR
I2SR = 0x0
I2CR = 0x0
I2CR = 0x80 ; re-enable
原因应该是非法中断通信后,而从设备状态机已经进入通信状态,导致主设备端认为总线busy,所以需要以上这段特殊的指令来恢复总线。
请问居大侠,当发现I2C总线忙时,能否通过以下办法来停止I2c总线:先禁止I2C模块,然后SCL和SDA口线改为普通IO口,然后利用IO口模仿I2C通信时序发停止信号到I2C总线上,最后再重新使能I2C模块。
???
是否一定要使用datasheet上提供的那段代码才能停止I2C总线??? |
|