I need to synchronize the clocks of three Arduino clones down to microseconds.

BobTPH

Joined Jun 5, 2013
8,958
All you need is fit the skaves to signak the naster as soon as the detect t
Your thought was my initial reasoning, but I came under the impression that using I2C, the slaves could only send data upon request by the master. So I decided, based upon that, to have the slaves do some calculations while they were waiting for the master's request. I was trying to be efficient. What Protocol would be the lowest latency for this?
Why do you even need the slaves? You could have the two microphones connected to a single micro.

Bob
 

Thread Starter

FractalFibs

Joined Jan 11, 2022
17
All you need is fit the skaves to signak the naster as soon as the detect t

Why do you even need the slaves? You could have the two microphones connected to a single micro.

Bob
Because the MCU's can only process one instruction at a time. I ran into time bottlenecks 'for lack of a better term." By the time digitalRead() processes for 3 or more sensors, the time of detection for each sensor is farther from the real time event. Unless there is a technique i should follow to defeat or mitigate these skewed detections, I don't see how it will work. I have limited knowledge on MCU's so if I'm missing something please fill me in.
 

Ya’akov

Joined Jan 27, 2019
9,150
Your thought was my initial reasoning, but I came under the impression that using I2C, the slaves could only send data upon request by the master. So I decided, based upon that, to have the slaves do some calculations while they were waiting for the master's request. I was trying to be efficient. What Protocol would be the lowest latency for this?
How do you plan to interconnect these devices, physically?
 

BobTPH

Joined Jun 5, 2013
8,958
If you insist on 3 micros, all you need is a wire from each slave to interrupt the master when the sound is detected. No synchronization necessary.

Bob
 

Thread Starter

FractalFibs

Joined Jan 11, 2022
17
If you insist on 3 micros, all you need is a wire from each slave to interrupt the master when the sound is detected. No synchronization necessary.

Bob
So, when slaves detect sound, send high to master. Master notes time of pin reads and calculates the solution. Am i following you? Maybe I am splitting hairs but that would add one additional loop to detect the second sensors high. This would add maybe 20 microseconds. But would it really matter. Maybe some error correction for the elapsed time of the processes? Hmm.
 

Ya’akov

Joined Jan 27, 2019
9,150
So, when slaves detect sound, send high to master. Master notes time of pin reads and calculates the solution. Am i following you? Maybe I am splitting hairs but that would add one additional loop to detect the second sensors high. This would add maybe 20 microseconds. But would it really matter. Maybe some error correction for the elapsed time of the processes? Hmm.
If you have time critical needs, as you do, you would use interrupts, not polling. You could also potentially use FreeRTOS rather than trying to manage the timing and synchronization yourself.
 

Thread Starter

FractalFibs

Joined Jan 11, 2022
17
If you have time critical needs, as you do, you would use interrupts, not polling. You could also potentially use FreeRTOS rather than trying to manage the timing and synchronization yourself.
Ah yes, RTOS. Just, as of now, it is not compatible with my particular MCU's. Already tried.
 

Thread Starter

FractalFibs

Joined Jan 11, 2022
17
I would like to thank everyone for their gracious input up to this point. This is a great forum. The wife is calling I'll check this thread again later. Cheers!
 

Danko

Joined Nov 22, 2017
1,835

Attachments

Top