How to give the master a random and a short address to my slave device?(DALI Protocol

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi, I'm trying to figure it out with the DALI protocol.
I have a boot kit XMC1200 working as a slave device.
The question is how to give the master a random and a short address to my slave device? Simply put, initialize the slave device.

7 Replies
Not applicable
I do not understand your question. In DALI, the control device sends a command to all the control gear on the bus to choose a random 3 byte number. Upon reception of the RANDOMIZE command, all control gear generate a three byte random number. Using a successive approximation algorithm, the control device then 'guesses' the random number of the control gear with the lowest random value. The control device assigns a short address to the control gear with the lowest random number and tells it to ignore future guesses allowing the control device to identify the control gear with the next lowest random number and so on.

Do you have either the DALI spec or the DALI 2.0 spec?
Not applicable
I use DALI 2.0 spec. I go to the steps proceeding from the
All that was in the guide I did, Dave 3 generated the code, and in Keil 5 finished the functions and built the project.
After building the project, I tried to find the device as a master, but I did not find the device 2825.attach.
There was a question: the guide is not enough that the master would find the device?
master is:2826.attach
Not applicable
Please lay out a piece of code to initialize the slave device?
Without dimming and other, just that piece of code that allows the master to determine the slave device.
With all the others figured out. But with the initialization does not work.
There is a short address there is no random address, and vice versa.
Not applicable
Does anyone have lessons on the DALI protocol? (XMC1200...XC800)
Not applicable
I absolutely do not understand what is happening in this DALI library.
on the screen went to the breakpoint.
following the steps:

I enter the function:
uint32_t DALICG02_uiCheckAddr (const DALICG02_ConfigHandleType \
* DALICG02_HandlePtr)

and find out that our request:
DALICG02_Special_cmd (DALICG02_HandlePtr);

which is logical!
execute the function before our request:

go to the condition:
if (DALICG02_Special_uiDevice_selection (DALICG02_HandlePtr)) <--- true?

if ((DALI102_HandlePtr-> uiPhysical_sel_mode == DALICG02_PHYSICAL_ENABLED) || \
****************(DALI102_HandlePtr-> stOther_flags.bCompare_en && \
************************DALICG02_Special_uiCompare_addr (DALICG02_HandlePtr)))

again we check the function inside the condition:
DALICG02_Special_uiCompare_addr (DALICG02_HandlePtr)

inside this function there is a condition:
if ((DALI102_HandlePtr-> stDALICG02_search_addr.uiSearch_addr_H == \
********DALI102_HandlePtr-> aucDALICG02_var [DALICG02_RANDOM_ADDR_H]) && \
******(DALI102_HandlePtr-> stDALICG02_search_addr.uiSearch_addr_M == \
********DALI102_HandlePtr-> aucDALICG02_var [DALICG02_RANDOM_ADDR_M]) && \
******(DALI102_HandlePtr-> stDALICG02_search_addr.uiSearch_addr_L == \
********DALI102_HandlePtr-> aucDALICG02_var [DALICG02_RANDOM_ADDR_L]))
****status = 1U;
****status = 0U;
**return status;

Since the RANDOMISE command already existed, then status = 0U.
This status we drag through all previous functions and take off from the function without getting the address:
******if (DALICG02_Special_uiDevice_selection (DALICG02_HandlePtr))
********if (DALI102_HandlePtr-> stStatus_info.bMissing_short_addr)
**********DALI102_HandlePtr-> uiSlave_TX_data = DALICG02_BYT_MASK;
**********DALI102_HandlePtr-> uiSlave_TX_data = \
**********((DALI102_HandlePtr-> aucDALICG02_var [DALICG02_SHORT_ADDR] << 1) | (0x01U));
********DALI102_HandlePtr-> stDALICG02_flags.bResponse_req = value.bitOne;

the question is: can this be the problem?
Answer at least something, but it's more a monologue than a forum 😃
Level 3
Level 3
25 replies posted 10 replies posted 5 replies posted
Hint: You should upload each screenshot directly to your post. Infineon employees cannot follow your links, because of firewall restriction and my guess is that other forum users won't like to follow the links as well.
Not applicable
Yes, I understand, but all the screenshots that help to understand the essence of the problem and my reasoning are not loaded onto the post. In addition, there is a message that this post should check the moderator. We are all people,
I understand that the moderator can not instantly view my post and make a decision, but since the information on DALI is VERY IMPORTANT, i have to move in other ways. I apologize for the links in the post.

At the moment I'm interested in working example of working with the DALI protocol.

Examples I could find on the XMC1200 for working with DALI, I did. But the master (NXP LPC134x) never found the lamp (XMC1200 Boot kit with White LED Card). The reason the master did not recognize the lamp (slave device), I do not understand!
Judging by the code:

void OneMsInter (void)
uint32_t bccu_fade_status;

/ * stop timer * /
status = SYSTM002_StopTimer (OneMsTmrId);

/ * Call Dali maineThread to maintain dali communication * /
DALICG02_MainThread (& DALICG02_Handle0);

/ * Restart timer * /
status = SYSTM002_StartTimer (OneMsTmrId);

/ * check if BCCU has completed dimming-only for HW-based dimming * /
bccu_fade_status = BCCUDIM01_FadeCompletionStatus (& BCCUDIM01_Handle0);

if (! bccu_fade_status)
if (DALICG02_Handle0.DALI102_Handle-> stStatus_info.bFade_running)
/ * reset DALI fade status flag * /
DALICG02_Handle0.DALI102_Handle-> stStatus_info.bFade_running = DALICG02_BIT_ZERO;
/ * update DALI actual level * /
DALICG02_Handle0.DALI102_Handle-> uiActual_arc_lvl = DALICG02_Handle0.DALI102_Handle-> uiReq_arc_pwr;

if (DALICG02_Handle0.DALI102_Handle-> uiActual_arc_lvl == 0U)
/ * reset Dali light on status flag if DALI actual level is 0 (off) * /
DALICG02_Handle0.DALI102_Handle-> stStatus_info.bLight_on = DALICG02_BIT_ZERO;

/ * create time base for 1ms interrupt to service Dali * /
OneMsTmrId = SYSTM002_CreateTimer (1000U, SYSTM002_PERIODIC, (void *) OneMsInter, NULL);
status = SYSTM002_StartTimer (OneMsTmrId);

the luminaire must enter every 1 ms into the interrupt and within the interrupt enter the function:

DALICG02_MainThread (& DALICG02_Handle0);

Where is written each of the possible commands.
Then my master must pass INITIALISE (0b1010010100000000) twice with an interval of no more than 100ms;
RANDOMISE (0b1010011100000000) with an interval of not more than 100ms;
request for received addresses: (0b10110001HHHHHHHH, 0b10110011MMMMMMMM, 0b10110101LLLLLLLL);
COMPARE (0b1010100100000000);
after determining the address of the luminaire, the controller sets the lighter a short address (0b10110111AAAAAAAA) and sends the WITHRAW command (0b1010101100000000), which excludes the luminaire from the search process;
After the initialization process is complete, the controller sends a TERMINATE command (0b1010000100000000), and the fixtures exit the initialization mode.

but in the end I get this:

I ask you to lay out an example of working with DALI. The most important thing that interests me is the initialization of the lamp.

I'm satisfied with the example written on the basis of DAVE 3. libraries, in DAVE 4 I did not find the finished DALI library.