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.

I2C Communication Between two Micorcontrollers

Status
Not open for further replies.

sadashiv_sm

Member level 3
Joined
Mar 23, 2004
Messages
64
Helped
6
Reputation
12
Reaction score
3
Trophy points
1,288
Location
Mumbai,India
Activity points
549
iic half-duplex communication

Hello Freinds...

is it possible to do I2C Between Two Microcontrollers???
If yes
How To do this....??

this was one of the interview question i am not able to answer. :-(

Thanks

Sadashiv
 

Prabakaran

Full Member level 3
Joined
Jan 22, 2007
Messages
168
Helped
9
Reputation
18
Reaction score
3
Trophy points
1,298
Location
Chennai(India)
Activity points
2,273
The communication between two controller is Master and slave mode right. whether it will work on Full duplex mode?
 

manish12

Advanced Member level 3
Joined
Nov 21, 2006
Messages
982
Helped
66
Reputation
132
Reaction score
33
Trophy points
1,308
Activity points
6,114
this is can concepet .
i did number of times.
1] use serial master and slave config using 9th bit
2] use polling concept bet 2 / 3 lines
3] using timers i.e set as ext. timers , start / stop logic

this is the well know methods and well run , each has its own imp.
 

x_zoli

Advanced Member level 4
Joined
Jul 22, 2004
Messages
105
Helped
9
Reputation
18
Reaction score
3
Trophy points
1,298
Location
Brasov, Romania
Activity points
786
Since I2C supports multimaster mode, you can implement master and slave sw modules on the same microcontroller. This way the communication can go both ways, the master of a microcontroller addresses the slave of the other and vice versa. Take care to implement also the arbitration, in case both masters want to transmit in the same time!

Best Regards
 

Kurenai_ryu

Advanced Member level 2
Joined
Jun 10, 2006
Messages
671
Helped
159
Reputation
316
Reaction score
99
Trophy points
1,308
Location
Bolivia
Activity points
5,909
don't forget that in one i2c bus the communication will be half duplex (arbitration). It can be either way (one master the other slave, master can read or write to slave)
 

kender

Advanced Member level 4
Joined
Jun 19, 2005
Messages
1,422
Helped
138
Reputation
276
Reaction score
39
Trophy points
1,328
Location
Stanford, SF Bay Peninsula, California, Earth, Sol
Activity points
9,968
Some microcontrollers have I2C slave hardware and some don't. If the uC doesn't have the I2C slave hardware, it can be replaced with firmware. However, in most cases firmware implementation of I2C slave is highly impractical.
 

jan noha

Member level 1
Joined
Dec 10, 2002
Messages
32
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
256
If you need some detailed info about I2C, please, look into application notes on the Silabs (Cygnal) site. Few moths ago, I wrote some 8051F01x I2C code based on these documents.
As I remembered, l also googled some nice document made by Michrochip which includes waveforms, detailed description of this topic and discussing some details about procedure, how to wait for an answer from slave. Maybe, I could find it somewhere if you really need it.
IMHO, I2C is my contemprorary favourite for short - up to 30 cm - distance, because I am really tired to solve an arbitration by software itself - for example, by 9-th bit of RS232, as mentioned above. I2C makes it by the HW and SW together and if you lost the arbitration, you can easily wait for free I2C link - of course, it is supported by HW on Cygnals too -, and try to "win" next time. All code is then interrupt driven state diagram which is "half duplex", but allows you to recognize Tx and Rx states. Broadcasting - aka general calling address - is also possible.
Last but not least,there is also Philips's application note AN255 about I2C describing a long distance I2C link (hunderds of meters). Very interesting reading at all. (But now, I am trying to build low cost duplex optical link - <20$ - up to 10 meters & 3Mb/s, so I have not time to try now.)
Jan
 

sn_burki

Full Member level 5
Joined
Feb 18, 2003
Messages
260
Helped
16
Reputation
32
Reaction score
11
Trophy points
1,298
Location
Pakistan
Activity points
1,623
hi

you must got your answer by now as my fellows have already answer your question. I would simply say that communication between to ucs is just easy like when you use a mc to communicate serially with any i2c chip. you can use both either in ful or in half duplex mode. one will be master and one will be slave.

regards
 

fast_learner

Newbie level 1
Joined
Jul 11, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Nairobi, Kenya
Activity points
1,300
Pardon my ignorance but what is I2C? I've been trying to follow this thread but I don't understand what is being talked about
 

Kurenai_ryu

Advanced Member level 2
Joined
Jun 10, 2006
Messages
671
Helped
159
Reputation
316
Reaction score
99
Trophy points
1,308
Location
Bolivia
Activity points
5,909
the Inter-Integrate Bus IIC bus or I2C Bus is a communication Bus developed by phillips, and it can communicate betwen 2 or more devices, it uses just 2 lines, serial Data line or SDA and the serial clock line or SCL (some times its called SCK) to connect to the devices... each device has an unique address to ID over the bus...

you can find the I2C spec at...
**broken link removed**
 

kender

Advanced Member level 4
Joined
Jun 19, 2005
Messages
1,422
Helped
138
Reputation
276
Reaction score
39
Trophy points
1,328
Location
Stanford, SF Bay Peninsula, California, Earth, Sol
Activity points
9,968
fast_learner said:
Pardon my ignorance but what is I2C? I've been trying to follow this thread but I don't understand what is being talked about
Apologies for a link to Wikipedia, but here's a summary on I2C and its capabilities: https://en.wikipedia.org/wiki/I2C
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top