Hello

David our resident guru , has analysed the probability of getting one good discovery response when in fact 2 devices are replying at the same time (below)

The problem seems to appear a lot more often than I have won the lotto ! Maybe there should be some kind of implementation guide that could

recommend having a small backoff timer of some sort to reduce the probability of having this problem. (like ethernet PHYs)

Considering most lighting rigs are composed of at least multiple devices of a same manuafcturer that were probably purchased at the same time,

I't very possible for an end user to have sequential device IDs.

Nic

www.enttec.com
1. Discovery Collision Analysis

1.1 Uncorrupted msg

MID1 | 0xAA

MID1 | 0x55

MID0 | 0xAA

MID0 | 0x55

DID3 | 0xAA

DID3 | 0x55

DID2 | 0xAA

DID2 | 0x55

DID1 | 0xAA

DID1 | 0x55

DID0 | 0xAA

DID0 | 0x55

-------------

CSUM1 | 0xAA

CSUM1 | 0x55

CSUM0 | 0xAA

CSUM0 | 0x55

CSUM = (MID1|0xAA + MID0|0xAA + DID3|0xAA + DID2|0xAA + DID1|0xAA + DID0|0xAA) +

(MID1|0x55 + MID0|0x55 + DID3|0x55 + DID2|0x55 + DID1|0x55 + DID0|0x55)

= (MID1 + MID0 + DID3 + DID2 + DID1 + DID0) + 6*0xFF

= (MID1 + MID0 + DID3 + DID2 + DID1 + DID0) + 0x5FA

1.2 Single Bit Corruption

Suppose there are 2 responders A and B with UIDs which differ only in DIDx.

Collided msg would differ from original msgs A and B in the DIDx bytes and the checksum bytes, as follows.

CSUMB - CSUMA = (DIDBx|0xAA + DIDBx|0x55) - (DIDAx|0xAA + DIDAx|0x55)

COLLISION(DIDAx|0xAA, DIDBx|0xAA) = (DIDAx | 0xAA) & (DIDBx | 0xAA) = (DIDAx & DIDBx) | 0xAA

COLLISION(DIDAx|0x55, DIDBx|0x55) = (DIDAx | 0x55) & (DIDBx | 0x55) = (DIDAx & DIDBx) | 0x55

COLLISION(CSUMA1|0xAA, CSUMB1|0xAA) = (CSUMA1 | 0xAA) & (CSUMB1 | 0xAA) = (CSUMA1 & CSUMB1) | 0xAA

COLLISION(CSUMA1|0x55, CSUMB1|0x55) = (CSUMA1 | 0x55) & (CSUMB1 | 0x55) = (CSUMA1 & CSUMB1) | 0x55

COLLISION(CSUMA0|0xAA, CSUMB0|0xAA) = (CSUMA0 | 0xAA) & (CSUMB0 | 0xAA) = (CSUMA0 & CSUMB0) | 0xAA

COLLISION(CSUMA0|0x55, CSUMB0|0x55) = (CSUMA0 | 0x55) & (CSUMB0 | 0x55) = (CSUMA0 & CSUMB0) | 0x55

Taking checksum over collided msg gives

CSUM(over EUID part of collided msg) - CSUMA = [(DIDAx & DIDBx) | 0xAA] + [(DIDAx & DIDBx) | 0x55] -

- [DIDAx | 0xAA] - [DIDAx | 0x55]

= (DIDAx & DIDBx) - DIDAx

CSUM1(recovered from CSUM part of collided msg) = (CSUMA1 & CSUMB1)

CSUM0(recovered from CSUM part of collided msg) = (CSUMA0 & CSUMB0)

=>

CSUM(recovered from CSUM part of collided msg) = CSUMA & CSUMB

= CSUMA & [CSUMA + (DIDBx|0xAA) + (DIDBx|0x55)

- (DIDAx|0xAA) - (DIDAx|0x55)]

= CSUMA & [CSUMA + DIDBx - DIDAx]

For collided msg to have good checksum:

CSUMA + (DIDAx & DIDBx) - DIDAx = CSUMA & (CSUMA + DIDBx - DIDAx)

For the Special Case where DIDBx is obtained from DIDAx by changing a single bit from 0 to 1:

bit k of DIDAx = 0 and DIDBx = DIDAx + (1 << k), where 0 <= k <= 7.

DIDAx & DIDBx = DIDAx

CSUMA = CSUMA & (CSUMA + (1<<k)), which is true whenever bit k of CSUMA is 0.

CONCLUSION:

For the special case of a single bit difference in the device IDs, there is a 50% chance of the discovery collision

having a good checksum when ideally the discovery collision checksum should be bad.