CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

I2C specification

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ibg



Joined: 19 Nov 2003
Posts: 22

View user's profile Send private message

I2C specification
PostPosted: Mon Sep 20, 2004 12:03 pm     Reply with quote

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







PostPosted: Mon Sep 20, 2004 3:35 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Mon Sep 20, 2004 5:15 pm     Reply with quote

It is up to your firmware to handle the collisions and take the proper action.
Guest








PostPosted: Mon Sep 20, 2004 7:04 pm     Reply with quote

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).
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group