Synchronize 2 arduino due over RF module.

hello,

I am measuring two analog measurements , I want to measure both same time, my measuring sample period is 100uS. arduino measure it and save in SD card.
Both works perfectly , but now I need to synchronize them.

I use timer interrupt in master and digitalpin interrupt in slave. first what I did was initially send message to start to slave, both starts same time, but when time goes they go out of sync , because due hardware changes.

next I used digital pin interrupt and it works perfectly. but some noises distrub me, even I filtered the noise.

so now I am looking for sync timer periodically. but my problem is how can I do it?
Can I set reset timer 3 if I get digital interrupt?

Have you looked inside libsam to see what potted functions are provided for manipulating timers?
I'd start there.

What accuracy are you looking for BTW, a fraction of a sample time? Have you measured the round-trip
latency and jitter for the RF modules?

yes. jitter is 56uS
round loop is still less than 100uS.

I do not use virtual wire lib. because I can't achieve that speed if i use it.
How can I synchronize internal timer with incoming pulse?

Why not use the same Arduino for both measurements?

If you really need two simultaneous analogue readings why not use two external ADCs that are triggered by a single Arduino?

...R

yes. I really need multiple arduinos to read analog input.

I am looking into a protocol that made by my self.
So I am going to use something like pulse with modulation, not almost PWM, but something similar.

so to indicate incoming data to slave, I am going to check incoming pulse width. I can use pulseIn() function to do it , but problem is , I noticed that when we use pulse in code do not run until pulse ends. so I have to wait until it measure the pulse width. That is lost of time,

Am I correct? or wrong? do pulseIn() runs parallel with main program like times? if No, then is it better to use micros() to measure pulse width ?

or are there any better suggestions?

waiting for your great ides

frechi91:
yes. I really need multiple arduinos to read analog input.

Please provide a general overview of what you are trying to achieve so that we understand why multiple Arduinos are needed.

I can't help thinking that the concept is becoming unnecessarily complex.

...R