UART With DALI Protocol Technical Brief: 2018 Microchip Technology Inc. DS90003200A-page 1
UART With DALI Protocol Technical Brief: 2018 Microchip Technology Inc. DS90003200A-page 1
Introduction
The Digital Addressable Lighting Interface (DALI) is an international standard that governs intelligent
lighting control. DALI was developed to replace analog lighting control with a flexible digital control
system. Microchip's Universal Asynchronous Receiver Transmitter (UART) module has added protocol
support features that simplify DALI usage. This technical brief will give a short summary of the DALI
protocol and explain how to use the UART module for DALI control.
Table of Contents
Introduction......................................................................................................................1
1. DALI Overview...........................................................................................................3
1.1. DALI Terminology......................................................................................................................... 3
1.2. Electrical Specifications................................................................................................................4
1.3. Bus Topology................................................................................................................................5
1.4. Bus Communication..................................................................................................................... 5
3. Conclusion............................................................................................................... 11
4. DALI Commands..................................................................................................... 12
Customer Support......................................................................................................... 17
Legal Notice...................................................................................................................18
Trademarks................................................................................................................... 18
1. DALI Overview
Lighting systems were originally designed for one purpose: to provide light for visual tasks. A simple light
switch either turned on or turned off the system, while a dimmer switch changed the intensity of a lighting
fixture's output. If a fixture burned out, it could be replaced, but there was no assurance that the new light
would behave the same as other fixtures within the system. If the new fixture was brighter or dimmer than
the other fixtures, the overall lighting would not be uniform across the area being illuminated. Other than
physically noticing that a fixture needed to be replaced, there was not a way to detect if a fixture was
operational.
Today, the demand for power efficiency and customization has led to the design of intelligent lighting
control systems. The DALI protocol was designed to meet these demands.
DALI lighting systems have several advantages over traditional analog lighting systems, including:
• Simple wiring of control lines
• Control of individual units or groups of units through addressing
• Simultaneous control of all units through broadcast addressing
• Simple communication structure
• Ability to check the status of an individual or group of fixtures for faults, power levels, etc.
• Creation of custom lighting scenes
• Logarithmic dimming that matches the eye's sensitivity
• More functionality and lower-system cost compared to 1-10V systems
• Building Management System (BMS): A computer-based control system installed in buildings that
controls and monitors the mechanical and electrical equipment of a building.
22.5V
16V
Logic 'High' (Idle)
9.5V
Undefined
6.5V
0V
Logic 'Low'
-6.5V
TB3200
DALI Overview
A Control Device's logic 'high' level falls in the range of 10V and 22.5V. A logic 'low' level falls between 0V
and 4.5V. The threshold (undefined) voltage region falls between 4.5V and 10V (see figure below).
Figure 1-2. Control Device Voltages
22.5V
16V
Logic 'High' (Idle)
10V
Undefined
4.5V
Logic 'Low'
0V
-6.5V
The bus may have a single power supply, multiple power supplies, or a power supply that has been
integrated into one of the ballasts. The output voltage of the bus power supply must be between 12V and
20.5V.
Rev. Manchester
3/29/2018
Frames are transmitted at a baud rate of 1200 bps, and each frame is always sent with the Most
Significant bit (MSb) first. Since the baud rate is 1200 bps, each bit period lasts for 833.33 µs, and each
half-bit last for 416.67 µs. Half-bit period times are important since Manchester encoding requires two-bit
transitions for each logical data bit.
A forward frame is the data packet transmitted by the control device to the control gear or input device.
A DALI 1.0 forward frame contains the Start bit, followed by the address byte, one data byte, and two
Stop bits.
Filename: Forward Frame.vsdx
Title:
A Last
DALI 2.0 forward
Edit: frame contains the Start bit, followed by the address byte, up to two data bytes, and a
4/13/2018
First Used:
Stop condition
Notes:
(see Figure 1-4). The DALI 2.0 24-bit forward frame, including the Start and Stop bits, lasts
for 23.2 ms, or approximately 56 half-bit times, while the 16-bit forward frame lasts for 16.2 ms, or 39 half-
bit periods. Once the control device completes the transmission of the frame, the control gear must begin
to transmit the backward frame no sooner than 5.5 ms (approximately 14 half-bit times) and no later than
10.5 ms (approximately 25 half-bit periods). Once the backward frame has been received in its entirety,
the control device must wait a minimum of 2.4 ms (approximately six half-bit periods) before transmitting
the next forward frame (see Figure 1-5).
Figure 1-4. DALI Forward Frame
Rev. Forward Frame
4/13/2018
Bit
time
Start
bit
Y A A A A A A S D D D D D D D D D D D D D D D D I I I I I I
A: Address bits
S: Selector bit
S = 0: Data bytes indicate Direct Arc Power level
S = 1: Data bytes indicate a command
(≈ 14 ≤ x ≤ 25 Half-bit (≈ 6 Half-bit
periods) periods)
Backward
Forward Frame Forward Frame
Frame
23.2 ms 23.2 ms
(≈ 56 Half-bit periods) 9.95 ms (≈ 56 Half-bit periods )
(≈ 24 Half-bit
periods)
time
4/13/2018
Start
bit
D D D D D D D D I I I I I I
hardware holds the Tx output in the Idle state for the number of Stop bits selected by the STP<1:0> bits
of U1CON2.
After the last Stop bit has been transmitted, the Tx output is held in the Idle state for the number of half-bit
times found in the U1P1H:U1P1L register pair. Any writes to the U1TXB register that occur after TXMTIF
has set but before the U1P1 wait time expires are held in U1TXB. Once the wait time expires, the data is
immediately transmitted. If a backward frame is received during the wait time, any data written into
U1TXB will be held until the complete reception of the backward frame plus the additional U1P1 wait
time.
Once the two Stop bits of a backward frame have been received, the U1P1 wait timer resets and restarts
its timing function. Any data pending in the TSR will be transmitted once the wait time elapses.
Forward frame data stored in the TSR and U1TXB can be replaced or deleted by setting the Transmit
Buffer Empty Status (TXBE) bit of the UART FIFO Status register (U1FIFO). Setting TXBE flushes any
data left in both the TSR and the U1TXB registers. It is important to note that the TXBE bit can only be
cleared by hardware, and is clear whenever there is data in either the TSR or U1TXB.
It is important to note that backward frames are automatically received, and may or may not arrive within
the allowed time window. If the backward frame arrives outside of the time window and collides with a
forward frame, the Transmit Collision Interrupt Flag (TXCIF) bit of the U1ERRIR register is set. If the
backward frame arrives outside of the time window and no collision occurs, the module continues normal
operation. TXCIF will also be set when a received bit is missing the half-bit transition.
3. Conclusion
The Digital Addressable Lighting Interface (DALI) protocol is a commercial and industrial standard related
to digitally controlled lighting. Microchip's UART module has added protocol support features that simplify
DALI. Module hardware automatically adds Start and Stop bits to the data stream, and does the
necessary Manchester encoding/decoding required by the DALI protocol. For more information, please
visit www.microchip.com.
REFERENCES:
• International Standard CEI IEC 60929, Third Edition 2006 – 01
• International Standard IEC 62386-101, Edition 2.0 2014 – 11
• International Standard IEC 62386-102, Edition 2.0 2014 – 11
• International Standard IEC 62386-103, Edition 1.0 2014 – 11
4. DALI Commands
The DALI protocol defines several standard commands which allow system designers to use devices
from different manufacturers without having to modify software. The Microchip DALI 2.0 library contains
the following commands:
RESET MEMORY BANK 0x24 Resets the memory bank identified by DTR0
DTR0(1) (memory bank must be implemented and
unlocked)
IDENTIFY DEVICE(1) 0x25 Instructs a control gear to run an
identification procedure
SET MAX LEVEL DTR0 0x2A Configures the control gear's maximum
output level to the value stored in DTR0
SET MIN LEVEL DTR0 0x2B Configures the control gear's minimum
output level to the value stored in DTR0
SET SYSTEM FAILURE LEVEL 0x2C Sets the control gear's output level in the
DTR0 event of a system failure to the value stored
in DTR0
SET POWER ON LEVEL DTR0 0x2D Configures the output level upon power-up
based on the value of DTR0
SET FADE TIME DTR0 0x2E Sets the fade time based on the value of
DTR0
SET FADE RATE DTR0 0x2F Sets the fade rate based on the value of
DTR0
SET EXTENDED FADE TIME 0x30 Sets the extended fade rate based on the
DTR0(1) value of DTR0; used when fade time = 0
QUERY RESET STATE 0x95 Determines if all NVM variables are in their
Reset state
QUERY MISSING SHORT 0x96 Determines if a control gear's address is
ADDRESS equal to 0xFF
QUERY VERSION NUMBER 0x97 Returns the device's version number located
in memory bank 0, location 0x16
QUERY CONTENT DTR0 0x98 Returns the value of DTR0
QUERY DEVICE TYPE 0x99 Determines the device type supported by the
control gear
QUERY PHYSICAL MINIMUM 0x9A Returns the minimum light output that the
control gear can operate at
QUERY POWER FAILURE 0x9B Determines if an external power cycle
occurred
QUERY CONTENT DTR1 0x9C Returns the value of DTR1
QUERY CONTENT DTR2 0x9D Returns the value of DTR2
QUERY OPERATING MODE(1) 0x9E Determines the control gear's operating
mode
QUERY LIGHT SOURCE 0x9F Returns the control gear's type of light source
TYPE(1)
QUERY ACTUAL LEVEL 0xA0 Returns the control gear's actual power
output level
QUERY MAX LEVEL 0xA1 Returns the control gear's maximum output
setting
QUERY MIN LEVEL 0xA2 Returns the control gear's minimum output
setting
QUERY POWER ON LEVEL 0xA3 Returns the value of the intensity level upon
power-up
QUERY SYSTEM FAILURE 0xA4 Returns the value of the intensity level due to
LEVEL a system failure
QUERY FADE TIME FADE RATE 0xA5 Returns a byte in which the upper nibble is
equal to the fade time value and the lower
nibble is the fade rate value
QUERY MANUFACTURER 0xA6 Returns a 'YES' when the operating mode is
SPECIFIC MODE(1) within the range of 0x80 - 0xFF
QUERY NEXT DEVICE TYPE(1) 0xA7 Determines if the control gear has more than
one feature, and if so, return the first/next
device type or feature
QUERY EXTENDED FADE 0xA8 Returns a byte in which bits 6-4 is the value
TIME(1) of the extended fade time multiplier and the
lower nibble is the extended fade time base
QUERY CONTROL GEAR 0xAA Determines if a control gear has failed
FAILURE(1)
QUERY SCENE LEVEL 0xB0 Returns the level value of scene 'x'
QUERY GROUPS 0-7 0xC0 Returns a byte in which each bit represents a
member of a group. A '1' represents a
member of the group
QUERY GROUPS 8-15 0xC1 Returns a byte in which each bit represents a
member of a group. A '1' represents a
member of the group
QUERY RANDOM ADDRESS H 0xC2 Returns the upper byte of a randomly
generated address
QUERY RANDOM ADDRESS M 0xC3 Returns the high byte of a randomly
generated address
QUERY RANDOM ADDRESS L 0xC4 Returns the low byte of a randomly
generated address
READ MEMORY LOCATION 0xC5 Returns the content of the memory location
stored in DTR0 that is located within the
memory bank listed in DTR1
QUERY EXTENDED VERSION 0xFF Returns the version number belonging to the
NUMBER device type or feature
SPECIAL COMMANDS
TERMINATE 0xA1 Stops the control gear's initilization
DTR0 DATA 0xA3 Loads a data byte into DTR0
INITIALISE 0xA5 Initializes a control gear, command must be
issued twice
RANDOMIZE 0xA7 Generates a random address value,
command must be issued twice
COMPARE 0xA9 Compares the random address variable to
the search address variable
WITHDRAW 0xAB Changes the initialization state to reflect that
a control gear had been identified but
remains in the initialization state
PING(1) 0xAD Used by control devices to indicate theirm
presence on the bus
SEARCH ADDRH 0xB1 Determines if an address is present on the
bus
Customer Support
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or Field Application Engineer (FAE) for support.
Local sales offices are also available to help customers. A listing of sales offices and locations is included
in the back of this document.
Technical support is available through the web site at: http://www.microchip.com/support
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their
code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the
code protection features of our products. Attempts to break Microchip’s code protection feature may be a
violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software
or other copyrighted work, you may have a right to sue for relief under that Act.
Legal Notice
Information contained in this publication regarding device applications and the like is provided only for
your convenience and may be superseded by updates. It is your responsibility to ensure that your
application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY
OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS
CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE.
Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life
support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend,
indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting
from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual
property rights unless otherwise stated.
Trademarks
The Microchip name and logo, the Microchip logo, AnyRate, AVR, AVR logo, AVR Freaks, BeaconThings,
BitCloud, CryptoMemory, CryptoRF, dsPIC, FlashFlex, flexPWR, Heldo, JukeBlox, KeeLoq, KeeLoq logo,
Kleer, LANCheck, LINK MD, maXStylus, maXTouch, MediaLB, megaAVR, MOST, MOST logo, MPLAB,
OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, Prochip Designer, QTouch, RightTouch, SAM-BA,
SpyNIC, SST, SST Logo, SuperFlash, tinyAVR, UNI/O, and XMEGA are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other countries.
ClockWorks, The Embedded Control Solutions Company, EtherSynch, Hyper Speed Control, HyperLight
Load, IntelliMOS, mTouch, Precision Edge, and Quiet-Wire are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BodyCom,
chipKIT, chipKIT logo, CodeGuard, CryptoAuthentication, CryptoCompanion, CryptoController,
dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial
Programming, ICSP, Inter-Chip Connectivity, JitterBlocker, KleerNet, KleerNet logo, Mindi, MiWi,
motorBench, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient
Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PureSilicon, QMatrix, RightTouch logo, REAL
ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI, SuperSwitcher, SuperSwitcher II, Total
Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock, Wireless DNA, and ZENA are
trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.
GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of
Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their respective companies.
© 2018, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
ISBN: 978-1-5224-3121-3
ISO/TS 16949
Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer
fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California
® ®
and India. The Company’s quality system processes and procedures are for its PIC MCUs and dsPIC
®
DSCs, KEELOQ code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design and manufacture of development
systems is ISO 9001:2000 certified.