DALI High Level Driver


 

1 Introduction

DALI, the Digital Addressable Lighting Interface, is the cornerstone of modern digital lighting control. It enables the effortless installation of robust, scalable, and flexible lighting networks. As an internationally standardised protocol, DALI is defined in the IEC 62386 standard and continually advanced through new specifications by the DALI Alliance (Digital Illumination Interface Alliance, DiiA).

Developing a new device that meets the requirements of the DALI standard and achieves DALI-2 certification can be a time-intensive and complex process. This is where the MBS DALI stack comes in. It simplifies the development process, significantly reduces time to market, and ensures compliance with the standard – paving the way for certification success.

Our DALI stack is purpose-built for embedded systems and fully implemented in ANSI-C, offering unmatched reliability and flexibility for developers.

Why choose the MBS DALI stack?

Save time and effort: Simplify your development process and shorten your

Ensure compliance: Meet all DALI standard requirements with ease, achieving certification faster.

Focus on innovation: With our stack taking care of the complexities, you can focus on creating value for your customers.

2 General

Architecture
This Chapter describes the general structure around the DALI stack and its relation to the necessary components.

µController
The microcontroller is the hardware basis for a DALI application and provides all the necessary resources for using the DALI stack. When selecting the microcontroller, the requirements for the DALI stack should be taken into account.

Persistent Memory
The DALI standard requires storing specified variables in non-volatile memory. Typically, an external EEPROM is used for this purpose, which is connected to the microcontroller via I²C, for example. Other implementations are also conceivable, such as emulating EEPROM in the microcontroller's flash memory or using other memory components. However, it should be noted that these data are stored quite frequently, and the chosen memory must be capable of handling this.

DALI-Interface Circuit
The DALI interface circuit describes the signal conditioning between the DALI bus and the GPIO pins of the microcontroller. It must be designed to meet the requirements of IEC 62386-101.

I/O
This block represents the GPIO pins of the microcontroller that are connected to the DALI interface circuit. A total of two GPIO pins are needed: one configured as an output and the second as an input. It is important when using the DALI low-level driver from MBS that the input pin also supports interrupts. These can be either interrupt on level change or interrupts for falling and rising edges.

Timer
The DALI low-level driver requires a timer with a resolution of 1µs (and a width of 24 bits) along with the corresponding timer elapsed interrupt. The timer serves as a time measurement unit for the DALI low-level driver, used to capture the bit timings of transmitted and received messages. The elapsed interrupt is typically configured to trigger every 10ms.

DALI_ll_hal / Microcontroller-specific HAL functions
Since the DALI low-level driver is platform-independent, it has proven useful to set up access to the microcontroller hardware through a so-called DALI low-level hardware abstraction layer (dali_ll_hal). This includes access to the output pin via the function pointer xxx, calling a specific function upon a level change of the input pin, accessing the timer counter value, and setting the timer. To do this effectively, microcontroller-specific HAL functions or libraries provided by the manufacturer are usually used.

DALI-LL
The DALI low-level driver processes the level changes at the input GPIO pin and checks the bit timings. The result is a DALI frame, which is passed to the DALI framework of the user application.

DALI-Framework
The DALI framework acts as an interface between the DALI library and the DALI low-level driver. The task of the DALI framework is to forward DALI messages/commands received from the DALI bus to the DALI library, and to pass DALI messages/commands from the DALI library to the low-level driver for transmission. Additionally, the framework provides the interface between the user application and the DALI library.

User Application
The user application encompasses all additional functionalities of the device, which extend the basic functionality of the DALI stack as well as DALI-independent functionalities.

DALI-LIB
The DALI-LIB refers to the implementation of individual parts of the DALI standard, simplifying compliance to its requirements through the use of the stack.

The following shows an overview of the implemented parts within the DALI-LIB:

General Overview of Interface

Information Flow
Figure shows the general information flow between the different modules.

The concept of the DALI stack allows customers to develop or utilize their own low-level driver according to their hardware requirements, provided they have the appropriate interface. For many microcontrollers, it has proven practical to use the platform-independent DALI low-level driver developed by MBS. However, the open concept has resulted in the existence of an intermediary layer between the low-level driver and the DALI-LIB, which facilitates the transmission of messages between these modules, which we call DALI-Framework and which has to be implemented by the customer.

Function types
The DALI stack provides different types of Interface-functions to establish communication with the user application and the DALI-Framework. There are two types: directly accessable functions and callback functions. Directly accessable functions serve to create an instance of the DALI-LIB, initialize it, operate it, and request information. In contrast, the callback functions serve to inform the user application about specific events or requests for further actions.

Directly accessable functions

