2

As I am trying to create a program that addresses the various luminaires, I wanted to know better theoretically not the commands to give, but why I am giving that specific command.
I've searched for a long time to find also examples about Dali2 addressing light commands.
Then I found an article that told me that I had to enter some kind of command twice, for Dali to understand them.

This is what I've read:

According to IEC 60929, a DALI Master has to repeat several commands within 100ms, so that DALI-Slaves will execute them.

My questions for you are these:

  1. What commands do I need to repeat in my program to be effective?
  2. Which order of commands should I respect?
  3. Would it be better if I used the state automaton process type or buffering?
  4. Why should I repeat the commands?

I am using the Stm32 microprocessor so my code must be the most light and efficient as possible.

Mr X
  • 27
  • 6
Les Go
  • 155
  • 10

1 Answers1

4

Configuration commands have to be repeated twice within 100ms without any other command in between before the control gear will accept them. This is done as a way to avoid corruption of the signal or spurious messages accidentally changing a configuration. DALI frames are Manchester encoded which prevents single bit flips of the frame causing problematic interpretation but does not have a CRC which is a common form of error detection in serial communication. So it is useful to have another method to ensure that the intended command has been received.

The list of which commands have to be repeated is given in any documentation you have on DALI, including the now superseded IEC 60929 where it states that commands 32-128 have to be repeated, and some of the Special commands like Initialise and Randomise. The new standard is IEC62386 and there is a table (Table 15 in IEC62386-102 Ed 2) which shows which commands are to be repeated; the column is called "Send twice".

The order of the commands depends on the logic of your application and the rules for DALI messages given in the standard. For example, to set a configuration parameter, it has to be first transferred using the DTR (or DTR1, DTR2) data transfer register, then stored - doing this in the opposite order makes no sense. For example, to set the maximum level, the command is 42, opcode byte 0x2A and uses DTR0, so the command set is

Command 257, SET DTR0 [with whatever value you want as a byte]
-any delay you like here-
Command 42, SET MAX LEVEL (DTR0) [addressed to the gear as necessary]
-less than 100ms delay-
Command 42, SET MAX LEVEL (DTR0) [addressed to the gear as necessary]

Command 257 SET DTR0 is not addressed, so it will be applied to every gear that is connected to the bus and powered up. If you want this SET MAX LEVEL to be applied to just one Short Addressed gear, or a Group address, or broadcast, then that affects the address byte that you need to set in the Command 42 SET MAX LEVEL. Only those gear which match that address will then use the DTR to set their own MAX LEVEL parameter.

The repeating of configuration commands does nothing to ensure that the DTR value is correct in the gear. If you have gear which has been short-addressed, or only one gear on the bus, then you can read back the DTR before or after doing the SET command to ensure it was at the right value. (You cannot in general read back values with broadcast or group queries because of collisions between multiple control gear. Unless you are using device type specific queries and only have a single example of that on the bus).

Martin
  • 8,320
  • 1
  • 22
  • 30
  • **Thank you 3000** now i'm trying to write some code, if it doesn't work I'll probably put it under my questions. I welcome other extensions of the answer such as *"what logic to follow while writing the program?"* – Les Go Oct 15 '20 at 14:28
  • @Lale I see that you are new - the way things are done here is one question per page, so please don't mix different questions together. This Q&A page is all on the topic of the principle of repeated commands so that is ok, but questions on your code or some other aspect should be a seperate question. Also look at the Related Questions pane on the right or the DALI tag for more information on addressing. – Martin Oct 15 '20 at 14:36