Sync between multiple identical devices

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

I'm in the midst if designing a small LED controller, and through sheer design brilliance (hah, blind luck) have a spare pin left over. I would like to add a feature to have a single master control the timing of multiple slaves, and am thinking through various mechanisms to handle this.

The controller cycles through the displays on a 10ms TICK - that's what should be synced between devices. The master would use a timer to produce the 10ms interrupt, and that routine should notify the slaves via external interrupt to jump into the same processing routine.

Something alone the lines of

// 10ms interrupt and external interrupt both point here

if (mode == MASTER) {
  pulse SYNC_PIN
}

process_LEDs()

The master interrupts into the 10ms handler, pulses the sync pin to the slaves, then starts to process the LEDs. The slaves see the pulse and hop into the external interrupt handler (same basic code) and process the LEDs. Latency should be pretty small, hopefully.

This is purely the 1st pass at this, and I'm missing a lot of ancillary stuff I know. I also know this is a well-known wheel, designed many times in the past. So does anyone have any hints, either hardware or software ?

I could find another pin to make it a two-pin interface. Would mean losing a status LED on board though - which I would rather keep if I can.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

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

if you just need the devices in synch without any specific timing requirements then try this technique.
Each device sets the pin low, then goes off and does whatever operations are required. Once the operations are complete, and the device is ready to resync, set the pin to an input and wait for the pin to go high. Once the pin goes high, jump to the start of your loop and begin processing again.
All the devices have the pin connected together, with a pull-up resistor.
The devices will all sync to the slowest device. The advantage is all the devices will be identical, with no need for master/slave coding. Another benefit is that the devices will continue operating if the cable breaks, they just won't sync to anything on the other side of the break.