View previous topic :: View next topic |
Author |
Message |
ibg
Joined: 19 Nov 2003 Posts: 22
|
I2C specification |
Posted: Mon Sep 20, 2004 12:03 pm |
|
|
Hi all,
I have been reading the I2C specification where is said that this 2-wire bus support arbitration and collision protocols. It is also said that in case two Masters try to transfer data simultaneoulsy just one of them will take the bus and that the Master will start the transfer just if the bus is free.
My system has two PIC18F452 and other devices (EEPROM, I2C extender, Temperature sensor and RTC) connected to the I2C bus. In this system one PIC is always Master and the other acts as Master and Slave. I have experienced I2C collisions on the bus.
What can you tell me about this?
Thanks,
Ibg |
|
|
valemike Guest
|
|
Posted: Mon Sep 20, 2004 3:35 pm |
|
|
Hi,
I always make sure to choose the unique slave addresses. So one PIC is the master, and the other PIC (also the other ICs) are slaves. Make sure that the slave i2c addresses are all unique. On the PIC slave, you would specify it in firmware; on some ICs, you would specify it by pulling up or down two to three pins (LSBs), and still others, it is fixed based on part number. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Sep 20, 2004 5:15 pm |
|
|
It is up to your firmware to handle the collisions and take the proper action. |
|
|
Guest
|
|
Posted: Mon Sep 20, 2004 7:04 pm |
|
|
If for any reason (generally an error in your firmware or a hardware glitch or a reset (WDT, etc.) during I2C transactions) an I2C transaction gets interrupted during a phase where a slave is transmitting data it is possible that the state machine in the slave device will be out of sync with the bus. Depending on the device there are various ways you can solve this.
Generally you can make the assumption that it is a slave device attempting to transmit if SDA is stuck low (you'll need to disable the I2C hardware on the PIC and directly read the pin in question to verify this). |
|
|
|