Home
UM1728 - STMicroelectronics
Contents
1. 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 To get the complete source code of DALI STACK library please contact nearest sales office I O pin driver layer The I O pin driver layer of the DALI slave library implements 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 collects 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 a STM32 DALI_EEPROM_v3 A 2 DALIslave c 13KB CFile _htmresc main c 9KB CFile Libraries S stm32F10x_it c 7KB CFile CMSIS 3 DALIStack inc z a STM32 USB FS Device Driver inc sre 2 STM32F10x_StdPeriph_Driver inc src Project D Demo 4 O EWARM inc ota The I O pin driver layer occupies one timer systick timer one GPIO interrupt one timer interrupt and direct control of two GPIO pins assignment of whic
2. Gr UM1728 Sf life augmented User manual STM32F1xx DALI slave interface Introduction This document describes the implementation of the digital addressable lighting interface DALI into the STM32F1xx 32 bit microcontroller family The DALI slave library for STM32F1xx microcontrollers simplifies integration of the DALI slave interface into customer applications The implementation of DALI into STM32 together with the various STM32 features peripherals computation power communication interfaces is mainly used in light control applications example electronic ballast control The STM32 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 e STM32VLDISCOVERY e DALI transceiver board see UM1032 STEVAL ILM001V1 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 which is the DALI slave device The DALI master devices were tested using the ST7DALI evaluation kit master device board and PC software Useful information and links about DALI interface can be found on http www dali ag org February 2014 DoclD025866 Rev 1 1 31 www st com Contents UM1728 Cont
3. Data void E2 WriteBurst u16 addr u16 times u16 buf This set of functions e Writes data to EEPROM u16 E2_ ReadMem u16 VirtAddress uint16_t Data This set of functions Read data from EEPROM static FLASH_Status EE_Format void This set of functions Erases PAGEO and PAGE1 and writes VALID_PAGE header to PAGEO static uint16_t EE_FindValidPage uint8_t Operation This set of functions e Find valid Page for write or read operation static uint16_t EE _VerifyPageFullWriteVariable uint16_t VirtAddress uint16_t Data This set of functions e Verify if active page is full and Writes variable in EEPROM static uint16_t EE_PageTransfer uint16_t VirtAddress uint16_t Data This set of functions e Transfers last updated variables data from the full Page to an empty one 4 DoclD025866 Rev 1 UM1728 Function description 3 2 6 lite_timer_8bit c These files are the timing module They contain all virtual timers which are 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 e 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 void This set of functions e Dims
4. 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 DocID025866 Rev 1 21 31 Application setup UM1728 4 Note 22 31 Application setup 1 Preload the program into the STM32 discovery kit details in the DALI SW DALI description The current version was compiled with IAR 6 3 2 Select jumper J3 of STEVAL ILM001V1 a 1 2 shorted the direct power supply is selected It means the module is always supplied with the same supply voltage as a controlling microcontroller on STM32 discovery kit b 2 3 shorted a controlled supply is selected The module is supplied through the GPIO pin of the microcontroller allowing to disconnect the receiver optocoupler when not needed e g during transmission to lower the overall system consumption 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 Make the connections of J2 connector of STEVAL ILM001V1 and STM32 discovery as given in the table below and also connect the PC9 pin of the STM32 discovery board to the PA6 pin of the same board to see the effect on LED3 on STM32 discovery board as shown in Figure 9 Table 1 Connections of STEVAL ILM001V1 and STM32 discovery board STEVAL ILM001V1
5. Note 4 31 DALI information DALI standard overview DALI is 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 DAL 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 To better understand the STM32 DALIF1xx slave library a knowledge of the DALI interface specification is essential This application note does not provide a description of this specification 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 s
6. bus idle voltage presence 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 used for general purpose use for example random number generation u8 get_flag void This function e Returns the current 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 that are called from the user application They contain initialization of the entire DALI slave library DALI slave library event flag signaling command execution calls and reporting of user hardware error DoclD025866 Rev 1 13 31 Function description UM1728 14 31 void DALI_Init LightControlFunction This function e Initializes the entire DALI slave library both I O pin driver layer and DALI stack layer and is called from the user application as the main initialization function e Initializes all necessary modules of the DALI slave library e Starts execution of receiving commands from the DALI bus timing management callback calls and setting of event flags void DALI_InterruptConfig void This function e Configures the used IRQ Channels and sets their priority u8 DALI CheckAndExecuteReceivedCommand void This functio
7. intensity using the slider button Figure 15 Light level window Light Level Fadeline Seere eo ee O rara Power All Selected Simulate Fading Fade Rate H7 DoclD025866 Rev 1 27 31 Running the PC software for DALI STM32 UM1728 28 31 Figure 16 Ballasts window after clicking on update Figure 17 Light level window during fading feito lona E Fada Rate fannie Power All Selected Simulate Fading Physical selection of ballast can also be done with the help of the button provided on the STEVAL ILM001V1 board Select Extras menu item Search for ballasts and then Physical selection in search for ballast window And then press the button on the board and the ballast is detected by the master device But during physical selection only one ballast is selected at a time 2 DoclD025866 Rev 1 UM1728 References 7 References 1 AN3298 application note 2 ST7DALI EVAL evaluation kit user manual 3 UM1032 STEVAL ILM001V1 hardware module for the STM8S DISCOVERY interface for DALI communication ly DoclD025866 Rev 1 29 31 Revision history UM1728 8 30 31 Revision history Table 2 Document revision history Date 28 Feb 2014 Revision 4 Initial release Changes DoclD025866 Rev 1 2 UM1728 Please Read Carefully Information in this document is provided solely in con
8. pins J2 STM32 discovery pins VDD pin 1 3V3 GND pin 2 GND RX_Supply pin 5 PB9 S1 pin 6 PB8 DALI_TX pin 9 PB1 DALI_RX pin 10 PBO Figure 6 Bottom side connectors DoclD025866 Rev 1 UM1728 Application setup Figure 7 Schematic of connector J2 AX_SUPPLY 5 Connect the STM32 discovery board to any USB no SW or driver installation required it is used only as the supply for basic evaluation Figure 8 epa ceci board 4 DoclD025866 Rev 1 23 31 Application setup UM1728 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 12V adapter to the master board as can be seen 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 STM32 discovery Figure 11 Complete DALI setup 24 31 DoclD025866 Rev 1 ky UM1728 Application description 5 Application description The hardware combination STM32 DISCOVERY STEVAL ILM001V1 works as a DALI slave device The LD3 on the STM32 DISCOVERY kit is used as a light source Its brightness fade in out times etc as defined by the DALI standard can be controlled through DALI to simulate a normal lamp behavior The STEVAL ILM001V1 provides all the functions requ
9. 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 which was started during power on using the Timer_Lite_Init function 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 DoclD025866 Rev 1 19 31 Function description UM1728 3 2 7 20 31 dali_config c These files contain the DALI stack module configurations The user can change them according to his needs the final ballast hardware software implementation the light element used the type of light control the STM32 pinout and the user device description information The most important variables and definitions in these files are
10. timer cycles and DALI packets void DALI Set_Lamp_Failure failure This function e Sets or resets the failure state of the lighting element for example a damaged bulb u8 Get_DALI Random void This function e Returns a random number e Is used 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 timing 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 of these files are given below in bold For information about other functions the user can refer inside these source files and to the DALI specification void DALIC_Init void This function Initializes the entire DALI command modules DoclD025866 Rev 1 15 31 Function description UM1728 3 2 3 16 31 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 i
11. Down void This set of functions e Implements the DALI commands for controlling light level 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 void DALIR_Init void This function e Initializes the DALI register module e Clears all RAM registers void DALIR_ResetRegs void This function 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 Is used for register reading and writing DoclD025866 Rev 1 17 31 Function description UM1728 3 2 5 18 31 void DALIR_DeleteShort void This function e Clears the DALI short address unassigned address state eeprom c These files contain the EEPROM flash emulated as EEPROM management read and write routines void EEPROM_Init void This function Initializes the MCU for emulated EEPROM Initializes the variables related to emulated EEPROM void E2_ResetEEPROM void This set of functions Resets the EEPROM header uint16_t E2_WriteMem u16 VirtAddress u16
12. GHT ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN A SAFETY CRITICAL APPLICATIONS 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 compa
13. TM32 discovery kit according to the DALI specification requirements The main task of the user application is to initialize the DALI stack and to 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 STM32 discovery kit 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 purposes the user application calls functions from the DALI slave library 2 DoclD025866 Rev 1 UM1728 Structure of final user application Note 2 2 Figure 3 Structure of DALI stack layer STM32 DALI_EEPROM_y3 a Cine File Folder _htmresc E DALISTACK lib 442KB LIB File 3 Libraries mss DALIStack inc 2 STM32_USB FS Device_Driver inc src 5 STM32F10x_StdPeriph_Driver inc src 2 Project Demo O EWARM O inc src
14. ain window and select item Search for ballasts The following window appears Figure 13 Search for ballast window i 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 4 DoclD025866 Rev 1 UM1728 Running the PC software for DALI STM32 4 Figure 14 Screen overview after a quick search Light Level Go To Scene amp Selecti X NFL lt Custom gt Scene 1 lt All gt Scene 2 lt None gt i STMicroelectronics DALI Control 2 0 ME Scene 3 Group 0 Eile View Options Extras Help CD ce Ga al 1 Ballast s found Scene 5 Ballasts Scene 4 Group 1 Group 2 Group 3 Scene 6 Group 4 Scene 7 Group 5 Scene 8 Group 6 Group 7 Group 8 Group 9 Scene 11 Group 10 Scene 9 Scene 10 Scene 12 Group 11 Group 12 Group 13 Group 14 Scene 15 Group 15 Scene 13 Scene 14 Light level User can choose to change the light level of ballast by pushing the All button in the Light Level window and change the intensity level using the slider button User can also check the fading of the ballast by pushing the Simulate Fading button in the light level window and vary the
15. ate 11 5 to 20 5 V transmitter 9 5 to 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 for example a 1 5 mm2 cable which is typically used in light installation cables allows a maximum bus length of up to 300 m The length is linearly dependent on the cross section of the conductor 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 DoclD025866 Rev 1 5 31 DALI information UM1728 Figure 1 Example of DALI device connections Group 0 Group 1 Other co
16. election The DALI design properties include e Simple wiring using standard electrical installation cables e No special wiring topology as with power electrical cables e Simple installation giving cable polarity independence e Automated light source addressing e Use of low cost microcontrollers on the light source side to minimize cost of light source e Use of a simple protocol to control light dimming and switching 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 4 DoclD025866 Rev 1 UM1728 DALI information 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 better 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 due to better noise immunity because of higher interference present on nearby power installation cables Voltage levels are defined as follows e Low level state 4 5 to 4 5 V transmitter 6 5 to 6 5 V receiver e High level st
17. ents 1 DALINO MAtON oie vince al A ia aL 4 1 1 DALI standard overview o oo oocoocoooo eee 4 1 1 1 DALI purpose and properties 0 cee eee 4 1 1 2 DALI physical layer ocoocccccccoo eee 4 1 1 3 DALI Stack layer eresien aa eel ele pe Dee od dee ee 6 1 2 STM32 DALI slave library overview asaan aanne 7 2 Structure of final user application oooooooommmm mo 8 2 1 User application ase dE dia e cae ee gacd adele eg aS asa 8 2 2 VO pin driver layer acu dcdea wise ceded ra da Kadawalea dad caw 9 3 Function description 0 0c eee eee 11 3 1 I O pin driver layer functions 000 c eee eee 11 3 1 1 STMIZETOX Mia oa wae it wea eS ee eda hw eae de a 11 3 1 2 DALIslave c 0 0 eee 11 3 2 DALI stack layer functions 00 eee eee 13 3 2 1 OaliC yc ai eas ht chew an a dhe toe eee Oe 13 3 2 2 d l ecm C sica reri eee eee isa E eds Bees a owed Ke 15 3 2 3 Call PUDO scrape A lados 16 3 2 4 Call 160 0 aria AE A ERA AA ade 17 3 2 5 ON 18 3 2 6 lite_timer_8bit c rsi crcire ssaa criam ee eee ees 19 3 2 7 Pall comig O iaa al de sacks ER 20 4 Application setup cies did cece ca orcas wad ae 22 5 Application description 00 cece eee eee 25 6 Running the PC software for DALI STM32 2 26 6 1 Basic commands 00 ccc eee 26 6 2 Light level 00326 Gaee Soe Sas oe Ree hE Seed eyotaekasraswe s 27 7 Referentes carr E tae eon keene A 29 8 Revis
18. 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 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 if a pin is inverted or not on the user hardware DALI transceiver board 4 DoclD025866 Rev 1 UM1728 Function description define DEVICE_TYPE This definition e Defines the ballast type according to the DALI specification see DALI specification for valid ballast type numbers define DALI_VERSION_NUMBER_ROM This definition
19. h is software selectable DoclD025866 Rev 1 9 31 Structure of final user application UM1728 10 31 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 Figure 5 Hardware for testing DALI STM32 discovery kit with DALI transceiver board and ST7 DALI master board DoclD025866 Rev 1 ky UM1728 Function description 3 3 1 3 1 1 3 1 2 Function description This section describes the most important STM32F1xx DALI slave library functions for the user I O pin driver layer functions The I O pin driver layer implements hardware dependent functions designed for use with STM32F1xx devices and the DALI transceiver board STM32F10x_it c These files contain two interrupt service routines ISR void SysTick_Handler void This function e Generates timer ticks for the DALI bit receive and transmit functions e Calls in given intervals the transmit receive function sampling is eight times per DALI bit e Generates timer ticks for the upper DALI layer timing by calling callback functions fr om the DALI stack layer e Checks for DALI interface failure such as loss of voltage on the DALI bus for more than 500 ms disconnection from DALI bus Void EXTIO_IRQHandler void This function e Calls receiving routines if t
20. here is a voltage level change on the DALI RX pin e Detects the start of the DALI packet This ISR is inactive during DALI packet reception t is activated after DALI packet reception DALIslave c These file contains the reception and transmission routines for building the DALI packet from received bits according to the DALI specification It also contains the initialization functions of the DALI I O pin driver layer The functions of these files are given below in bold Void init_DALI port_out pin_out invert_out port_in pin_in invert_in DataReceivedFunction ErrorFunction RTC_1ms_Function This function e Initializes the DALI I O pin driver layer e Defines the DALI RX and DALI TX pins and their inversion DoclD025866 Rev 1 11 31 Function description UM1728 12 31 This depends on the physical connection to the DALI bus i e the converter between the DALI bus and the I O pins e Defines the callback functions if the complete DALI packet is received address command data fan error occurs on the DALI bus loss of idle voltage if 1 ms callback timer ticks are generated for the DALI stack layer e After this function is called the I O pin driver is able to receive DALI packets and can call upper layer callbacks This function should be called as th e last initialization function after DALI stack initialization bool get_DALIIN bool get_DALIOUT void set_DALIOUT pin_value This set of fu
21. ion history mexico car deen dd eee eRe A ee 30 2 31 DoclD025866 Rev 1 ky UM1728 List of figures List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Example of DALI device connectionSs 0 cee ee 6 Voltage and currents on the DALI bus oooocccccococ eee 6 Structure of DALI stack layer 0 2 0 0 ce teens 9 Structure of I O pin driver layer 0 0 0 0 00 ccc ete eee 9 Hardware for testing DALI STM32 discovery kit with DALI transceiver board and S17 DALI master board iii a awd eae nde waa een ade wee Ae da 10 Bottom side connectors 000 eee 22 Schematic of connector J2 0 teeta 23 STM82 discovery board occ 23 Slave device setup STEVAL ILM001V1 and STM32 discovery board 23 Master device setup ST7 DALI master board 0 0 c cee eee 24 Complete DALI setup 0 0 00 0 teen tenes 24 Main WINdOW csc stargate dette a Re aa wd ne eek an ge ee 26 Search for ballast window 1 2 0 0 0 ccc teens 26 Screen overview after a quick Search 1 0 0 ccc tees 27 Light level window serere 0 0 eee teeta 27 Ballasts window after clicking on update 0 00 eee eee 28 Light level window during fading oooocccoccccoo eee 28 DoclD025866 Rev 1 3 31 DALI information UM1728 1 1
22. ired by the DALI standards The most important of which 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 DoclD025866 Rev 1 25 31 Running the PC software for DALI STM32 UM1728 6 6 1 26 31 Running the PC software for DALI STM32 The ST7 DALI user interface is available with 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 View menu to choose other visible windows Figure 12 Main window Fj STMicroelectronics DALI Control 2 0 File MENA Options Extras Help D y Ballast Grid Adius v LightLevel Slider 4 Selection Following windows options appear in drop down menu Ballast grid window ballasts found on the bus after a search light level slider window buttons and sliders for adjusting light level parameters selection window buttons for selecting groups scene window buttons for selecting scenesDALI logger window displays all DALI commands sent Basic commands Addressing the ballast Select Extras menu in the m
23. n should be cyclically called from the main user application in the main program loop It e Checks if there is a pending received DALI packet If so the given DALI command from the packet is executed e Returns the execution status 0 nopending command 1 pending DALI command executed 2 DALI bus error present and processed u8 DALI CheckAndExecuteReceivedCommand void This function should be cyclically called from the main user application in the main program loop It e Checks if there is a pending received DALI packet If so the given DALI command from the packet is executed e Returns the execution status 0 nopending command 1 pending DALI command executed 2 DALI bus error present and processed 2 DoclD025866 Rev 1 UM1728 Function description 3 2 2 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 if there is a pending timer flag If so the given timer callbacks fading functions timeouts are executed e Returns the number of pending remaining 1 ms timer cycles for a given timer task example number of timer cycles to finish light dimming cycle void DALI halt void This function contains the entry to the microcontroller low power state halt mode without timer interrupt The user must check before calling this function that there are no pending
24. nctions 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 void receive_data void This function is called from the interrupt routine when the first start bit of DALI packet occurs It e Starts the receiving process void send_data byteToSend This function e Starts the transmission process void receive_tick void This function is called from systick interrupt service routine when receiving has already started It e Performs bit receiving from the DALI RX pin for building the DALI packet e Checks the packet errors on the DALI bus void send_tick void This function is called from systick service routine when transmitting has already started It e Performs transmitting of DALI packet to DALI bus bit coding to physical layer 4 DoclD025866 Rev 1 UM1728 Function description 3 2 3 2 1 void check_interface_failure void This function e Checks the DALI bus idle voltage presence 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 s used for general purpose use for example random number generation u8 get_flag void This function e Returns the current DALI I O driver state receiving transmitting void check_interface_failure void This function e Checks the DALI
25. nection with ST products STMicroelectronics NV and its subsidiaries ST reserve the 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 RI
26. nies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com ky DoclD025866 Rev 1 31 31
27. ntensity control dali_pub c These files contain the lower level DALI stack layer functions The user can modify some functions if required All functions of these files are called from other DALI stack modules mainly from the dali_cmd c as requests to execute lower level commands The most important functions of these files are given below in bold void DALIP_Init LightControlFunction This function e initializes the public module e Contains as an input parameter a user callback function for light control itis called if there is a need to change the light level the user implements it implementation is user hardware dependent ithas only 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 dali_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 4 DoclD025866 Rev 1 UM1728 Function description 3 2 4 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_
28. ntroller 63 Communications interface Controller 0 Controller 4 ail 8744 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 AM M Low level voltage 5V to 6 5v Low voltage level 4 5 V l l Adtive sta e Maximum current 250 f l je Setting time Start i ued Forward data bits Sop bits yy BE he EENS lei 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 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 device status The DALI stack layer is fully implemented in microcontroller software 6 31 DoclD025866 Rev 1 ky UM1728 DALI information 1 2 STM32 DALI slave library overview The STM32F1xx DALI slave library contains instructions for implementing software of the DALI protocol into STM32 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 consis
29. ts 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 STM32 microcontrollers do not support DALI communication peripherals DoclD025866 Rev 1 7 31 Structure of final user application UM1728 2 2 1 8 31 Structure of final user application The final user application uses the DALI slave library and so consists of the following three layers e Main user application e DALI stack layer e 1 0 pin driver layer User application The structure of the user application is comprised completely 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 package is designed to work with the STM32 discovery kit and STEVAL_ILM001V1 DALI transceiver board The STM32 discovery kit is a small printed circuit board PCB with an integrated STM32F100RBT6 device which demonstrates STM32 capabilities The DALI transceiver board is connected to the STM32 discovery kit as a physical layer extension It provides voltage level conversion and optical isolation between the DALI bus and the S
Download Pdf Manuals
Related Search
Related Contents
Philips Forecast myLiving 19029/30/65 Biostar M7NCG Owner's Manual Samsung 22" FHD-näyttö, Touch of Color Käyttöopas Haier EB-2485E Microwave Oven User Manual Samsung YP-20T User Manual APC Smart Copyright © All rights reserved.
Failed to retrieve file