ST STM32F1 Series User Manual
ST STM32F1 Series User Manual

ST STM32F1 Series User Manual

Dali slave interface
Hide thumbs Also See for STM32F1 Series:

Advertisement

Quick Links

UM1728
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:
• STM32VLDISCOVERY
• 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
DocID025866 Rev 1
1/31
www.st.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F1 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for ST STM32F1 Series

  • Page 1 (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 DocID025866 Rev 1 1/31 www.st.com...
  • Page 2: Table Of Contents

    Contents UM1728 Contents DALI information ..........4 DALI standard overview .
  • Page 3 UM1728 List of figures List of figures Figure 1. Example of DALI device connections ......... . 6 Figure 2.
  • Page 4: Dali Information

    DALI information UM1728 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.
  • Page 5 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.
  • Page 6: Dali Stack Layer

    DALI information UM1728 Figure 1. Example of DALI device connections Figure 2. Voltage and currents on the DALI bus 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.
  • Page 7: Stm32 Dali Slave Library Overview

    UM1728 DALI information 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: • Upper layer (DALI stack layer) • Hardware layer (I/O pin driver layer) The upper layer of the DALI slave library (also known as the DALI stack layer), consists of routines for processing the required DALI commands and other necessary control functions...
  • Page 8: Structure Of Final User Application

    Structure of final user application UM1728 Structure of final user application The final user application uses the DALI slave library and so, consists of the following three layers: • Main user application • DALI stack layer • I/O pin driver layer User application The structure of the user application is comprised completely of IAR project files.
  • Page 9: I/O Pin Driver Layer

    UM1728 Structure of final user application Figure 3. Structure of DALI stack layer 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.
  • Page 10: Figure 5. Hardware For Testing Dali: Stm32 Discovery Kit With Dali Transceiver Board And

    Structure of final user application UM1728 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.
  • Page 11: Function Description

    UM1728 Function description 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). 3.1.1 STM32F10x_it.c These files contain two interrupt service routines (ISR):...
  • Page 12 Function description UM1728 This depends 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: – if the complete DALI packet is received (address, command/data) – if an error occurs on the DALI bus (loss of idle voltage) –...
  • Page 13: Dali Stack Layer Functions

    UM1728 Function description void check_interface_failure(void) This function: • Checks the DALI bus idle voltage presence (500 ms disconnection from the DALI bus) • Calls error callback function if an error occurs u8 get_timer_count(void) This function: • Returns the current systick timer content •...
  • Page 14 Function description UM1728 void DALI_Init(LightControlFunction) This function: • 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 • Initializes all necessary modules of the DALI slave library •...
  • Page 15: Dali_Cmd.c

    UM1728 Function description 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: • Checks if there is a pending timer flag. If so, the given timer callbacks (fading functions, timeouts, ...) are executed.
  • Page 16: Dali_Pub.c

    Function description UM1728 u8 DALIC_isTalkingToMe(void) This function: • Detects if the received DALI packet is addressed to the device void DALIC_ProcessCommand(void) This function: • 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: •...
  • Page 17: Dali_Reg.c

    UM1728 Function description 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 • Implements the DALI commands for controlling light level 3.2.4 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).
  • Page 18: Eeprom.c

    Function description UM1728 void DALIR_DeleteShort(void) This function: • Clears the DALI short address (unassigned address state) 3.2.5 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 •...
  • Page 19: Lite_Timer_8Bit.c

    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: •...
  • Page 20: Dali_Config.c

    Function description UM1728 3.2.7 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.
  • Page 21 UM1728 Function description #define DEVICE_TYPE This definition: • Defines the ballast type according to the DALI specification (see DALI specification for valid ballast type numbers). #define DALI_VERSION_NUMBER_ROM This definition: • Defines the DALI version #define PHYSICAL_MIN_LEVEL_ROM This definition: • Defines the minimum light level which is limited by the ballast hardware capability (according to the DALI specification).
  • Page 22: Application Setup

    Application setup UM1728 Application setup Preload the program into the STM32 discovery kit (details in the DALI SW DALI description). Note: The current version was compiled with IAR 6.3. Select jumper J3 (of STEVAL-ILM001V1). 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).
  • Page 23: Figure 7. Schematic Of Connector J2

    UM1728 Application setup Figure 7. Schematic of connector J2 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. STM32-discovery board Figure 9. Slave device setup (STEVAL-ILM001V1 and STM32-discovery board) DocID025866 Rev 1 23/31...
  • Page 24: Figure 10. Master Device Setup (St7 Dali Master Board)

    Application setup UM1728 Figure 10. Master device setup (ST7 DALI master board) 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 The kit is now ready for operation (two LEDs should be ON, one on the STEVAL- ILM001V and one on the STM32-discovery).
  • Page 25: Application Description

    UM1728 Application description 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.
  • Page 26: Running The Pc Software For Dali-Stm32

    Running the PC software for DALI-STM32 UM1728 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.
  • Page 27: Light Level

    UM1728 Running the PC software for DALI-STM32 Figure 14. Screen overview after a quick search 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”...
  • Page 28: Figure 16. Ballasts Window After Clicking On Update

    Running the PC software for DALI-STM32 UM1728 Figure 16. Ballasts window after clicking on update Figure 17. Light level window during 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”...
  • Page 29: References

    UM1728 References References AN3298 application note ST7DALI-EVAL evaluation kit user manual UM1032: STEVAL-ILM001V1 hardware module for the STM8S - DISCOVERY interface for DALI communication DocID025866 Rev 1 29/31...
  • Page 30: Revision History

    Revision history UM1728 Revision history Table 2. Document revision history Date Revision Changes 28-Feb-2014 Initial release. 30/31 DocID025866 Rev 1...
  • Page 31 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.

Table of Contents