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 MultiMaster Problem?

Status
Not open for further replies.

PRATIK.PATI

Newbie level 6
Joined
Jun 7, 2017
Messages
11
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Location
Bangalore
Activity points
95
19- There are two Microcontrollers on one I2C Bus (Both having inbuilt I2C) and one slave. The 1st micro controller having address 01, slave address is 02, and other microcontroller address is 03.

Now the 1st microcontroller tried to access the slave at the exact time the 2nd microcontroller tried to access the 1st microcontroller. Who would win arbitration? Assume that the start bit occurred exactly at the same time.
 

Hi,

Now the 1st microcontroller tried to access the slave at the exact time the 2nd microcontroller tried to access the 1st microcontroller. Who would win arbitration?

You say "at the exact time".
I say this is just an theoretical case.
There will be no problem.
The I2C arbitration (when implemented as in the I2C standards) works as folows.
* Each master send´s out it´s data and reads back the state of the signal line.
* A bus error is detected when the master is in "write_mode" and sends out a "1", but reads in a "0".
* The master that detects the mismatch should immediately disconnect from bus.
* The other master may continue communication.

****
But when both masters send out the same data at exactly the same time no one will (and needs to) detect the problem, The slave will respond and both masters will receive the same data.
This situation is not realistic ... it just gives the answer to your question.

Klaus
 

Hello KlauST, Thank you for your reply, it's very helpful.

But my question was a bit different.

It has two conditions;
a) the 1st microcontroller(Addr-01H) tried to access the slave(Addr-02H)
b)2nd microcontroller(Addr-03H) tried to access the 1st microcontroller
 

Despite of the unrealistic assumption of exactly simultaneous start, you can easily figure it out. Just look at the address bytes. At the first different bit value, the master sending a low level wins. In this case 01 wins over 02.
 

Hi,

The answer is almost the same:
The I2C arbitration (when implemented as in the I2C standards) works as folows.
* Each master send´s out it´s data and reads back the state of the signal line.
* A bus error is detected when the master is in "write_mode" and sends out a "1", but reads in a "0".
* The master that detects the mismatch should immediately disconnect from bus.
* The other master may continue communication.

Klaus
 

Hello FvM, I agree with the answer, but theoretically the condition exists. So according to the answer the master sending '0' first wins arbitration. So according to my question the 2nd Microcontroller wins and keeps on transmitting the frame.

But as the 1st microcontroller lost the arbitration then according to the I2C bus-specification it will go into slave-mode in which it will only be released when a StopBit Or StartBit is met, So the 1st Microcontroller won't give ACK.

That makes it more confusing. Does it have any counter measures for this particular condition(according to the I2C Bus-Spec)?
 

That's no arbitration problem. It's the question how the "1st microcontroller" is switching between master and slave role, an application layer problem.

By the way, which real world application involves the sketched configuration?
 

Hello FvM,

Actually i am using two master microcontrollers(MDUC812) having inbuilt I2C.

I just wanted to know that If there isn't any hardware configuration taking care of this for me then i have to add some extra code if this condition occurs(Just In Case).

Hello KlauST, you are right.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top