0
\$\begingroup\$

I have set up my DALI master with 1 slave (prototyping phase) and managed to commission the slave (as far as I'm aware by testing against a direct arc level against the single short address). I am also able to get responses (query), somewhat haphazard at the moment due to the timing of the ISR probably being too strict and messing up sometimes on bits received, but at least working majority of the times.

So, assuming the above is the bare minimum to ensure that the bus, master and slave are working and able to send, receive and respond to commands. I have set up a function to set the scene level on the DTR and store this at the given scene level.

void setScene(uint8_t address, uint8_t scene, uint8_t level, _Bool isGroupAddress) {
    if (isGroupAddress) 
    { 
        address |= _DALI2_GROUP_ADDRESS; 
    }
    sendCommand(_DALI2_DTR, level, 0, 0);
    _waitTilLineFree();
    sendCommand(address, scene, _DALI2_STORE_THE_DTRAS_SCENE, _DALI2_FOLLOWING_COMMAND);
    _waitTilLineFree();
    sendCommand(address, scene, _DALI2_STORE_THE_DTRAS_SCENE, _DALI2_FOLLOWING_COMMAND);
    _waitTilLineFree();
}

The_waitTilLineFree function is a helper function to effectively wait for the line to become free from any other commands that are currently being sent, i.e. when dali state is idle and then give an extra 5ms delay when state is idled.

The below is printed from another helper function which prints the tx buffer and rx buffer.

SET SCENE:

  • address: [0]
  • level: [64]
  • scene: [1]

binary in form of 8 bit address then 8 bit command.

  • |1010 0011 0100 0000| SET DTR LEVEL [64] |
  • |0000 0001 0100 0001| STORE SCENE LEVEL to [1] |
  • |0000 0001 0100 0001| REPEAT ^^^^ |
  • |0000 0001 1011 0001| QUERY SCENE LEVEL [1] |

reply:

  • |1111 1111|

I am asking to check that the above is the correct way to set the scene level. The repeat command is sent according to the wait time function so is in that minimum 100ms time frame for a repeat to happen.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Your commands correct for storing and querying Short Address 0, and you are getting a response from Short Address 0 so it looks like you have got a control gear with that address attached. And you are setting and reading the same scene number, 1. But the reply to QUERY SCENE (1) LEVEL is MASK (0xFF) which is the default value instead of the value you are trying to set, 64 (0x40).

This is because you have not got enough delay between the repeats. You have 5ms but the spec requires at least 12.7ms between any frame and a forward frame. Also note that the 100ms maximum repeat timing was for DALI-1 and is now tightened up to 75.0ms maximum for a transmitter (Table 17 of IEC62386-101 Ed 2).

The maximum repeat time specification had to be adjusted because in the old version, the shared tx/rx requirement for 100ms +/- 10% could mean that a transmitter sending with 110ms spacing between repeated commands would not cause a receiver receiving with a 90ms window to store the setting.

\$\endgroup\$
1
  • \$\begingroup\$ Hi Martin, wow thanks that's even sorted out some of the other issues that I mentioned in my breif description about sometimes failed responses. \$\endgroup\$
    – Tanil
    Feb 15, 2021 at 13:31

Your Answer

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

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