[PIC] I2C Multi master problem, help needed

Status
Not open for further replies.

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,524
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Visit site
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
    46 KB · Views: 190
  • I2C Master Slave mikroC PRO PIC MultiMaster rev2 working.rar
    216 KB · Views: 130
  • i2c multi master working.png
    45.1 KB · Views: 245
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

Cookies are required to use this site. You must accept them to continue using the site. Learn more…