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.

[PIC] I2C Multi master problem, help needed

Status
Not open for further replies.

milan.rajik

Banned
Advanced Member level 5
Joined
Apr 1, 2013
Messages
2,524
Helped
540
Reputation
1,078
Reaction score
524
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.

broken link removed

- - - 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.

broken link removed
 

Attachments

  • I2C Master Slave mikroC PRO PIC MultiMaster.rar
    210.5 KB · Views: 204
  • i2c multi master.png
    i2c multi master.png
    46 KB · Views: 190
  • I2C Master Slave mikroC PRO PIC MultiMaster rev2 working.rar
    216 KB · Views: 129
  • i2c multi master working.png
    i2c multi master working.png
    45.1 KB · Views: 242
Last edited by a moderator:

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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top