View Single Post
Old January 12th, 2022   #1
lensfocus
Junior Member
 
Join Date: Jan 2022
Posts: 4
Default Discovery response not recognized

I am developing a new lighting device, and need to implement the RDM protocol. I am new to DMX and RDM, but I have the DMX working fine. I am having a problem getting the controller that I am using to recognize my response to the discovery message.



I'm using an ENTTEC USB PRO MK2 for testing, and am trying to get it to recognize my board in the RDM discovery process. It is not seeing my responses to the DISC_UNIQUE_BRANCH message, and I'm not sure why. I can see my response on the RS485 bus using a scope. I know it is seeing my response, because it is continuing to send discovery messages with a narrowing range of IDs, so it thinks there is a collision on the bus. I'm thinking that my checksum is not correct?


I saw two examples of source code on the web for this, and they both use the same algorithm to encode the response. However, in looking at the protocol document (ANSI E1.20), there is a disconnect somewhere.


Here is the suggested code from the web to send a response:

_rdmCheckSum = 6 * 0xFF;
for (byte i = 0; i < 7; i++)
disc->headerFE[i] = 0xFE;
disc->headerAA = 0xAA;
for (byte i = 0; i < 6; i++) {
disc->maskedDevID[i+i] = _devID[i] | 0xAA;
disc->maskedDevID[i+i+1] = _devID[i] | 0x55;
_rdmCheckSum += _devID[i];
}
disc->checksum[0] = (_rdmCheckSum >> 8) | 0xAA;
disc->checksum[1] = (_rdmCheckSum >> 8) | 0x55;
disc->checksum[2] = (_rdmCheckSum & 0xFF) | 0xAA;
disc->checksum[3] = (_rdmCheckSum & 0xFF) | 0x55;

I have two issues with this.
1. Why do they initialize the checksum to 6 * 0xFF instead of zero?
2. The checksum should be adding the actual bytes sent after they are ORed, not the original bytes.


So, I tried changing it to this, to comply with the protocol:

_rdmCheckSum = 0;
for (byte i = 0; i < 7; i++)
disc->headerFE[i] = 0xFE;
disc->headerAA = 0xAA;
for (byte i = 0; i < 6; i++) {
u32 idx = i+i;
disc->maskedDevID[idx] = _devID[i] | 0xAA;
_rdmCheckSum += disc->maskedDevID[idx];
idx++;
disc->maskedDevID[idx] = _devID[i] | 0x55;
_rdmCheckSum += disc->maskedDevID[idx];
}
disc->checksum[0] = (_rdmCheckSum >> 8) | 0xAA;
disc->checksum[1] = (_rdmCheckSum >> 8) | 0x55;
disc->checksum[2] = (_rdmCheckSum & 0xFF) | 0xAA;
disc->checksum[3] = (_rdmCheckSum & 0xFF) | 0x55;

but I still don't get a MUTE message saying that the controller sees my response.

Thanks for any help you can provide!
lensfocus is offline   Reply With Quote