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.

[PIC] I2C Multi master problem, help needed

Status
Not open for further replies.

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
Hi

This is a different project compared to the other two i2C projects of which I asked questions. So, I am posting this in a separate thread.

The earlier two were I2C Master-Slave communication but this is I2C Multi master Communication.

I have a problem. In the project Master-Slave1 is named as master and Master-Slave2 is named as slave.

I am testing in both Proteus and hardware. For hardware I am using two EasyPIC v7 development boards with Saleae Logic Analyzer and on both I am getting the same signals.

So, the problem is in the code. See the image. You can see that

Master-Slave1 is successfully sending data to Master-Slave2 and then
Master-Slave2 is successfully sending data to Master-Slave1

the problem happens after this.

After this, Master-Slave2 to Master-Slave1 communication happens good but Master-Slave1 to Master-Slave2 communication doesn't happen properly. See the question marks in the i2C debugger data.

I think the problem is in setting the I2C lines as outputs for master mode and inputs for slave mode.

117986d1432976809-i2c-multi-master.png


- - - Updated - - -


Edit:

My guess was right. I should not configure TRISC as output while acting as master. The
Code:
 I2C1_Init(100000);
will take care of the I2C pins tris settings.

Now the I2C Multi-Master project is working fine in both Proteus and hardware.

117988d1432979126-i2c-multi-master-working.png
 

Attachments

  • I2C Master Slave mikroC PRO PIC MultiMaster.rar
    210.5 KB · Views: 13
  • i2c multi master.png
    i2c multi master.png
    46 KB · Views: 28
  • I2C Master Slave mikroC PRO PIC MultiMaster rev2 working.rar
    216 KB · Views: 22
  • i2c multi master working.png
    i2c multi master working.png
    45.1 KB · Views: 23
Last edited:

babatundeawe

Full Member level 5
Joined
Apr 12, 2007
Messages
244
Helped
16
Reputation
32
Reaction score
12
Trophy points
1,298
Location
Nigeria
Activity points
2,727
this is great. you have made good work here. just what i needed.

will check it out and give you feedback. hope my questions are welcome?

thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top