This document describes the implementation of the Digital Addressable Lighting Interface
(DALI) into the STM8S 8-bit microcontroller family.
The DALI slave library for STM8S microcontrollers simplifies integration of the DALI slave
interface into customer applications. The implementation of DALI into STM8S, together with
the various STM8S features (peripherals, computation power, communication interfaces), is
mainly used in light control applications (example, electronic ballast control).
The STM8S DALI slave library was tested according to the DALI specification.
The DALI slave library comes with a simple application example (DALI slave device). The
example was designed (and tested) for use with the following evaluation boards:
●STM8S-DISCOVERY (see UM0817, STM8S-DISCOVERY)
●
DALI transceiver board (see UM1032: STEVAL-ILMOO1V1 hardware module for the
STM8S-DISCOVERY interface for DALI communication).
The application example controls the light of the on-board LED diode. Light intensity is
controlled by the PWM method using a built-in timer. The external DALI master device must
control this application example (which is the DALI slave device).The DALI master devices
were tested using the ST7DALI evaluation kit (master device board and PC software) and
commercial DALI controller from Osram.
The user can use the provided example as a starting point for writing an application using
the STM8S DALI slave library.
Useful information and links about DALI interface can be found on http://www.dali-ag.org.
Figure 8.Flowchart of the user application which uses the DALI slave library . . . . . . . . . . . . . . . . . 24
Doc ID 18098 Rev 15/27
DALI informationAN3298
1 DALI information
1.1 DALI standard overview
DALIis an international standard (IEC 62386) lighting control system that provides a single
interface for electronic control gears (light sources) and devices (lighting controllers).
The DALI standard enables dimmable ballasts, transformers, relay modules, emergency
fittings and controllers from different manufacturers to be mixed and matched into a single
control system. A DALI system provides designers, installers, building owners, facility
managers and end-users a powerful and flexible digital lighting system with security of
supply from many sources.
The DALI standard is overseen by the “AG-DALI” activity group whichcomprises engineers,
manufacturers, and institutions working in the field of digital lamp/lightingcontrol.
More information about the DALI standard can be found in the following documents:
●IEC 62386
●NEMA STANDARD 243-2004
The following sections provide an overview of the DALI standard. They describe the basic
principles of the DALI interface.
Note:To better understand the STM8S DALI slave library, a knowledge of the DALI interface
specification is essential. This application note does not provide a description of this
specification.
1.1.1 DALI purpose and properties
The DALI protocol was designed to control modern light sources using a computer.
Functions include:
●Dimming
●On/off switching
●Grouping lights to a common control
●Scene storage and selection
The DALI design properties include:
●Simple wiring using standard electrical installation cables
●No special wiring topology (as with power electrical cables)
●Use of low cost microcontrollers on the light source side to minimize cost of light source
●Use of a simple protocol to control light dimming and switching.
6/27Doc ID 18098 Rev 1
AN3298DALI information
Figure 1.DALI wiring example
1.1.2 DALI physical layer
The DALI interface consists of a physical layer from two wires. This is a simple installation
for which the polarity is independent.
The protocol used on these cables is a standard serial protocol. There is 1 start bit, 8 data
bits, and 2 stop bits. The communication speed is fixed at 1200 Bd 10 %. Manchester
coding is used for better resynchronisation: rising edge is logical 1 and falling edge is logical
0. Bytes are grouped into frames. One frame usually consists of 1 or 2 bytes which is either
data only (answer from the device) or address + data (command to device).
Voltage levels present on DALI communication wires are higher thanthe transistor-transistor
logic (TTL) levels that are usually used. This isdue to better noise immunity because of
higher interference present on nearby power installation cables. Voltage levels are defined
as follows:
●Low level state
–-4.5 to 4.5 V (transmitter)
–-6.5 to 6.5 V (receiver)
●High level state
– 11.5 to 20.5 V (transmitter)
– 9.5 ... 22.5 V (receiver)
Low level state is dominant on the DALI bus. The device can force this level to the DALI bus
by shortening the DALI wires. Consequently, current levels are defined for devices used on
the DALI bus. There are two device types:
1.DALI master or DALI slave communication devices. In these devices the current is sunk
from the DALI bus. They consume a maximum of 2 mA to receive high level state and
sink a minimum of 250 mA to transmit low level state.
2. DALI power supply. These devices power the DALI bus and are the source current for it.
Supply is limited to a maximum of 250 mA
The maximum length of the DALI bus depends on the cables used for the DALI
communication wires. The length is linearly dependent on the cross section of the
conductor. For example, a 1.5 mm
2
cable (which is typically used in light installation cables)
allows a maximum bus length of up to 300 m.
Doc ID 18098 Rev 17/27
DALI informationAN3298
$UALPOWER
SUPPLY
#OMMUNICATIONS
INTERFACE
'ROUP'ROUP'ROUP
#ONTROLLER
#ONTROLLER
/THERCONTROLLER
AI
Collisions between several DALI masters on the DALI bus are solved on the basis of timing
priorities. When a collision is detected (the DALI master should check the sent data),
communication is muted for a period of time according to the assigned master priority. There
are five defined priority levels: 12 ms, 13 ms, 14 ms, 15 ms, and 16 ms. The longest waiting
time has less priority.
Figure 2.Example of DALI device connections
Figure 3.Voltage and currents on the DALI bus
AI
&ORWARDTRANSMISSION
(IGHLEVELVOLTAGE6TO6TYPICAL6
,OWLEVELVOLTAGE6TO6
.ONACTIVESTATE
()GHLEVELCURRENT
&ORWARDDATABITS
M!
3ETTINGTIME
3TOPBITS
"ACKWARDTRANSMISSION
,OWVOLTAGELEVEL
!CTIVESTATE
-AXIMUMCURRENT
3TART
BIT
M!
"ACKWARD
DATABITS
6
T
T
AI
8/27Doc ID 18098 Rev 1
AN3298DALI information
1.1.3 DALI stack layer
The DALI stack is the higher DALI layer which implements DALI commands, DALI
structures, timing management, and error management according to the DALI specification.
The most important feature of the DALI stack layer is the DALI commands. These
commands are used for:
●Direct light control such as dimming, on/off switching, and scene selection.
●Device configuration to set DALI variables, read device properties, address
assignments, and query device status.
The DALI stack layer is fully implemented in microcontroller software.
1.2 STM8S DALI slave library overview
The STM8S DALI slave library contains instructions for implementing software of the DALI
protocol into STM8S microcontrollers.
The DALI slave library consists of two layers:
●Upper layer (DALI stack layer)
●Hardware layer (I/O pin driver layer)
The upper layer of the DALI slave library (also known as the DALI stack layer), consists of
routines for processing the required DALI commands and other necessary control functions
(including timing control, error management, memory management, and light control).
The hardware layer (also known as the direct I/O pin driver layer), contains the physical layer
implementation. This is necessary because STM8S microcontrollers do not support DALI
communication peripherals.
The DALI slave library is written in C-language and is designed (and tested) for the Cosmic
compiler. In future, the IAR and Raisonance compilers will also be used. The DALI slave
library was developed using ST Visual Develop (STVD) IDE. In future, the IAR Embedded
Workbench IDE will be used. All of these tools (compilers and IDE) are free for download
from http://www.st.com/mcu or from compiler vendor websites.
Doc ID 18098 Rev 19/27
Loading...
+ 18 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.