I made the below code for setting CCT in DALI DT8 drivers as per the discussion on DALI 209 - Device Type 8 - CCT control and DALI DT6-DT8 Sending commands above 255 The DTR setting is working perfectly and I can read back the DTR value using query commands but the CCT is not setting at all.


    void Dali::setCCT(uint8_t id, long kelvin)


    if (id < 64 && kelvin <= 6500 && kelvin >= 2000)

        uint8_t val1 = (1000000 / kelvin) / 256;
        uint8_t val2 = (1000000 / kelvin) - (val1 * 256);
        dali.setDTR0(val1);  ///set val1 as DTR0
        dali.setDTR1(val2);   ///set val2 as DTR1
        dali.enabledt8();    ///enable DT8
        dali.transmit((id * 2) + 1, 231);  ///set temp color temperature

I checked all the available documents and even tried sending the command twice (since some of the commands should be sent twice) but no result.

what am I doing wrong here?


1 Answer 1


In the code given,

val1 is the MSB of the Mirek value, since it is is the value / 256.

val2 is the LSB of the Mirek value, since it is value - MSB * 256.

Table 15 in IEC62386-209 shows which DTRs are used for which commands.

enter image description here

So the commands, including command 231 which you are using, pick up their colour from DTR1 as MSB and DTR0 as LSB. But you are sending the MSB (your val1) as DTR0 and LSB (your val2) as DTR1.

So when you try to send a colour of say 200 Mirek (MSB=0, LSB=200) you are actually sending (MSB=200, LSB=0) which is 200*256+0 = 51200 which is out of range (50 to 1000 is the valid range) so the gear ignores it.

  • \$\begingroup\$ Okay got its . What about timing ? Is it okay? \$\endgroup\$ Jan 28, 2022 at 15:24
  • \$\begingroup\$ The minimum time between two consecutive forward frames is given in IEC62386-101 as 12.7ms, which is measured between the last edge of the previous frame and the first edge of this frame. So this is also a possible reason that your commands are not working, if the delay function is in milliseconds. \$\endgroup\$
    – Martin
    Jan 28, 2022 at 15:34
  • \$\begingroup\$ is there any changes in the hardware side? specifically for dt8? i have made the codes for all dt6 functions and got them working. but couldn't get dt8 commands to work @Martin \$\endgroup\$ Mar 22, 2022 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.