Function nameDescription
dalilib_createinstanceCreates a new DALI-LIB instance and provides the corresponding reference, which is used for further actions.
dalilib_initThe DALI-LIB instance is configured by calling this function. The information about what type of device it is, such as a control gear, control device, or input device, as well as the associated parameters, are passed as function parameter.
dalilib_startStarts the DALI-LIB instance by changing the respective state-variables.
dalilib_stopStops the DALI-LIB instance by changing the respective state-variables and deletes all assosiate instance variables.
dalilib_infoGetReturns the Vendor ID.
dalilib_versionGetReturns the version number of the DALI stack.
dalilib_receiveThe call to this function is located in the DALI framework. If a DALI message or a status message is passed from the low-level driver to the DALI framework, it is forwarded to the DALI-LIB using this function.
dalilib_timingHelperThis function is necessary for processing the messages passed from the low-level driver, as well as for the overall functionality of the DALI-LIB. It must be called in a 10ms cycle (see Requirements).
dalilib_create_other_membankIn order to create a new memory bank, the DALI-LIB requires memory to be provided by the user application / DALI framework. This function serves as a direct interface for this purpose.
dalilib_actionThe DALI-LIB provides a variety of additional functions available through a mechanism called ACTION. The usage of ACTIONS is covered in the respective chapter.

Callback functions

Callback function nameDescription
fAppReadySignal to User Application that DALI stack instance is ready to operate.
fAppSendThis function is called when a message needs to be sent by the DALI-LIB. In the DALI framework, the callback is usually invoked and then the corresponding DALI low-level driver routine (dalill_pushSendQueue) is used to pass the message to the low-level driver.
fAppReActionThis callback is always invoked when the DALI-LIB needs information from the user application or a response to an event that cannot be handled by the DALI stack itself, such as controlling the PWM for the light output of an LED
fAppLoadMemThis callback is typically invoked at power-up of the device or when specifically requested to load the persistent variables from NVM.
fAppSaveMemThis callback is always invoked, when at least one persistent variable has been changed and the specified time has passed. User Appliction is responsible to save the data in a non volatile memory.
fAppLogIn case an error occurs during processing within the DALI-LIB, the corresponding error message and description are communicated to the user application through this callback.

The assignment of the callbacks is done in the instance configuration.

3 Requirements

Hardware Requirements

General

  • Signal conditioning circuit / DALI-Interface circuit

  • Non-volatile memory e.g. EEPROM of at least 526 bytes

Microcontroller

  • Minimal 32Mhz clock speed

  • 32Bit-CPU-Architecture (Recommended)

  • Two GPIO Pins:

    • 1x Input (DALI_RX)  - must be able to generate an interupt either on level change or detecting falling and rising edge

    • 1x Output (DALI_TX).

  • One timer with a resolution of 1µs (width of at least 24 bits) and the corresponding timer interrupt

  • The interrupts (DALI_RX) of the low-level driver must have the same and the highest priority in the system

  • Memory (RAM and FLASH) requirements see below. The specifications may deviate sligthtly.:

CapabilityCPU 32 BitCPU 16 Bit
FlashRAMFlashRAM
All features active including D4i extensions88 kB11 kB34 kB9 kB
All features active without D4i extensions (Delivery status)81 kB81 kB30,2 kB8 kB
Device turned off (No more application controller possible only gears)62 kB81 kB22 kB7,2 kB
Device turned off, no colour support (DT8)55 kB81 kB9 kB7 kB

Software Requirements

  • System stack size between 1 and 1,5 kByte

  • The DALI stack (dali-lib) needs a Low-Level-Driver to send and receive the DALI-frames.

  • MBS provides a free platform-independent Low-Level-Driver.

  • When using the MBS DALI Low-Level-Driver, the function dalill_processQueues must be called at least every 5ms by the user application and must not be blocked (e.g. through storage of persistent data).

  • The DALI stack provides the function dalilib_timingHelper, which should be called every 10ms to ensure the functionality

  • When the MBS DALI Low-Level-Driver is used, there is a functionality that supports this task.

4 Licensing and Delivery

Licensing

ModelDescription
Library Leasing p.a.The program library is provided for use for a limited time.
Library BuyoutThe program library is provided for permanent use.
Source BuyoutThe source code is provided for permanent use.

Delivery
DALI stack

ModelDescription
Static library
(1
The customer receives the header file “libdali.h” as well as the pre-compiled object files of the DALI stack in the library file “xxx_dali_lib.a”.
Source files
(2 (3
The customer receives the complete source code of the DALI stack.
1) Driver is delivered as header file “dali_ll.h” and library file “xxx__dali_lowlevel.a” 2) Driver is delivered as source code 3) source code can be altered by the customer

Example projects
Each delivery includes simple example projects that illustrate the application of the DALI stack and, for example, demonstrate the implementation of a DT6 LED control gear. There are pre-made examples. Please understand that the example projects cannot be tailored for every type of microcontroller.

5 Further Information for developers

Detailed Information about Stack Instance and API will be documented in MBS Confluence Developer Area. Access will be available here shortly.