Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Data transfer between 2 microcontrollers

Status
Not open for further replies.

adwnis123

Full Member level 4
Joined
Jun 19, 2014
Messages
214
Helped
0
Reputation
0
Reaction score
1
Trophy points
18
Activity points
1,737
Hello, If I want to transfer data between 2 microcontrollers, that each one has different clock frequency, what method should I use?
 

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,913
whatever rustle your jimmies...

which is the distance between microcontrollers?

I assume You can program both microcontrollers (it doesn't matter that they have different crystals)

you have to choose the slower one as the limit for the communication... both for a synchronous or asynchronous approach...

for an asynchronous approach look if both micros have an USART module, (then you can program each one with a common baudrate for each clock frequency (so the program will be a little different) if the distance is long, look for TTL to RS232 or TTL to RS485/422 converters (like the max232 or the max485)

for a synchronous approach look for SPI or I2C, I suggest you to use the SPI it's easier... (but the distances should be close, like <0.5m
 

hobbyckts

Advanced Member level 1
Joined
Mar 12, 2015
Messages
481
Helped
88
Reputation
176
Reaction score
85
Trophy points
28
Activity points
2,457
You can follow any protocol for this communication. But the data transfer bits has to be supported by both.
For example: If one controller is 16 bit and another is 8 bit means you need to do the communication with 8 bits . When you try to do 16 bit communication you need to read it twice by dividing into two 8 bits.
 

adwnis123

Full Member level 4
Joined
Jun 19, 2014
Messages
214
Helped
0
Reputation
0
Reaction score
1
Trophy points
18
Activity points
1,737
whatever rustle your jimmies...

which is the distance between microcontrollers?

I assume You can program both microcontrollers (it doesn't matter that they have different crystals)

you have to choose the slower one as the limit for the communication... both for a synchronous or asynchronous approach...

for an asynchronous approach look if both micros have an USART module, (then you can program each one with a common baudrate for each clock frequency (so the program will be a little different) if the distance is long, look for TTL to RS232 or TTL to RS485/422 converters (like the max232 or the max485)

for a synchronous approach look for SPI or I2C, I suggest you to use the SPI it's easier... (but the distances should be close, like <0.5m

The distance is around 30 cm now that I use breadboard. But the target is to put on the same PCB.

The problem is that for some reason the one microcontroller runs at 8MHz (and cannot change) and the other microcontroller runs at 16MHz (and cannot change). The second (the one with the 16MHz)cannot change frequency because it communicates with another machine at 38400 bps and that cannot change. The other (the one with 8 MHz) can only runs on lower frequencies!
 

samikshya samal

Newbie level 4
Joined
Jan 28, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,338
first identify two micro controller clock rate ,then calculate one instruction set how many time take for execute & calculate difference two micro controller execution time then adjust the program .
 

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,913
The distance is around 30 cm now that I use breadboard. But the target is to put on the same PCB.

The problem is that for some reason the one microcontroller runs at 8MHz (and cannot change) and the other microcontroller runs at 16MHz (and cannot change). The second (the one with the 16MHz)cannot change frequency because it communicates with another machine at 38400 bps and that cannot change. The other (the one with 8 MHz) can only runs on lower frequencies!
so... which one could you program???
and what family are those microcontrollers???

if the 16Mhz one is communicating with another device how do you expect to communicate with your 8Mhz device??? taking turns? can't you just change the baud frequency for each communication packet if so? or are you looking some way to tamper that communication?

what exactly stops you to change the crystal from the 8Mhz device???

have you considered another port like SPI or I2C?

anyway... if the data speeds allow you you can get a hold of one of those Baud Rate converters (this one looks promising too) or maybe make one yourself with a 2 UART port micro and enough buffer to store data packets...
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top