|
|
View previous topic :: View next topic |
Author |
Message |
anrep
Joined: 06 Mar 2014 Posts: 1 Location: mexico city
|
Hello. can someone show me about i2c on multimaster mode |
Posted: Thu Mar 06, 2014 3:29 pm |
|
|
I'm making a circuit with two pics and one i2c rtc and 24c04.
One pic controls an lcd and a keyboard. The other controls sensors and actuators. This last one reads info from rtc and keeps it in the 24c04, the other only read the memory and display it on lcd, and program the rtc.
How can i do it? _________________ hi, I'm starting to work with pics, and i need much help |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Fri Mar 07, 2014 1:16 am |
|
|
Best way, add another wire.
Problem is that true 'multi master' requires all the slave devices to also understand this, and protocols in place to handle bus collisions etc.. Your slave devices do not have this.
So instead, have a single wire with a pull up resistor, connected between the PIC's.
Then a device wanting to 'send', verifies the wire is high. Waits till it is.
Once it is high, pulls it low, and waits a short time.
Then _releases_ it (output_float), and checks that it goes high. If it doesn't, go back to the first test.
If it does go high, pulls it low again, does the I2C transaction, and then releases it.
In each case the wire is either released (output_float), or driven low (output_low). The level is checked using 'input_state'.
Since there is then only one master device on the bus at any time, normal transactions can then be used.
The 'release and check', verifies that the other device has not pulled the wire down at almost the same moment.
I have to say that it'd be easier to program, and likely to be less trouble, to have one device only control the bus, and just send the data with perhaps RS232 to the other.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|