Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C bus Arbitration conflicts

Status
Not open for further replies.

RAHUL_KUMAR

Member level 5
Joined
Jun 5, 2017
Messages
90
Helped
4
Reputation
8
Reaction score
4
Trophy points
8
Location
Bhubaneswar,Odisha,India
Activity points
786
while following the data sheet of i2c bus specification (philips 1995) pdf attached
the below lines in bold are not giving me the clear visualization ..

"If a master also incorporates a slave function and it loses arbitration
during the addressing stage, it’s possible that the winning master is
trying to address it. The losing master must therefore switch over
immediately to its slave-receiver mode."


my confusion is -
if master 1 tries to address master 2 (so master 2 is slave for master 1) . So is it the case here, that master 2 trying to address itself and thats why it loses arbitration ?
if yes,then where is the conflict ,if master 1 trying to address master 2 , and master 2 trying to address itself then both are addressing same ..

where i am getting wrong in understanding?
 

Attachments

  • I2C_BUS_SPECIFICATION_1995 (2).pdf
    209.7 KB · Views: 94

I2C master function isn't associated with an address, only slave function.

Loosing arbitration in a multi master system only indicates that two masters are trying to access the bus simultaneously, it's no related to accessing a specific slave. The general case is e.g. master 1 accesses slave x and master 2 slave y.

The discussed case is about master 2 implementing also a slave function. If master 1 wins the arbitration and x is the slave address of master 2, master 1 would erroneously assume slave x to be offline if it doesn't immediately activate the slave receiver function.
 
No the spec is discussing an example where master 1 is addressing master 2 but master 2 is addressing something else. That will create a conflict.

You're correct that if they were both addressing the same slave (master 2 in your example) there will be no arbitration lost. At least in the addressing phase.
 
No the spec is discussing an example where master 1 is addressing master 2 but master 2 is addressing something else. That will create a conflict.

You're correct that if they were both addressing the same slave (master 2 in your example) there will be no arbitration lost. At least in the addressing phase.

yes ,that is where i was stuck and confused. ,but your explanation arises the question that if master 2 is engaged with another device , then certainly SDA line will be engaged in this , so master 1 definately monitor the SDA line ,and if it engaged (by master 2) then how will master 1 attempt to address master 2 (as a slave) .

even if it(master 1) will be able to address it (master 2) ,how will master 2 loose the arbitration and master 1 win ??

- - - Updated - - -

I2C master function isn't associated with an address, only slave function.


The discussed case is about master 2 implementing also a slave function.
does it (BOLD WORDS) mean that master 2 attempted to address other slave device while master 1 attempted to address master 2(as slave) at same time ?

and in case if master 1 win the arbitration ,master 2 would have to immediately activate the slave receiver function . (by pulling the SDA line low (ACK)) .

AM I RIGHT ??

sir u have explained nicely ,thanks.
please acknowledge whether i understood correct or not ?
 

even if it(master 1) will be able to address it (master 2) ,how will master 2 loose the arbitration and master 1 win ??

AM I RIGHT ??

sir u have explained nicely ,thanks.
please acknowledge whether i understood correct or not ?

The open drain nature of I2C means you 'win' arbitration anytime you try to send a 0 when the other guy is sending a 1 because zeros win. So the addresses determine the winner. Master 2 loses and master 1 wins based only on their respective addresses.


and in case if master 1 win the arbitration ,master 2 would have to immediately activate the slave receiver function . (by pulling the SDA line low (ACK)) .

Well not quite, a master might lose arbitration at bit #3 so it needs to keep 'listening' to see if someone is addressing it before it pulls an ACK.


This is all a pretty minor corner case by the way. Most busses don't have two masters. Most masters don't need to be a slave.

It's also generally avoided by logically separating the slave implementation from the master implementation. Simply have the slave function/module/peripheral listening all the time regardless of what the master function/module/peripheral is doing. In many cases this is an easier way to implement it anyway.
 

Hi,

The first byte sent out by a master is the address byte.
(a slave doesn't start an I2C communication, it just responds with ACK and DATA)

It's just a therotical case that two master start a communication at the same time...
Now as long as both master send out the same logic state, there is no problem.
But as soon as the one outputs a "0", while the other with a "Z" releases the bus (usually causing a "H" by the external pullup)
...both will read back a "0"
For the first one it is the value it expects,
But the other expects a "H" ... and thus recognizes that an other member is pulling SDA --> "0".
This is the situation, where the second has to release the bus and stop it's communication. It has lost arbitration.

Klaus
 

Hi,

The first byte sent out by a master is the address byte.
(a slave doesn't start an I2C communication, it just responds with ACK and DATA)

It's just a therotical case that two master start a communication at the same time...
Now as long as both master send out the same logic state, there is no problem.
But as soon as the one outputs a "0", while the other with a "Z" releases the bus (usually causing a "H" by the external pullup)
...both will read back a "0"
For the first one it is the value it expects,
But the other expects a "H" ... and thus recognizes that an other member is pulling SDA --> "0".
This is the situation, where the second has to release the bus and stop it's communication. It has lost arbitration.

Klaus

SIR , what you have explained is the general theory of arbitration which is based on wire-and logic , the explanation is not in the context of the question i asked which is a special case of arbitration .
kindly refer to my question...
 

Hi,

Which question do you see as not answered yet?

Klaus
 

Hi

I´m not sure what you mean. You speak in riddles.

Maybe you want to know how a master(with slave capabilities) behaves when loosing arbitration while beeing accessed at the same time by another master.

--> It depends on implementation, it´s capabilities and the current state.
* If ready to answer immedialtely: it should show this with an ACK
* if not ready to anwser immedately: it should show this by NACK.
I think both scenarions are according I2C specification.

But this case is not worth to spend much time, because it´s very very unlikely, even if you want this to happen. It´s only theoretical.
For this both masters need to start communication within a couple (maybe less) of microseconds and stay about synchronized for the entire addressing phase.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top