How to sinc two microcontrollers

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there a way to sinc two mcu colcks with internal oscillator or the external crystal (not crystal oscillator!).

 

 

 

PS: I'm not lucky with crystal oscillators. there is never one when you need it.

This topic has a solution.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's "sync" - short for "synchronise" - I presume?

 

But what, exactly, do you mean by "sync two mcu colcks" ?

 

Normally, syncing the clocks is not the thing to do - it is more common to sync eventshttps://www.avrfreaks.net/forum/s...

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I mean sync the clock. When I try to communicate between two mcus I get 14% output frequency drop, because their clocks are slightly shifted, so I need to make them run from same clock pulse, but I can't figure out how to do that with internal oscillator, or external cristal.       I have my event sync handled already with master-slave priority.laugh

 

 

Last Edited: Mon. Dec 15, 2014 - 09:41 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll answer your question with a question and maybe one of the pros on here can prove or disprove.

 

If you set the CKOUT fuse on one of the processors and use it as clock for the other would this work.  Just curious!

Happy Trails,

Mike

JaxCoder.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

YOu can use a crystal on one MCU and drive the other from the X2 pin(IIRC) to the X1 pin.  Or a better choice would be to use a TCXO - it looks like a little metal can with DIP legs and feed it's output to both X1 pins of the MCU's.  Make sure you set the fuse bits properly in all cases
 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Oh. I'm dumb. I'm literary dumb. I forgot there was a clout pin on the bloody thing. Thanks a lot for helping me laugh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I might try this as well. Thank youlaugh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there a way to sinc two mcu colcks with internal oscillator or the external crystal (not crystal oscillator!).

While the above answers are all correct, it still begs the question: Why synch the two uC's?

 

If you run the two micros, each with their own external crystal, they will communicate just fine without "synching" them to each other.

The two crystals must be the same frequency.

The two micros must have their "fuses" set to run them on the external crystals.

 

Technically, one could have uC #2 measure the frequency of uC #! and and adjust its clock to match, but that isn't trivial.

Using two crystals, one per uC, is both trivial, and inexpensive.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Why? Well I'm working on 8bit logic analyzer, and by using two MCUs so I can control data faster. One does the dirty job with addressing ram while other takes responsibility for retrieving and sending data. All together makes an logic analyzer with both compression and normal memory, with 8Mps and 16M memory.  And if you still asking why, well I do it because I can. Because this is still the easiest way to learn about all problems associated with it (addressing memory, retrieving data, latching on certain byte of data, etc.)    BTW both mcus are attiny2313 and the record circuit works with its own 40mhz circuitlaugh

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had thought about making a LA a while back and the problems wasn't so much capturing data but how to display it.  It turned out better in the long run, for me at least to buy the Saleae LA then to spend

the time and energy to create one.  BTW I've been a programmer for many years.
 

Happy Trails,

Mike

JaxCoder.com