Home
STM8L DALI slave interface
Contents
1. 3 1 1 DALI standard overview 3 1 1 1 DALI purpose and 3 1 1 2 DALI physical layer 3 1 1 3 DALI stack layerz ils va ammes ee arvede et eae 6 12 STM8L DALI slave library overview 6 2 Structure of final user application 7 2 1 User application 7 2 2 I O pin driver layer 8 3 Function description ine inc rad nca a md 10 3 1 I O pin driver 1 5 10 3 1 1 SIL NE CGA Hao hea ake 10 3 1 2 BACE A vc m a ie apa Ke ha wed dale 11 3 2 DALI stack layer functions 13 3 2 1 dalte cox sad een ra oe NOR ea ede ad 13 3 2 2 dall CMAC sos css se drar 15 3 2 3 OIN TIT 15 3 2 4 dali iue ee Ped ede kane PORE Mee Eae Pc om dg 16 3 2 5 GODIOITIO 2 Fase eae dud wand Dee aise ie E 17 3 2 6 lite timer 8bit c 18 3 2 7 dali config c rv e 19 4 Application setup 21 5 Application description 25 6 Running the PC software for DALI
2. Firesc F eeprom itf c 2KB CFile B Libarias S main c 7KB e DALIStack s stm8 interrupt vector c 4KB CFile inc F stmal15x it c 12KB stM8L15x StdPeriph Driver O inc sre 5 C3 Project C3 DALI Slave inc g C3 STVD The I O pin driver layer occupies one timer TIM4 timer one GPIO interrupt one timer interrupt and direct control of two GPIO pins assignment of which is software selectable Timing events are invoked inside the timer interrupt service routine Such events control the I O pin driver layer behavior by calling callback functions from the DALI stack layer at given 1 ms intervals timer ticks 4 DocID024513 Rev 1 UM1632 Structure of final user application Figure 5 Hardware for testing DALI STM8L1526 EVAL with DALI transceiver board and ST7 DALI master board 4 DoclD024513 Rev 1 9 32 Function description UM1632 3 Function description This section describes the most important STM8L DALI slave library functions for the user 3 1 I O pin driver layer functions The I O pin driver layer implements hardware dependent functions designed for use with STMB8L devices and the DALI transceiver board 3 1 1 STMB8I15x_it c These files contain two interrupt service routines ISR Table 1 Void SysTick_Handler void Function name SysTick_Handler Calls receiving routines if there is a voltage level change on th
3. UM1632 y life augmented User manual STM8L DALI slave interface June 2014 Introduction This document describes the implementation of the Digital Addressable Lighting Interface DALI in the STM8L 8 bit microcontroller family The DALI slave library for STM8L microcontrollers simplifies integration of the DALI slave interface into customer applications The implementation of DALI in STM8L together with the various STM8L features peripherals computation power communication interfaces is mainly used in light control applications example electronic ballast control The STM8L DALI slave library was tested according to the DALI specification and comes with a simple application example DALI slave device which was designed and tested for use with the following evaluation boards e SIM8L1526 EVAL e DALI transceiver board see UM1032 STEVAL ILMOO1V1 hardware module 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 DALI slave device The DALI master devices were tested using the ST7DALI evaluation kit master device board and PC software Useful information and links regarding the DALI interface can be found on http www dali ag org DocID024513 Rev 1 1 32 www st com Contents UM1632 Contents 1 DALI information
4. right to make changes corrections modifications or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein No license express or implied by estoppel or otherwise to any intellectual property rights is granted under this document If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN A SAFETY CRITICAL APPLICAT
5. 1 1 DALI purpose and properties The DALI protocol was designed to control modern light sources using a computer Functions include e Dimming e ON OFF switching e Grouping lights to a common control e Scene storage and selection The DALI design properties include e Simple wiring using standard electrical installation cables e special wiring topology as with electrical power cables e Simple installation with cable polarity independence e Automated light source addressing e cost microcontrollers on the light source side minimize the cost of the light source e A simple protocol to control light dimming and switching 1 1 2 DALI physical layer 4 The DALI interface consists of a physical layer from two wires This is a simple installation for which the polarity is independent DocID024513 Rev 1 3 32 DALI information UM1632 4 32 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 Manchester coding is used for improved resynchronization 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 than the transistor transistor logic TTL levels that are usually used This is to provide better n
6. Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com 4 32 32 DocID024513 Rev 1
7. STM8L 26 6 1 Basic commands 00 ccc eee 27 6 2 EE pere een ra TE EE o 28 7 ge e rp a 30 8 Revision history e aca ne o na aa lo ede RC oe aaa 31 2 32 DoclD024513 Rev 1 ky UM1632 DALI information 1 DALI information 1 1 DALI standard overview DALI is an international standard IEC 62386 lighting control system that provides a single interface for electronic control gear 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 with 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 which comprises engineers manufacturers and institutions working in the field of digital lamp lighting control More information about the DALI standard can be found in the following documents e IEC 62386 e 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 STM8L DALI slave library knowledge of the DALI interface specification is essential This document does not provide a description of this specification 1
8. on the physical connection to the DALI bus i e the converter between the DALI bus and the I O pins Defines the callback functions complete DALI packet is received address command data if an error occurs on the DALI bus loss of idle voltage 1 ms callback timer ticks are generated for the DALI stack layer After this function is called the I O pin driver is able to receive DALI packets and call upper layer callbacks This function should be called as the last initialization function after DALI stack initialization Input Parameter GPIO_TypeDef port_out U16 pin_out U8 invert_out GPIO TypeDef port in U16 pin in U8 invert in TDataReceivedCallback DataReceivedFunction TErrorCallback ErrorFunction TRTC 1ms Callback RTC 1ms Function Output Parameter None Return None bool get DALIIN bool get DALIOUT void set DALIOUT pin value This set of functions e Obtains sets the logical level from to the DALI pin DALI Rx and DALI Tx e Accepts the hardware implementation of the driver its eventual inversion 4 DocID024513 Rev 1 11 32 Function description UM1632 12 32 Table 4 Void receive_data Function name Receive_data This function is called from the interrupt routine when the first start bit of a Description DALI packet occurs It Starts the receiving process Input Parameter None Output Parameter N
9. 3 ms 14 ms 15 ms and 16 ms The longer the waiting time the lower the priority 4 DocID024513 Rev 1 UM1632 DALI information 4 Figure 1 Example of DALI device connections Group 0 Group 1 Group 2 Dual power supply Communications interface Iz _i_ Other controller 63 Controller 0 Controller 4 ail 8741 Figure 2 Voltage and currents on the DALI bus ai Forward transmission Backward transmission High level voltage 9 5 V to 22 5 V typical 16 V Low voltage level x 4 5 V La Non agtive state I 1 I 1 I i I Adtive state I Maximum current K 250 f 1 I 1 I I LI I I I U I LI I I I High level clirreht 52 mA j Setting time Start usa Forward data bits sje Sep bits i Be FME DocID024513 Rev 1 5 32 DALI information UM1632 1 1 3 1 2 6 32 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 e Direct light control such as dimming on off switching and scene selection e Device configuration to set DALI variables read device properties address assignments and query devic
10. DALI I O driver state receiving transmitting DALI stack layer functions The DALI stack layer implements all DALI commands processed on the logical level according to the DALI specification dali c These main files contain the most commonly used functions called from the user application Functions include initialization of the entire DALI slave library DALI slave library event flag signaling command execution calls and reporting of user hardware error Table 8 Void DALI Init LightControlFunction Function name DALI Init This function Initializes the entire DALI slave library both I O pin driver layer and DALI stack layer It is called from the user application as the main Description initialization function Initializes all necessary modules of the DALI slave library Starts execution of receiving commands from the DALI bus timing management callback calls and setting of event flags Input Parameter LightControlFunction Output Parameter None Return None DocID024513 Rev 1 13 32 Function description UM1632 14 32 Table 9 Void DALI InterruptConfig void Function name DALI Init Description This funigtiori mE Configures the used IRQ Channels and sets their priority Input Parameter None Output Parameter None Return None u8 DALI CheckAndExecuteReceivedCommand void This function should be cyclically called from the main user application in the main pr
11. IONS SUCH AS LIFE SUPPORTING ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS B AERONAUTIC APPLICATIONS C AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS AND OR D AEROSPACE APPLICATIONS OR ENVIRONMENTS WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE THE PURCHASER SHALL USE PRODUCTS AT PURCHASER S SOLE RISK EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR AUTOMOTIVE AUTOMOTIVE SAFETY OR MEDICAL INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS PRODUCTS FORMALLY ESCC QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY Resale of ST products with provisions different from the statements and or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supersedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2014 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France
12. ack layer Folders X Name Size Type C STMBL_DALI_v1 1 a Dine File Folder _htmresc E DALISTACK lib 169KB LIB File O Libraries DALIStack Be inc STM8L15x StdPeriph Driver inc sre 3 Project DALI Slave inc sre sno DocID024513 Rev 1 7 32 Structure of final user application UM1632 Note 2 2 8 32 The DALI stack is hardware independent it calls the I O pin driver for low level hardware dependent functions After initialization of the DALI stack layer after calling initialization functions most of the tasks run automatically Tasks include receiving commands and running timer tasks light dimming timeouts For the complete source code of the DALI STACK Library please contact your nearest sales office I O pin driver layer The I O pin driver layer of the DALI slave library implements the physical and link layers of the DALI interface The DALI protocol requires two pins for communication The I O pin driver layer implements reception and transmission through direct control of two arbitrary GPIO pins It also controls the required DALI speed and correct bit timing solves DALI bus error recovery and gathers received bits into DALI frames using address and command bytes Figure 4 displays the structure of the DALI I O pin driver layer Figure 4 Structure of I O pin driver layer Folders X Name Size Type C3 STMBL_DALL v1 1 DALIslave c 11KB
13. ackage is designed to work with STM8L1526 EVAL and STEVAL ILMOO1V1 DALI transceiver board The STM8L1526 EVAL is a small printed circuit board PCB with an integrated STM8L152C6 device which demonstrates the STM8L capabilities The DALI transceiver board is connected to the STM8L1526 EVAL as a physical layer extension It provides voltage level conversion and optical isolation between the DALI bus and the STM8L1526 EVAL according to the DALI specification requirements The main task of the user application is to initialize the DALI stack and implement the light intensity control function callback function this function is ballast dependent The user application also periodically controls some event flags if the DALI slave library sets an event flag and it indicates a pending event the user application must call the appropriate service routines from the DALI slave library to execute the necessary commands The user application example uses timer 3 to control the light intensity of the LED diode present on the STM8L1526 EVAL Timer 3 generates the pulse width modulation PWM for the LED diode using the callback function The main program loop checks event flags executes actions for active flags and provides power management Low power state if the DALI bus is quiet and error management reports hardware errors For all these activities the user application calls functions from the DALI slave library Figure 3 Structure of DALI st
14. define DALI VERSION NUMBER ROM This definition Defines the DALI version define PHYSICAL_MIN_LEVEL_ROM This definition e Defines the minimum light level which is limited by the ballast hardware capability according to the DALI specification DocID024513 Rev 1 UM1632 Application setup 4 Application setup 1 Preload the program into the STM8L1526 EVAL details in the DALI SW DALI description Note The current version was compiled with STVD 4 3 2 Select jumper J3 of STEVAL ILMOO1V1 a 1 2 shorted the direct power supply is selected the module is always supplied with the same supply voltage as a controlling microcontroller on STM8L1526 EVAL kit b 2 3 shorted a controlled supply is selected the module is supplied through the GPIO pin of the microcontroller allowing disconnection of the receiver optocoupler when not needed e g during transmission in order to lower the overall system consumption 3 Connect the DALI network cable on connector J1 DALI DA There is no need to pay particular attention to wire polarity as there is an input diode bridge on the module 4 Make the connections for the J2 connector on the STEVAL ILM001V1 and STM8L1526 EVAL as given in the table below and also connect the PDO pin of the STM8L1526 EVAL to the PA4 pin of the same board to determine the effect on LD1 on the STM8L1526 EVAL board as shown in Figure 9 Table 10 Connections of STEVAL ILM001V1 and STM8L D
15. e DALI Description Zn Detects the start of the DALI packet This ISR is inactive during DALI packet reception It is activated after DALI packet reception Input Parameter None Output Parameter None Return None Table 2 Void EXTIO_IRQHandler void Function name EXTIO IRQHandler Generates timer ticks for the DALI bit receive and transmit functions Calls the transmit receive function in given intervals sampling is eight times per DALI bit Description e Generates timer ticks for the upper DALI layer timing by calling callback functions from the DALI stack layer Checks for DALI interface failure such as loss of voltage on the DALI bus for more than 500 ms disconnection from DALI bus Input Parameter None Output Parameter None Return None 10 32 DocID024513 Rev 1 UM1632 Function description 3 1 2 DALIslave c These files contain the reception and transmission routines for building the DALI packet from received bits according to the DALI specification They also contain the initialization functions for the DALI I O pin driver layer The functions of these routines are given below in bold Table 3 Void init DALI port out pin out invert out port in pin in invert in DataReceivedFunction ErrorFunction RTC ims Function Function name Description Init DALI Initializes the DALI I O pin driver layer Defines the DALI RX and DALI TX pins and their inversion This depends
16. e status The DALI stack layer is fully implemented in microcontroller software STMS8L DALI slave library overview The STM8L DALI slave library contains instructions for implementing DALI protocol software in STM8L microcontrollers The DALI slave library consists of two layers e Upper layer DALI stack layer e 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 STM8L microcontrollers do not support DALI communication peripherals DocID024513 Rev 1 UM1632 Structure of final user application 2 2 1 4 Structure of final user application The final user application uses the DALI slave library and consists of the following three layers e Main user application DALI stack layer e I O pin driver layer User application The structure of the user application is entirely comprised of IAR project files The application code is in one source file main c in which the whole user ballast control is implemented This code calls the DALI slave library functions The user application example included in the DALI slave library p
17. es and definitions in these files are given below in bold const u16 DALIP ArcTable This variable is the logarithmic table for light control It e Implements the logarithmic table according to the DALI specification e Converts 8 bit linear values to 16 bit logarithmic output for direct light power control see the DALI specification const u32 DALIP FadeTimeTable This variable e Implements the fade time table according to the DALI specification const u16 DALIP FadeRateTable This variable e Implements the fade rate table according to the DALI specification const u8 DaliRegDefaults This variable e Implements the default DALI register content according to the DALI specification DocID024513 Rev 1 19 32 Function description UM1632 20 32 define USE_ARC_TABLE This definition e Enables the logarithmic table to be used instead of direct light control define OUT DALI PORT define OUT DALI PIN define INVERT OUT DALI define IN DALI PORT define IN DALI PIN define INVERT IN DALI This set of definitions e Contains DALI Rx and DALI Tx signal assignments to given pins according to user requirements The Rx pin must have interrupt capability e Define whether a pin is inverted or not on the user hardware DALI transceiver board define DEVICE TYPE This definition e Defines the ballast type according to the DALI specification see DALI specification for valid ballast type numbers
18. ht source Its brightness fade in out times etc as defined by the DALI standard can be controlled through DALI to simulate normal lamp behavior The STEVAL ILM001V1 provides all the functions required by the DALI standards The most important ones are e Level translation from DALI voltage levels 6 5 to 22 5 V to microcontroller levels 3 3 V 5V logic e Proper rise fall times for the communication e Current consumption limit 2 mA max e Overvoltage protection for misconnection of rated mains voltage to DALI DA connectors 4 DocID024513 Rev 1 25 32 Running the PC software for DALI STM8L UM1632 6 26 32 Running the PC software for DALI STM8L The ST7 DALI user interface is available with the STM8 DALI example AN3298 Use the PowerControl file in the following path of STM8 package STM8Sx AN3298 FW_V2 0 0 Utilities PC_Software ST7 DALI Master The user interface consists of a main window and 5 other windows The main window is always visible Select the View menu to render other windows visible Figure 12 Main window us w LightLevel Slider 4 Salartinn Following Windows options appear in drop down menu e Ballast Grid window ballasts found on the bus after a Search e Light Level Slider window buttons and sliders for adjusting light level parameters e Selection window Buttons for selecting groups e Scene window buttons for selecting scenes e DALI logger window dis
19. ing Many functions execute a given DALI command and other functions execute auxiliary commands A given function is called automatically when the user calls the DALI_CheckAndExecuteReceivedCommand void function The most important functions are given below in bold For other functions the user can refer to the source files and the DALI specification void DALIC Init void This function Initializes the entire set of DALI command modules u8 DALIC isTalkingToMe void This function e Detects if the received DALI packet is addressed to the device void DALIC ProcessCommand void This function e Selects the correct command execution according to received data void DALIC Direct Arc val void DALIC Direct Arc NoFade val This function is called from many DALI commands as a request for light intensity change It e Executes the light intensity control dali pub c These files contain the lower level DALI stack layer functions The user can modify some functions if required All the functions in these files are called from other DALI stack modules mainly from dali cmd c as requests to execute lower level commands The most important functions of these files are given below in bold DocID024513 Rev 1 15 32 Function description UM1632 3 2 4 16 32 void DALIP_Init LightControlFunction This function e initializes the public module e Contains as an input parameter a user callback function for light cont
20. intensity using the slider The user can also control the ballast fade by pushing the Simulate Fading button in the Light level window and vary the intensity using the slider Figure 15 Light level window Fade Time Fade Rate I ER Figure 17 Light level window during fading Fade Time FVT gt m Power All Selected Simulate Fading Pade 4 DoclD024513 Rev 1 UM1632 Running the PC software for DALI STM8L Physical selection of ballast can also be performed with the button provided on the STEVAL ILM001V1 board Select Extras menu item Search for Ballasts and then Physical Selection in the resulting search window Then press the button on the board and the ballast is detected by the master device During physical selection only one ballast is selected at a time 4 DocID024513 Rev 1 29 32 References UM1632 7 30 32 References 1 AN3298 application note 2 ST7DALI evaluation kit 3 UM1032 user manual DocID024513 Rev 1 UM1632 Revision history 8 4 Revision history Table 11 Document revision history Date 05 Jun 2014 Revision 1 Initial release Changes DocID024513 Rev 1 31 32 UM1632 Please Read Carefully Information in this document is provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the
21. iscovery board STEVAL ILMOO1V1 pins J2 STMB8L Discovery pins Vpp Pin 1 3V3 GND Pin 2 GND RX_Supply Pin 5 PB4 S1 Pin 6 PB5 DALI TX Pin 9 PB1 DALI RX Pin 10 PBO Figure 6 Bottom side connectors 4 DocID024513 Rev 1 21 32 Application setup UM1632 Figure 7 Schematic of connector J2 DALLTX 5 Connect the STM8L1526 EVAL board to any USB no SW or driver installation required it is only used as the supply for basic evaluation Figure 8 STM8L1526 EVAL board 4 22 32 DoclD024513 Rev 1 UM1632 Application setup Figure 9 Slave device setup STEVAL ILM001V1 and STM8L1526 EVAL board acting as a ballast Figure 10 Master Device setup ST7 DALI Master Board 6 For the master device connect the serial cable RS 232 to the PC and the ST7 DALI master board and also connect the 12 V adapter to the master board as shown in Figure 10 7 The kit is now ready for operation two LEDs should be ON one on the STEVAL ILMOO1V and one on the STM8L1526 EVAL 4 DoclD024513 Rev 1 23 32 Application setup UM1632 Figure 11 Complete DALI setup 24 32 DoclD024513 Rev 1 4 UM1632 Application description 5 Application description The hardware combination STM8L1526 EVAL STEVAL ILM001V1 works as a DALI slave device The LD1 on the STM8L1526 EVAL kit is used as a lig
22. ogram loop It e Checks for a pending received DALI packet and if present executes the DALI command in the packet e Returns the execution status 0 pending command 1 pending DALI command executed 2 DALI bus error present and processed u8 DALI CheckAndExecuteTimer void This function should be cyclically called from the main user application in the main program loop at least every 1 ms It e Checks for a pending timer flag and if present executes the given timer callbacks fading functions timeouts etc e Returns the remaining number of pending 1 ms timer cycles for a given timer task e g number of timer cycles to finish light dimming cycle void DALI halt void This function allows activation of the microcontroller Low power state Halt mode without timer interrupt Before calling this function the user must check that there are no pending timer cycles and DALI packets void DALI Set Lamp Failure failure This function e Sets or resets the failure state of the lighting element e g a damaged bulb DocID024513 Rev 1 UM1632 Function description 3 2 2 3 2 3 4 u8 Get DALI Random void This function e Returns a random number e _Is for general purpose use dali_cmd c These files contain all DALI commands according to the DALI specification In addition they contain auxiliary functions for command processing such as checking command parameters and correct tim
23. oise immunity to higher interference from nearby power installation cables Voltage levels are defined as follows e Low level state 4 5 to 4 5 V transmitter 6 5to 6 5 V receiver e High level state 11 5 to 20 5 V transmitter 9 5 22 5 V receiver The low level state is dominant on the DALI bus The device can force this level on the DALI bus by shorting 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 cable typically used in light installation cables allows a maximum bus length of up to 300 m Collisions between several DALI masters on the DALI bus are resolved 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 1
24. one Return None Table 5 Void send_data byteToSend Function name Description Send_data This function Starts the transmitting process Input Parameter U8 byteToSend Output Parameter Return None None Function name Description Table 6 Void receive_tick Receive_tick This function is called from timer 4 interrupt service routine after receiving begins It Performs bit receiving from the DALI RX pin for DALI packet building Checks the packet errors on the DALI bus Input Parameter None Output Parameter None Return None Table 7 Void send_tick void Function name Description Send_tick This function is called from timer 4 interrupt servi ce routine after transmitting begins It Performs transmission of DALI packet to DALI bus bit coding to physical layer Input Parameter None Output Parameter None Return None DocID024513 Rev 1 UM1632 Function description 3 2 3 2 1 4 void check_interface_failure void This function e Checks the presence of the DALI bus idle voltage 500 ms disconnection from the DALI bus e Calls error callback function if an error occurs u8 get timer count void This function e Returns the current systick timer content e Is for general purpose use for example random number generation u8 get flag void This function e Returns the current
25. plays all DALI commands sent DocID024513 Rev 1 UM1632 Running the PC software for DALI STM8L 6 1 4 Basic commands Addressing the ballast Select the Extras menu in the main window and then select Search for Ballasts The following window appears Figure 13 Search for Ballast window M Type of Search 7 Start Search C Full Search Close C Physical Selection Total of Ballasts found 0 If a Quick Search does not find all Ballasts run a Full Search Run a Full Search When it is finished run a Quick Search The master will find a ballast on the network The ballast window shows the ballast as shown in Figure 16 Figure 14 Screen overview after a quick search Light Level Go To Scene 5 Selecti lt Custom gt Alb n Fade Ree fue Scene 2 lt None gt Scene 3 Group 0 Scene 4 Group 1 Group 2 Group 3 Group 4 Scene 7 Group 5 1 Ballast s found Scene 5 Ballasts Scene 6 Scene 8 Group 6 Group 7 Scene 9 hen Group 8 Scene 10 Group 9 Scene 11 Group 10 Scene 12 Group 11 Group 12 Group 13 Group 14 Scene 15 Group 15 Scene 13 Scene 14 DoclD024513 Rev 1 27 32 Running the PC software for DALI STM8L UM1632 6 2 28 32 Light level The user can choose to change the light level of the ballast by pushing the All button in the Light Level window and changing the
26. rol itis called to change the light level the user implements it user hardware dependent itonly has one input parameter unsigned int which is the requested light level see header file dali pub h for this function type definition void DALIP Direct Arc u8 val This function is called from the cmd c It e Executes the light intensity control using a logarithmic curve u8 DALIP Getxxx void void DALIP_Setxxx u8 val This set of functions e Reads or sets a given xxx DALI parameter usually a DALI register or flag in RAM void DALIP_Off void void DALIP On And Step Up void void DALIP Step Down And Off void void DALIP Recall Max Level void void DALIP Recall Min Level void void DALIP Up void void DALIP Down void void DALIP Step Up void void DALIP Step Down void This set of functions e Implements the DALI commands for controlling light levels dali reg c These files contain the DALI register management functions The DALI registers can be stored in RAM EEPROM or ROM memory see the DALI specification definitions The functions of these files implement automatic memory selection depending on the register index and register read and write routines DoclD024513 Rev 1 ky UM1632 Function description 3 2 5 4 void DALIR Init void This function e Initializes the DALI register module e Clears all RAM registers void DALIR_ResetRegs void This func
27. tion e Sets all registers to the default state according to the DALI specification u8 DALIR_ReadReg idx void DALIR_WriteReg idx newval u8 DALIR ReadStatusBit bit void DALIR WriteStatusBit bit val u8 DALIR ReadEEPROMReg idx void DALIR WriteEEPROMReg idx val This set of functions e used for register reading and writing void DALIR DeleteShort void This function e Clears the DALI short address unassigned address state eeprom c void EEPROM _Init void This function initializes the EEPROM variables void E2_ResetEEPROM void e Resets the EEPROM header uint16 t E2 WriteMem u16 VirtAddress u16 Data void E2 WriteBurst u16 addr u16 times u16 buf This set of functions e Writes data to EEPROM DocID024513 Rev 1 17 32 Function description UM1632 3 2 6 18 32 u16 E2 ReadMem u16 VirtAddress uint16_t Data e Reads data from EEPROM lite timer 8bit c These files constitute the timing module They contain all the virtual timers needed for DALI timing such as intervals for the dimming function and DALI timeouts Reference timer ticks come from the DALI I O pin driver layer void Timer Lite Init void This function e initializes the timing module Initializes the internal variables to their default state void RTC_LaunchTimer timer_value This function e initializes a timeout for DALI command repetition void RTC_LaunchUserTimer TimerCount void RTC_DoneUserTimer
28. void This set of functions e Dims the update intervals start and stop void RTC_LaunchBigTimer mins This function e Initializes the timeout usually 15 minutes expiration of the DALI Initialize command void RTC_LaunchDAPCTimer void This function e Initializes the timeout 200 ms expiration of the DALI DAPC sequence command void PowerOnTimerReset void This function e Stops the power on timeout 600 ms previously initialized during power on using the Timer Lite Init function DocID024513 Rev 1 UM1632 Function description 3 2 7 4 void Lite_timer_Interrupt void This function is the main timer function servicing all timers It e Is a callback function that receives 1 ms timer ticks from the DALI I O pin driver layer e Runs in interrupt e Updates the timer event flag used for updating the virtual timers 1 ms each u8 Process Lite timer IT void This function is called cyclically from the user main program loop in 1 ms intervals when the timer event flag is signalled It e Services timer events if necessary e Calls callbacks or updates virtual timer values dali config c These files contain the DALI stack module configurations The user can change them according to requirements the final ballast hardware software implementation the light element used the type of light control the STM8L pin out and the user device description information The most important variabl
Download Pdf Manuals
Related Search
Related Contents
取扱説明書 WAFER-PV-D4251/D5251/N4551 SBC BOOM EVOLUTION 2.1 SOUND SYSTEM RELIVOPAN Protocol d`administration (PDF 831 加熱する 取扱説明書 - Cateye User Manual Wireless HDTV Media Player CE QU`IL FAUT SAVOIR SUR LA FOI Copyright © All rights reserved.
Failed to retrieve file