MC9S08GT60A - I2C arbitration lost

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MC9S08GT60A - I2C arbitration lost

跳至解决方案
2,792 次查看
gaminn
Contributor IV

Hello,

I try to write data to I2C bus, but everytime immediately after I set IIC1C_MST bit in I2CWrite() function, IIC1S_ARBL bit is set so I2C interrupt routine is executed. What can cause that it?

 

void I2CInit() {  IIC1C_IICEN = 1;  IIC1A = 0x00;  IIC1F = 0x8D;    IIC1C_IICIE = 1;}void I2CWrite() {  IIC1S;  IIC1S_IICIF=1;  IIC1C_TX = 1;  IIC1C_MST = 1;  wait_5us();  IIC1D = 0x10;}
标签 (1)
0 项奖励
回复
1 解答
1,157 次查看
gaminn
Contributor IV
Stupid - I had no pullup resistors on the bus.

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,158 次查看
gaminn
Contributor IV
Stupid - I had no pullup resistors on the bus.
0 项奖励
回复
1,157 次查看
gaminn
Contributor IV

What should happen if I run only IIC1C_IICEN = 1 in the main function? I2C pins don't go high after this command.

 

When I drive PTC2 and PTC3 pins throud parallel input/output module (PTCD_PTCD2 = 1....) everything is ok.

0 项奖励
回复
1,157 次查看
gaminn
Contributor IV
There can also be problem in I2Cinit() function, because after setting IIC1C_IICEN bit, there is no changeon SDA and SCL lines (they stay low - I guess they should go high after enabling I2C module).
0 项奖励
回复