Skip to content

Instantly share code, notes, and snippets.

@MrTrick
Created November 8, 2012 11:30
Show Gist options
  • Save MrTrick/4038274 to your computer and use it in GitHub Desktop.
Save MrTrick/4038274 to your computer and use it in GitHub Desktop.

s = 16 : number of slots n = 256 : max number of nodes id : 8-bit id, unique to each node k : The number of cycles it takes to detect another transmission

Slots start at fixed, even intervals.

[#0               |#1               |   ...   |#F               ]

A node will want to transmit once each round,

  • If it's already transmitted, won't transmit until next round.

At the beginning of a slot, each node wanting to transmit;

  • Starts checking whether another node is busy.
  • Waits up to k*( (id+s)%16 ) cycles.
  • If it detects another node transmitting, abandons the slot.
  • If it's finished waiting, starts transmitting.

If a collision is detected;

  • Each node that was transmitting waits (id>>4) slots before trying to retransmit.

If more than X collisions are detected, nodes reduce their probability of trying to transmit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment