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
Visit site
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?
 

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
 

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.
 



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!
 

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 .
 


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 **broken link removed** (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.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…