View previous topic :: View next topic |
Author |
Message |
ferrarilib
Joined: 11 Jun 2005 Posts: 38
|
double ic2 |
Posted: Wed Nov 29, 2006 1:40 pm |
|
|
hallo to every one i am studing ic2 bus an i am working to my project.
my questions is possible do 2 line to ic2 bus ? example i need comunicate to lcd <--> mcu and mcu<-->gsm module ecc..
but i need comunicate lcd to mcu and mcu to lcd if i do mcu master clock do mcu but not slave device (lcd) i need do clock lcd too.
fore example do c4 c3 (mcu master) c4 c3 lcd(slave) ,a3 a4 lcd(master) and a3 a4 mcu (slave) so i can read data with ssp interupt ? in a (slave) and (master) device ? is possible it ?
thanks |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Thu Nov 30, 2006 8:54 am |
|
|
There should only be one master on the i2c bus. Each slave device has a unique address. Depending on how fast you run the I2C bus and how each slave device loads the bus and how long the bus runs, you can get several devices on the same I2C bus.
If a slave device cannot voluteer data back to the master. It must be polled by the bus master. But, if your slave device has a way of driving an interrupt line (not part of the I2C bus) it can let the master device know there is data to read. Otherwise you would set up a polling loop or timer/interrupt in the master and check the slave device(s) on a regular basis.
-- added 12/1
rneilson's point about the standard allowing multiple masters is valid. However I still say you should not have multiple masters on the same bus. As he points out, it does raise the complexity of the design considerably. Since the original poster is asking some basic I2C questions, then they should keep things as simple as possible. One master and some number of slaves, each with a different address. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Last edited by rwyoung on Fri Dec 01, 2006 4:54 pm; edited 1 time in total |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Nov 30, 2006 9:24 am |
|
|
It is possible to have multiple Masters on the same I2C bus but only one can have control of the bus at any given moment. There is an established protocol that the mutiple Masters will use to negotiate who is going to end up taking control, if more than one start talking at the same time. The Master is the MCU that generates all of the clocks for the bus. A Master can be a Master sender (sending data out to a Slave device) or a Master receiver (receiving data from a Slave device). A Slave can be in receiving or sending mode depending on what the Master is telling it to do. The nice thing about addressing is that you can have multiple I2C components on the same bus and talk to one of them without getting interference from the others. I can only imagine the reason for needing to have multiple I2C busses is if you have multiple I2C devices with the same 'hardwired' address or if a component isn't 100% I2C compatible.
Ronald |
|
|
ferrarilib
Joined: 11 Jun 2005 Posts: 38
|
|
Posted: Thu Nov 30, 2006 1:27 pm |
|
|
thanks . |
|
|
|