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.

2 MCUs communicate with each other

Status
Not open for further replies.

ericmar

Full Member level 5
Joined
Apr 14, 2004
Messages
278
Helped
3
Reputation
6
Reaction score
4
Trophy points
1,298
Location
Singapore
Activity points
2,928
Hi,

May I know how do ppl normally implement when a design has 2 MCUs. How does both MCU communicate with each other? Through UART? or SPI? Or...?

Wats the most effective way to implement this?

Thanks,
Eric Mar
 

Beowolf

Full Member level 2
Joined
Jun 19, 2006
Messages
130
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,071
Depends on the ammount of data you want to pass between. Iy ou need a lot, use SPP, if not, use SPI.
 

microlab

Full Member level 5
Joined
Mar 4, 2006
Messages
309
Helped
44
Reputation
88
Reaction score
35
Trophy points
1,308
Activity points
3,253
hai
it depends on a lot of parameters
if the distance between the mcu's are less than say 25 meters,you can use the rs 232 communication protocol
i feel this is the easiest way of communication because of less code comlexity in small distance.
if the distance is more you can use rs485

ml
 

yasser_shoukry

Full Member level 4
Joined
May 31, 2006
Messages
233
Helped
25
Reputation
54
Reaction score
5
Trophy points
1,298
Location
Cairo - Egypt
Activity points
2,749
In automotive industry, there is three main types of MCU networks in which MCUs are communicating.
The most widely used one is the CAN protocol, a lot of MCUs implements have CAN modules. CAN frame can carry up to 8 bytes.
 

ericmar

Full Member level 5
Joined
Apr 14, 2004
Messages
278
Helped
3
Reputation
6
Reaction score
4
Trophy points
1,298
Location
Singapore
Activity points
2,928
Wat if both MCUs r on the same PCB? The main MCU is used to take in input signal from button, ADC, etc. whereby the 2nd MCU is used to interface with a graphic controller to drive a color LCD.
 

yasser_shoukry

Full Member level 4
Joined
May 31, 2006
Messages
233
Helped
25
Reputation
54
Reaction score
5
Trophy points
1,298
Location
Cairo - Egypt
Activity points
2,749
In this case (On board communication) then SPI is the best as it works as Master/Slave communication.
 

ericmar

Full Member level 5
Joined
Apr 14, 2004
Messages
278
Helped
3
Reputation
6
Reaction score
4
Trophy points
1,298
Location
Singapore
Activity points
2,928
yasser_shoukry said:
In this case (On board communication) then SPI is the best as it works as Master/Slave communication.
U not using UART?
I never try the SPI. How does it differ from the UART?

Thanks,
Eric Mar
 

yasser_shoukry

Full Member level 4
Joined
May 31, 2006
Messages
233
Helped
25
Reputation
54
Reaction score
5
Trophy points
1,298
Location
Cairo - Egypt
Activity points
2,749
ericmar said:
yasser_shoukry said:
In this case (On board communication) then SPI is the best as it works as Master/Slave communication.
U not using UART?
I never try the SPI. How does it differ from the UART?

Thanks,
Eric Mar

SPI is synchronous communication while UART is Asynchronous. Being synchronous, SPI is much faster than UART.

SPI & I2C are both implemented for In-Board communication, both of them uses synchronous clock signal to synchronize the communicating devices, all communicating devices must be within the same board to reduce clock skew.

SPI is used basically to communicate between high speed devices and to extend MCU with additional peripherals.
 

    ericmar

    Points: 2
    Helpful Answer Positive Rating

tinku123

Junior Member level 3
Joined
Sep 16, 2006
Messages
30
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
1,436
hi

i don't no about Serial Periferal Interface ( SPI ),but the two Uc's can communicate with NULL modem connection.
 

Mindaugasu

Member level 3
Joined
Apr 17, 2005
Messages
66
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,288
Activity points
1,753
microlab said:
hai
it depends on a lot of parameters
if the distance between the mcu's are less than say 25 meters,you can use the rs 232 communication protocol
i feel this is the easiest way of communication because of less code comlexity in small distance.
if the distance is more you can use rs485

ml

It is important to mention that for these distances you will need to use Voltage level converters like max232.
or MAX3483 for RS485
Otherwise reliable distances I guess will be few meters.
--------------------------
https://www.scienceprog.com - Embedded electronics
 

Beowolf

Full Member level 2
Joined
Jun 19, 2006
Messages
130
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,071
Using SPI module is similiar to UART, bu it has only one buffer SSPBUF. Comm is initialized when you write something to it. Read dats sheet for details.
 

ashad

Full Member level 6
Joined
Mar 28, 2006
Messages
394
Helped
40
Reputation
80
Reaction score
27
Trophy points
1,308
Location
Trento, Italy
Activity points
3,296
it depends upon the condition .......

if u need high speed communication then SPI

if have asyn link the u can use serial comm

if there is noisy environment then CAN is the best choose but it can worl upto 1MHz
 

En_Serg

Newbie level 6
Joined
Dec 22, 2004
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
76
I have made communication between PIC18F258 and PIC16F877 over
SPI. One was master, second worked like SPI-Flash-mermory.
Common data located in the slave.

Let me know, if you need an examples code.

Best regards.
 

vibeeshpv

Member level 2
Joined
Oct 19, 2006
Messages
47
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
1,522
It depends on the application tat means how much data, distance,speed.like tat tell ur specification
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top