Home
LightingDemo - Freescale Semiconductor
Contents
1. Ea USB Device Libraries 10326 EB usb_ddk_d a 10326 BB usb_ddk a n a EB usb_ddk H 24 files 459K 30 MQX on the controller board The MQx libraries are derived from the standard MQX 3 3 port to the Freescale M52259EVB evaluation board with only one change The board support package m52259evb a m52259evb_d a has been re built to use UART2 instead of UARTO as the standard I O port This is necessary because the Controller board uses UARTO for the DMX512 connection UART2 is optionally used for debugging To make this change when rebuilding the M52259EVB board support package edit the file user config hand change as follows define BSPCFG ENABLE TTYC 1 define BSP DEFAULT IO CHANNEL ttyc By default UART2 is configured to use e 115200 baud e 8 data bits e 1stop bit e No parity e No handshake Debugging information for the controller board A number of support routines like debug_ printf allow debugging information to be collected All calls ultimately call a routine debug_vprintf inthe file support c This routine is responsible for outputting the debug text in some form For example it could send it to the UART2 serial port In the current implementation it stores the debug text in a circular buffer from where the LightingDemo application on the PC picks it up via a USB request and UART2 is not used C Pre processor Definitions for the controller board The
2. The application note covers the following topics e Configuring the boards and installing the LightingDemo application on the PC e Using the LightingDemo application e Detailed discussion of the source code of the software running on controller and LED boards Configuring the Boards Note Don t connect the controller board to the PC yet Because the act of connecting the board will cause the PC to look for new driver software this step is best delayed until the section Installing the LightingDemo Application The LightingDemo application requires the following e APCrunning Windows XP or Windows Vista 32 bit editions with NET framework version 3 0 or later installed e One Freescale MCF52259 Lighting Controller the controller board e One or more Freescale High Brightness LED Driver boards the slave boards The boards must have the correct software installed and be jumpered correctly see below A typical DMX512 configuration is shown below Note that the Controller board gets its power from the USB connection and does not require a separate power supply and that the last slave board on the DMX512 link requires a terminator Typical DMX512 Configuration DMX cable DMX cable USB cable Terminator Slave Board Controller Slave Board Board 12V Power Supply A typical DALI configuration is shown below In this case the controller board requires an external 12V power supply to drive the DALI li
3. dali device init to initialise the hardware interface Function Prototype DALI ERROR dali device init DALI HANDLE inHandle Note that the controller board software to accompany the LightingDemo application allows the user to switch between DALI and DMX512 protocols dynamically This is achieved by calling dali device init dali device deinit and the DMX512 equivalents as appropriate DALI Discovery To perform an DALI discovery process in order to find out which slaves are attached to the DALI network call the dali_ discovery routine Function Prototype DALI ERROR dali discovery DALI HANDLE inHandle This will cause the controller software to initiate DALI discovery searching the 24 bit DALI random address address space for enabled devices For each slave that is found the software will request additional information such as the type of LED and whether the device already has a DALI Short Address The result is added to a linked list of all known slaves in which each item has the following structure 41 typedef struct DALI SLAVE RECORD uint_ 8 shortAddress DALI short address uint 32 randomAddress DALI random address at which slave responded uint 8 modelID Type code uniquely identifying LED type struct DALI SLAVE RECORD next Linked list of records DALI SLAVE RECORD The following convenience routines al
4. typedef struct DMX SLAVE RDM UID uint 16 uint 16 uint 8 uint 8 R ECORD slave UID subDevice startAddress currentPersonality numPersonalities uint_ 8 slotValues uint_16 numSubDevices char model char manufacturer uint_16 modelID uint_16 numSensors struct DMX SLAVE RECORD next DMX SLAVE RECORD 33 Slave UID RDM ROOT DEVICE sub device number DMX512 start address or Current personality Number of personalities supported RDM PERSONALITY personality MAX RDM PERSONALITIES 1 Personality records Note personalities from 1 upwards RDM numbers so used entries in this array are in range 1 numPersonalities ues devices else 0 Array of slot val Number of DMX sub if RDM ROOT DEVICE Model description Manufacturer description Model ID Number of sensors Linked list of records The following convenience routines allow you to walk the slave list a Return count of the number of slave records found uint_32 dmx_count_slaves DMX HANDL E inHandle b Return pointer to first slave record or NULL if no slaves found G R DMX SLAVE ECORD dmx slave list DMX_HANDLE inHandle c Return pointer to Nth slave starting from 0 or N
5. The source code of this application is not provided Please contact MicroAPL Limited if you have any queries regarding this software The application is written in C using the NET application framework It communicates with the Controller board via USB using a simple proprietary protocol not DMX or DALI 2 The software running on the Controller board Full source code of the Controller board application is provided It is written in C and compiled with the CodeWarrior for ColdFire tool chain The free open source MQX operating system is also used mainly to implement the USB connection 3 The software running on the Slave board s Full source code of the Slave board application is provided It is written in C and compiled with the CodeWarrior for Microcontrollers tool chain The microprocessor used on the board is a Freescale MC13213 processor No operating system is used The software on the Controller and Slave boards can be modified to use only the DMX512 RDM protocol or only the DALI protocol without much difficulty Note that some source code files are shared between Controller and Slave implementations For example the file dmx_ support c contains support routines used by both boards for DMX512 Documentation A very useful source of documentation on the individual routines is the subroutine header in the source file itself For example 24 RRR KKK KK KK KR KK IR I I AR RR I AOR RK I I OR KK KK
6. Y Z Or re arranging X Y y xX Z Y y 1 x y The routine begins by computing the XYZ tristimulus values of the target colour Using the information from the XML description of the LED the software can also calculate the tristimulus values of the individual primaries like Red The next step is to consider the simplified case of a package with only three primaries e g consider Red Green and Blue and ignore any White channel The software needs to calculate the duty cycles in the range 0 0 1 0 for 0 100 needed for each channel in order to achieve the target chromaticity at maximum brightness The XYZ value of the target colour and the duty cycles are related by a matrix multiplication X Duty Cycle Red Y M x Duty Cycle Green Z Duty Cycle Blue Software needs to determine the 3 x 3 matrix M and then compute the inverse of M in order to calculate the duty cycles required M can be determined from the XYZ tristimulus values of the primaries For example when only the Red primary is illuminated using 100 duty cycle it produces the lumens and x y chromaticity 52 specified in the XML description For the Luminus PhlatLight CBM380 example given earlier these are Y 700 lumens and x y 0 701 0 299 Converting these to XYZ we have Xred 1 Yred M x 0 Zred 0 It follows that the entire matrix M is simply Xred Xgreen Xblue Yred Ygreen Yblue Zred Zgreen Zblue Having calculated the required d
7. dmx controller init Allocate and initialise DMX controller KKEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK Allocates memory for DMX controller device and initialises data structure Arguments uint_16 inDeviceNumber Physical device to use for I O uint 8 inUniverseNumber DMX Universe Number 1 255 RDM UID inUID RDM device UID Result h DMX HANDLE result Handle to DMX device Memory Footprint The following are approximate figures for the memory footprint of the software on the controller and slave boards They should be taken as a guide only No attempt has been made to reduce the footprints since they fit comfortably on the target hardware Contact MicroAPL if memory usage is a concern Controller Board Code Data PC USB interface 10250 2900 DMX512 code 10050 4300 DALI code 6600 5500 MQX RTOS 63000 1200 Total 89900 13900 Removing the packet level debugging code makes the application smaller Note that the application makes very little use of the MQX RTOS apart from the USB stack so it would be possible to run without an RTOS without too much re coding work Slave Board Code Data Application 7800 410 DMX512 code 9500 10 DALI code 6700 50 25 LED control 12800 100 Compiler support libraries 8630 2006 inc 2000 byte heap Other 230 640 Total 45660 3216 In addition the slave board software can be built in a mini DALI version designed to fit in only
8. 8K of Flash and 512 bytes of RAM This version only allows the LED to be controlled using the DALI protocol The brightness of the LED can be controlled using the standard DALI command set but not the colour of the LED In addition the software does not perform thermal monitoring of the LED to prevent damage by over heating leaving it up to hardware to limit the current to a safe maximum value The documentation here will mainly discuss the full slave implementation not the mini DALI version although most of the source code is shared by the two versions DMX512 and RDM implementation on the Controller and Slave Boards On both controller and slave board DMX512 RDM data is sent and received using a UART operating in polled mode The DMX512 protocol can be divided into two parts In standard DMX512 each slave device has a start address in the range 1 512 and a footprint of one or more slots Primary control is achieved by the controller broadcasting NULL Start Code packets containing up to 512 slot values For added reliability DMX512 controllers can interleave the NULL Start Code packets with System Information Packets SIPs which allows a checksum to be appended to the NULL Start Code data The Remote Device Management protocol RDM is an extension to standard DMX512 It allows the controller to send multi byte messages to an individual slave and also to get multi byte replies In addition it allows the controller to discove
9. Controller board via the USB connection Assuming that all is well the application will instruct the Controller board to begin a search for connected devices using either the DMX512 or DALI discovery process Discovery should complete rapidly for DMX512 but may take a few seconds for DALI After discovery is complete you will see a list of the connected devices Lighting Demo 5 8 File Edit Help DMX512 Devices Search completed OK PhlatLight CBM 380 3 LEDs found Luxeon Rebel RGB CW Luxeon Rebel RGB CW Device DMX512 Start Address Luminus PhlatLight CBM 380 1 Philips Lumileds Luxeon Rebel RGB CW 5 Philips Lumileds Luxeon Rebel RGB CW 9 Controller Board Freescale MCF52259 Lighting Controller using MQX RTOS Software version 1 0 0 Repeat Search for Devices freescale semiconductor To begin using a device select it from the list on the left You can switch between devices at any time Failure to see the Controller Board If the LightingDemo application is unable to contact the Controller board via the USB connection you will see the following dialog 14 E _ Communications Error Unable to contact the controller board A Try unplugging the USB cable and then reconnecting t Try unplugging the USB cable and then reconnecting it which should cause Windows to recognize that it has a Controller board connected If the problem persists you need to ch
10. It follows that the LED can produce a pure green at a much higher luminance than colours which mix green and blue 19 e For some LED packages there is a limit to the total current that can be safely delivered to the LED For example a Luminus PhlatLight CBM 380 can take 12A for Red and Green 8 1A for Blue and 9A for White but the combined current must not exceed 32A in total The Y luminance value thus represents a percentage of the maximum theoretical value for the selected LED and colour The actual lumens may be reduced if the slave board detects that the LED package is in danger of over heating it will reduce the power to safeguard the device In a system with more than three primaries e g Red Green Blue and White a typical colour can be produced in more than one combination For example it might be produce able using Red Green Blue and also Green Blue White In this case the software on the slave board calculates the maximum luminance that can be achieved using some combination of both solutions Direct Control If you are controlling the LED using the DMX512 protocol the LightingDemo application also allows you to specify the power delivered to the LED primaries directly r Lighting Demo ola File Edit Help f sRGB Colour Space CIE 1931 Colour Space Direct Control Sensors DMX512 Devices PhlatLight CBM 380 7 Red J Luxeon Rebel RGB CW o Luxeon Rebel RGB CW 0 255 Green g 128 0 255
11. attempt lt 3 attempttt Make the GET SOFTWARE VERSION LABEL command tx packet rdm_make command dmx controller slave gt slave_ UID slave gt subDevice GET COMMAND SOFTWARE VERSION LABEL NULL 0 Send it errcode rdm_send packet dmx controller tx packet if errcode ERR_DMX OK continue Any response errcode rdm_get_ response dmx controller tx packet amp rx packet false if errcode ERR DMX OK Do something with the software version string here break Send DMX512 NULL Start Code packet slot_values 0 99 dmx set slot values dmx_controller slave gt startAddress 1 slot_values true 39 40 Using DALI on the Controller Board This section will discuss how to use the DALI controller from application software looking at some of the main routines For a complete example see the end of the section Initialising the DALIHANDLE The public interface to the DALI software uses an opaque data type DALI HANDLE Application software should begin making a callto dali_ controller init to allocate a new handle Function Prototype DALI HANDLE dali controller init uint_16 inDeviceNumber In principle the software could support multiple DALI connections if the hardware allowed it Initialising the hardware After the DALI HANDLE has been initialised the application should call the routine
12. damage to the LED through over heating Diagnostics The Diagnostics window allows you to see the traffic exchanged between the controller and slave boards Packets are shown in an annotated form as follows Diagnostics lela File Edit Sending DMX512 SIP packet E startCode Oxcf SC_SIP E byteCount 0x18 control 0x01 checksumPreviousPacket 0x0000 sequenceNumber Ox5F universeNumber 0x01 processingLevel 0x00 softwareVersion 0x00 standardPacketLength 0x0000 numPacketsSinceSIP 0x0000 firstManufacturerID x6673 secondManufacturerID 0x0000 thirdManufacturerID 0x0000 fourthManufacturerID 0x0000 fifthManufacturerID 0x0000 reserved 0x00 sipChecksum 0x21 Sending DMX512 NULL Start Code packet startCode 0x00 SC_NULL Packet Data 0x00 5 E Output paused The DMX512 protocol requires that a NULL Start Code packet a standard DMX512 packet is sent at least once a second This can make it difficult to see the contents of the Diagnostics window because they keep changing so the Pause Resume button can be used The Pause function stops the window from updating it has no effect on the DMX512 traffic which continues to be generated 23 Software Overview The remainder of this document will describe the source code used to implement DMX512 RDM and DALI lighting control The software for the application consists of three parts 1 The LightingDemo application itself running on the PC
13. devices work it is possible to use a Freescale DALI controller with non Freescale DALI slaves and it means that a Freescale slave looks like a standard ballast to non Freescale controllers In order to convey chromaticity information the Freescale implementation uses a backdoor route to extend the command set The backdoor makes use of a standard DALI command DATA TRANSFER REGISTER and is invisible to non Freescale DALI devices Because DALI commands are only two bytes long all DALI slaves implement a Data Transfer Register DTR In order to program a setting such as the power on level of a ballast the DALI controller sends two 2 byte commands Store 99 in the DTR DATA TRANSFER REGISTER 99 Tell the addressed device to store the DTR as the power on level lt address gt STORE THE DTR AS POWER ON LEVEL 28 The backdoor command to set chromaticity information relies on the fact that setting the DTR to one value and then another without any intervening commands is both harmless and pointless No other DALI controllers are likely to do it and it has no effect on normal DALI slaves In order to send chromaticity information the controller sequences the DTR through a secret multi character backdoor key to alert the slave that a chromaticity command is coming It then uses the DTR to communicate the x y chromaticity coordinates to the slave See the routines dali _ send b
14. 0 158 0 116 0 130 0 183 0 742 The matrix contains thermal resistance values Note that the temperature of each LED junction does not just depend on the heat sink temperature and its own thermal resistance there is cross talk between the channels For example if the Green LED is being driven it causes the Red LED junction to heat up The Power figure for each LED is calculated as follows Power Forward Voltage x Forward Current x Duty Cycle 54 Because the Forward Voltage and Forward Current are fixed by hardware it is not necessary to do the complete multiplication every time Instead they can be used to compute a new version of the PM matrix PM so that the junction temperatures can be calculated by the following equation TJunction Red TJunction Green TJunction Blue TJunction White Duty Cycle Red Duty Cycle Green Tthermistor PM x Duty Cycle Blue Duty Cycle White
15. Blue p 128 0 255 White 0 0 255 All Off Model Luminus PhlatLight CBM 380 LED Controller Freescale Semiconductor Inc DMX512 Start Address 1 Current DMX512 Personality Direct power level control te Current DMX512 Footprint 4 slots freescale semiconductor The Remote Device Management RDM extension to DMX512 allows a slave device to have multiple personalities and the controller can instruct it to switch between them In the Freescale implementation the slave board has two personalities 20 a In the first personality the slave board only occupies a DMX512 footprint of one slot Standard DMX512 packets are used to send a luminance value in the range 0 255 corresponding to the 0 100 luminance discussed above In this personality colour information is sent using a manufacturer specific RDM packet bearing x and y chromaticity values This personality is used by the sRGB and CIE 1931 Colour Space options b The second personality allows the controller board and hence the LightingDemo application to drive the primaries of the LED directly In this personality each primary occupies one DMX512 slot The slot value in the range 0 255 can be used to vary the duty cycle of the PWM signal sent to each LED channel thus controlling the amount of power The slave software will still ensure that the LED is not driven at power levels which could damage it Sensor Display Using t
16. Controller board software can be built in a number of configurations e DMX controller DALI controller or both e Optional debugging e Code to run on the actual board or code running in the simulator option used by the LightingDemo application These build options are controlled by C pre processor macros The following are defined through the CodeWarrior C C Pre processor Target Settings panel a To enable disable DMX512 RDM support define DMX CONTROLLER 1 or undef DMX CONTROLLER b To enable disable DALI support define DALI CONTROLLER 1 or undef DALI CONTROLLER c To specify whether the code runs on actual hardware or in the simulator define CONTROLLER BOARD 1 or define SIMULATED BOARD 1 Additionally printf style debugging information can be turned on and off using the SUPPORT_DEBUGGING equate defined in the header file dali _and_dmx_types h 31 32 Using DMX512 RDM on the Controller Board This section will discuss how to use the DMX512 RDM controller from application software looking at some of the main routines For a complete example see the end of the section Initialising the DMX_HANDLE The public interface to the DMX512 software uses an opaque data type DMX_HANDLE Application software should begin making a call to dmx_ controller init toallocate a new handle Function Prototype DMX HANDLE dmx controller ini
17. LightingDemo Controlling High Power LEDs using DMX512 and DALI TI IMI ICIR O J IAIPIL LLL ey oe PS freescale semiconductor Copyright 2009 MicroAPL Ltd All rights reserved No part of this manual may be adapted or reproduced in any form without the prior written approval of MicroAPL Limited MicroAPL welcomes comments and suggestions These and any error reports should be sent via our web site http www microapl co uk lightingdemo MicroAPL is a trademark of MicroAPL Ltd Freescale is a registered trademark of Freescale Semiconductor Inc All other tradenames trademarks and registered trademarks are the property of their respective owners Version 1 0 6 December 2009 Simon Marsden MicroAPL Ltd Table of Contents WACOM UC ONda aE ade casteeecssbivadiad ARE AREKE tani diac EE EEE RE RER 5 Configuring the Boards errai sn naaar a aaae a aaae aa a ra AAAA r A AAKE EEEa e AA EAEEREN EIRE 6 Choice of DMX512 or DALI Protocol cccccccssssssssecsessssseesceseeeceeeeeeeeeeeeeseesaeeeaaeeasaeesssesssseseseeeeess 7 Specifying the type of LED wisiscscsiecsegdivtesscecansaanccccagacsters teeueevieauessbgageciessdPeavguendacedeeeveglasyt EEEE 8 Specifying a unique DMX512 RDM UID ccccccccesscccceessscececcsscceeeceeesseeeccesssasecececeaueeeeeeessateeees 8 Installing the LightingDeMo Application cccccccceseccceccceceeeecceeeeaaeeaea
18. P UP e Query commands for which a response is expected e g QUERY STATUS e Special commands sent to all devices e g PROGRAM SHORT ADDRESS only the ballast which has been previously selected responds a For the first three categories the two byte DALI command format is YAAAAAAS XXXXXXXX where wn ll 0 Direct power level S 1 DALI command If the command is sent to an individual ballast y 0 and AAAAAA ballast short address 0 63 If the command is sent to a group of ballasts y 1 and OOAAAA group address 0 15 To send these commands application software can use dali send normal command Function Prototype DALI ERROR dali send normal command DALI HANDLE inHandle uint_8 inAddress uint_8 inCommand For example to send a direct power level command to the individual ballast with short address 5 addressByte 5 lt lt 1 dali send normal command dali controller addressByte 100 To send the command OFF to the same ballast addressByte 5 lt lt 1 1 dali send normal command dali controller addressByte DALI OFF b If a response from the DALI slave is expected the application should immediately follow this up with a callto dali wait response Function Prototype DALI ERROR dali wait response DALI HANDLE inHandle uint_16 outResponse Note that DALI responses are only ever 8 bits but for certain DALI commands the slave sends no response a
19. TVIEW oerein aeieea RAER r E REEE RAE a AAAA E 23 Bs Ni o TEE E EAT E E A E A T 23 MOM Oly FOOUDMIAE wiicest cee x cow needatetatlentes ee aR EE E EEEE eed a a a i 24 DMX512 and RDM implementation on the Controller and Slave Boards ccccccccceeeeeseeeseaeeees 25 Endian Depende ncle ssi c sscssedeceaeacndedtessscansuersedetes sagedaavadnee saddadsdeaeeds tbat daanuesidedadvesndncixseeeecaaueaces 26 DALI implementation on the Controller and Slave Boards c scsssssssssseesseeceeeceeeeeeeesaeeesaeeaea 27 Controller Board SoftWare soiets aane aa a a EESE E eaea aa EEES 29 MOX on the controller board ceccccsessccceeeeeeccceeeeeeeeaeeeeeeaaaaeeeeseaaeeeeeeesaaeeeeeesaaaeeeeeeeeaeeeeeeae 30 Debugging information for the controller board cccccccccssesssssseeesessesesssseecceeeceeeeeeeeeeeeeaeeesaaaaaa 30 C Pre processor Definitions for the controller DOArC ccccccccceccceceeeceaeeeeeeesseesssseseseeeseeseeeeeeees 30 Using DMX512 RDM on the Controller BOard cccccccccssesscccceessseceeeesseeeeceeeseeeecesssaeeceeeeeseeeeeeees 32 Initialising the DMX_HANDLE ccecccceececeeeeeeeeeeeeeaeeeseaeeaseeaeeeeeeeessseeeeeceeeeeeeeeeeeeeeeeeeesaaaaaaa 32 Initialising the hardware smnaintean aa e E a TRA nes eae EE 32 RDM DiSCOVENY lt 2 ison a a a i E E a ES 32 Allocation of DMX512 Start AddresseS eessesessesessserrsssrrisssssrrsssstrtssstteresttritesssreressssseses 34 Sending data in DMX512 NULL Sta
20. ULL if no such record exists DMX SLAVE F R ECORD dmx find nth _ slave DMX HANDLE inHandle int inIndex 34 Allocation of DMX512 Start Addresses In order to communicate with a slave through a DMX512 NULL Start Code packet the slave needs to be assigned a DMX512 Start Address The routine rdm_allocate dmx addresses will use RDM to allocate start addresses to any slave that doesn t have one ensuring that no overlapping start address footprint values are present Function Prototype DMX ERROR rdm allocate dmx addresses DMX HANDLE inHandle Sending data in DMX512 NULL Start Code packets The DMX512 protocol requires that a NULL Start Code packet is sent at least once a second It is the application s responsibility to call dmx send NULL start code packet periodically to ensure that this requirement is met Function Prototype DMX ERROR dmx send NULL start code packet DMX HANDLE inHandle This routine will also cause SIP packets with checksum information to be sent if this option is enabled The slot values that are sent in a NULL Start Code packet are buffered locally by the controller To change one or more slot values call the dmx_set_slot_ values routine Function Prototype DMX ERROR dmx set slot values DMX HANDLE inHandle uint_16 inStartAddress uint_16 inNumSlots uint 8 inValues boolval inImmediateUpdate System Information Packets SIPs T
21. ackdoor command in the controller and handle dali backdoor command in the slave for further details Controller Board software The following screen snapshot shows the files used to implement the application on the controller board If you are using the reference software as a basis for a new stand alone lighting controller design it is anticipated that you will a select either DMX512 or DALI and remove the unwanted files and b concentrate most effort on re writing the code in the files usb interface c and pce_interface c to implement the functionality of the new controller r controller_board mcp Lo Int Flash Debug ia y B 5 P A Files Link Order Targets E3 Source 35998 E main c 542 ED support c 5664 HEA dmx512 14178 i iE dms_controller c 8704 EA dmx_support c 2134 EA dmx_debug c 2326 i off dms_coldfire c 1014 JE dali 8864 jf dali_controller c 4386 EA dali_support c 1248 ED dali_debug c 908 2322 4E usb 6750 ED usb_interface c 2258 ff pe_interface c 4492 Linker Files 0 of intsram Ict n a ff intflash lef n a H E Runtime Libraries 234K fi C_4i_CF_Std4BI_MSL a 216K E C_4i CF_Std Bl_Runtime a 4876 ARS fp_coldfire o 13448 44 MOX Libraries 180K of m52259evb_lib txt n a EB mqx_da 98K ARB m52259evb_d a 83420 AB max a n a ARE m52259evb a n a oe BEEBE BEB he BREE ERE de Ma da da da M die eee eee eee oe
22. al XML description of an LED is as follows 49 lt Luminus PhlatLight CBM 380 gt lt led gt lt id gt 2 lt id gt lt name gt PhlatLight CBM 380 lt name gt lt manufacturer gt Luminus lt manufacturer gt lt max_current gt 32 0 lt max_current gt lt board_type gt 1 lt board_type gt lt temperature matrix gt 0 635 0 156 0 158 0 091 0 169 0 595 0 103 0 126 0 158 0 094 1 113 0 158 0 116 0 130 0 183 0 742 lt temperature matrix gt lt channel gt lt l Red Luminus PhlatLight CBM 380 gt lt color gt Red lt color gt lt pwm_channel gt 1 lt pwm_channel gt lt forward current gt 12 0 lt forward_current gt lt forward_voltage gt 2 3 lt forward_voltage gt lt flux gt 700 0 lt flux gt lt ciel931 x gt 0 701 lt ciel1931_ x gt lt ciel931 y gt 0 299 lt ciel931_ y gt lt max_temperature gt 80 lt max_temperature gt lt channel gt other channels follow lt led gt lt id gt Software on the slave board reads the two hardware switches labelled 10 s and 1 s to obtain an LED type in the range 1 99 This is matched against the lt id gt tag to determine which type of LED is connected lt max_current gt For some LED packages driving all the LED channels at 100 duty cycle will exceed the maximum rated current for the LED even though the individual channels are all in range For example the Luminus PhlatLight CBM 380 allows 12A 12A 8 1A and 9A for the Red Green Blue and White cha
23. alise the controller e Perform an RDM discovery process e Send an RDM packet to ask the first slave for its software version string e Senda NULL Start Code packet For clarity some error checking has been omitted include dmx h include dmx controller h include dmx support h void dmx demonstration void DMX HANDLE dmx controller RDM UID UID DMX ERROR errcode DMX SLAVE RECORD slave int attempt RDM PACKET tx packet rx packet uint 8 slot_values 1 Initialise controller UID manufacturerID FREESCALE ESTA MANUFACTURER ID UID deviceID 0x10000000 dmx controller dmx controller init 0 1 UID if dmx controller NULL return Initialise controller hardware dmx device init dmx controller 38 ifdef SUPPORT DEBUGGING Set debugging level dmx _set_ debug level dmx_controller DEBUG PACKETS endif Say we want to use checksumming of NULL Start Code packets for extra reliability sip set _checksumming dmx controller true Perform RDM discovery process to find out which slaves are present rdm discovery dmx_controller true Allocate DMX512 start addresses to any slaves without one rdm_allocate dmx addresses dmx controller Ask the first slave what its software version is slave dmx_find_nth_ slave dmx controller 0 if slave NULL return for attempt 0
24. ccececeeeeeeeeeaaeeaeeesseessssesseseseeeeeeeeeeess 46 Mini DALI version of the slave SOftWALEC ie eeecsceeeeeeeeeeeeeeeeeaaeeeeeeeaaeeeeeeeeaeeeeeeesaaaeeeeeeeeeeeeeeneea 47 LED GOON iene A ten E et E heehee aac teh edn ct ee el hited A AA 48 XME Descriptionsiof LED Types aiei riire l OaE NEEE EEE EEE EEA 48 Regenerating the XML File niers iinne a AA E EAE Ea Ea a ERNE 50 COlOUF ETL a A E TEA E EE AE OEN 51 Adjusting Duty Cycles ierre eaea ri iit k i a E OE EE EA EE 52 Temperature Regulation n encsi nni E aa R EE a RR 53 Introduction Safety Warnings Do not look directly at high brightness LEDs unless they are fitted with a suitable diffuser Some makes of LED are very bright and could cause damage to your eyes if you look at them for a long period The high power version of the High Brightness LED Driver board uses large currents For example the Luminus PhlatLight CBM 380 can take up to 32A Handle with care This application note is written to accompany the Freescale Semiconductor Inc reference design for high brightness LED control and describes an application called LightingDemo LightingDemo allows you to control one or more high brightness LEDs using a PC It demonstrates how the Freescale Lighting Controller board can be used to control one or more LED slave boards using either of two industy standard protocols DMX512 RDM and DALI Full source code of the software running on the controller and LED boards is provided
25. d White Each colour or channel is controlled by a separate power stage on the slave board The fully on current and voltage used by the LED channel are determined by hardware on the board including current limiting resistors to prevent LED damage Colour control is achieved by using a PWM signal to control the channel current varying the duty cycle in order to vary the brightness of the LED The topic of colour balancing is discussed in more detail below XML Descriptions of LED Types In order to perform colour balancing and thermal regulation the slave board software needs to know the characteristics of each LED package This information is stored in an easy to maintain XML format stored in Flash on the slave The same XML description is also used by the LightingDemo application on the PC for two purposes e When using the DMX512 RDM protocol the controller board is able to interrogate the slave in order to determine the LED name manufacturer number of primaries etc This information is passed on to the LightingDemo application running on the PC However this is not possible in DALI because the DALI protocol only supports single byte responses from slave to controller For DALI only the LightingDemo application reads the information directly from its own copy of the XML file e When simulating a controller board and slave boards in software on the PC the XML file is used to determine the LED characteristics Atypic
26. e errcode rdm send packet inHandle tx packet if errcode ERR _ DMX OK Any response errcode rdm_get_ response inHandle tx packet amp rx packet false Note It is important that software follows the sequence above A successful call to rdm_send_packet will complete with interrupts disabled The expectation is that it will be immediately followed by a call to rdm_get_response which re enables interrupts on completion a The rdm_make_ command routine takes the specified arguments and builds an RDM packet ready for transmission The packet is not quite complete at this stage because checksum information is not added until rdm_send_packet is called 36 Function Prototype RDM PACKET rdm make command DMX HANDLE inHandle RDM UID inDestination uint_16 inSubDevice uint_8 inCommandClass uint 16 inParameterID void inParameterData uint 8 inParameterLength The parameters inCommandClass and inParameterlID specify the RDM command to send for example GET COMMAND and SLOT DESCRIPTION For commands which require additional data the data is specified through the inParameterData and inParameterLength parameters If no additional data is required you can specify NULL and 0 Example slotNumber 1 tx packet rdm_make command dmx controller slave UID subDevice GET COMMAND SLOT DESCRIPTION amp SslotNumber 2 The rdm_make_ command routine r
27. e wavelength colours in the range 380 700 nanometres 18 Note that not all colours in the coloured area can be accurately shown on the computer screen or the printed page The white triangle shows the gamut of the sRGB Colour Space the three corners of the triangle correspond to the Red Green and Blue primaries used by sRGB and colours outside the triangle cannot be shown accurately on screen Similarly the black triangle shows the gamut of a typical three colour LED in this case a Philips Lumileds Luxeon Rebel Some colours that are within the gamut of the LED are outside the gamut of sRGB and vice versa Given two corners of a triangular gamut any colour on the line connecting the corners can be produced by a combination of the two corresponding primaries Any colour within the triangle can be produced from some combination of all three primaries The LightingDemo application allows you to specify a colour by selecting its x y chromaticity coordinates and a Y luminance value For the luminance the possible values range from 0 100 where 100 is the maximum brightness that can be achieved for the specified colour This is affected by a number of considerations e Different LED packages from different manufacturers are capable of producing different levels of brightness e The luminous flux produced by the different primaries in an LED package varies For example the green primary is typically much brighter than blue
28. eassseseeeeesseeeeseeeeseeeeeeeeeeas 9 REQUIFEMENUS wenes a eins a a ata a a a ae neers 9 Installing rom CD 62 sccseesvevedsciadiaeccudecctiaseadeueadehsd dedaduebhsedevedsaindcddadadwadsbaeseesanendsdsdsveadecash Cee EEEE 9 Installing the LightingDemo application MANUAILY cccccccccsssscsssessseessseeesceseeceesceeeeeeeeeeeeeeaeeeaea 9 Installing the USB Driver manually ccccccceccccceeeecseeeeeaesseeesseessseeeeceeeeceeeeeeeeeeeeseeeesaesaaaaaaaaees 9 Using the LightingDemo Application cccssseesssessseseeecceeceeeeceeeeeeeeaeeeaaaeesseeeseeesseeeeseeeeeeeseeeeseess 13 De Wice DISCOVERY irinenn eener centar an arae rea sous Ee reaa i Dea E Rrra AEETI 13 Failure to see the Controller Board o eeecccceeeessceeeeeeeeeeeeeeeeaaeeeeeseaaeeeeeeeeaeeeeeesaaaeeeeeseaeeeeeneeea 13 Failure to see the Slave Boards ccccseccceeeesencceeeeeeeeneeeeeeaaaeeeeeseaaeeeeeeeeaaaeeeeeesaaaeeeeeeeaaeeeeeeaes 14 DEVICE COMM sueann ai ara bekouvten Geb ve aa Ea Eaa Aata eaa Ei ESNA 15 sRGB Colour Space Control cccccccccccccceccseeeeeeeeeseeesseeseeeeeeeceeeeeeeeeeeeeeesesseeeeeeeseeeseeseseseeseeseeeeeeess 16 CIE1931 Colour Space Control essseeseesrresssesssssrssnnnenrsesrrenrrestresrressssssssnsssnnnnanseennenrreereesreene 16 Direct Control siorse ERARE KARA E ARERR AA A EEEE ERAR 19 Sensor DISPIAY sasesscces ceccues ea ea EE a i a a a inbi esa 20 DETAN e ea EE EEN N EE EESE E A SE OEE EE EAEN 21 SoftWare OVE
29. eck whether the USB driver installed correctly See the section Installing the USB Driver manually for more information The simulator is for use in situations where you don t have a controller board but are interested in evaluating the LightingDemo software The controller board and slave boards are simulated in software The simulator allows you to choose between DMX512 and DALI protocols investigate the operation of the LightingDemo application and view the DMX512 DALI traffic sent over the simulated connection between controller and slaves Failure to see the Slave Boards If the LightingDemo application can see the controller board but there is a problem with the slave boards the list of devices will be empty f f Lighting Demo 2 File Edit Help DMX512 Devices Search completed OK No LEDs found Repeat Search for Devices freescale semiconductor 15 You should verify that the slaves are connected properly and that the Mode switches on the slave boards are set correctly for DALI Mode 1 or DMX512 Mode 2 In the case of DMX512 you should also a Make sure that the chain is properly terminated The last slave board should have a terminator installed on JP1 and the other slaves should have the terminator removed b Make sure that the switch on the slave board marked 100s is set to a unique value for each board present In the case of DALI make sure that the cont
30. es would cause it to overheat 53 Adjustment takes place in the routine led_ update power levels which is also responsible for programming the PWM module and controlling the Enable signals to the LED power stages Temperature Regulation Driving too much current through an LED for too long can cause it to overheat shortening the working life of the LED or even damaging it In order to avoid this it is necessary to monitor the temperature and reduce the power if necessary Each channel of a multi colour LED package will have a maximum recommended junction temperature For example the PhlatLight CBM 380 maximum junction temperature for Red is 80 C These values are specified by the lt max_ temperature gt tags in the XML file The junction temperatures of an LED package cannot be measured directly Instead they must be calculated by measuring an accessible temperature e g the heat sink temperature using a thermistor and then calculating the junction temperatures using the power dissipation for each channel and a 4x4 matrix PM TJunction Red Power Red TJunction Green Power Green Tthermistor PM x TJunction Blue Power Blue TJunction White Power White The PM matrix is the power to temperature matrix as recommended by the LED manufacturer and read from lt temperature matrix gt tag inthe XML file For example for the Luminus PhlatLight CBM 380 the matrix is 0 635 0 156 0 158 0 091 0 169 0 595 0 103 0126 0 158 0 094 1 113
31. eturns a pointer to the RDM packet Note that memory for this packet is allocated within the DMX_HANDLE structure There is no need for the application to release the memory explicitly i e don t call free or a similar routine Equally be aware that a new call to rdm_make_ command will overwrite any data stored by the previous call b The rdm_send_packet routine is used to send an RDM packet over the DMX512 connection Function Prototype DMX ERROR rdm_send packet DMX HANDLE inHandle RDM PACKET inPacket c The rdm_get_ response routine is used to wait for the reply to an RDM command Function Prototype DMX_ ERROR rdm_get_response DMX HANDLE inHandle RDM PACKET inPacketSent RDM PACKET outPacketReceived boolval inAllowNACK 37 Notice that the second parameter is a pointer to the packet to which a reply is expected The routine uses this information to make sure that the reply matches what s expected in terms of RDM packet number reply type etc A pointer to the received packet is returned via the third parameter This may be NULL on error Like rdm_make_ command there is no need to free the received packet after it is finished with The memory is allocated internally to the DMX controller and will be reused for the next received packet Example Code The following code shows a more complete example using the DMX controller software It includes the following steps e Initi
32. he DMX512 Remote Device Management RDM protocol it is possible for the controller board to monitor the on board sensors on the LED slave board The sensors available depend on the type of slave board and the LED package used Low power boards only support a thermistor whereas high power boards also allow the current consumption to be monitored 21 n Lighting Demo 2B Eile Edit Help sRGB Colour Space CIE 1931 Colour Space Direct Control DMX512 Devices PhlatLight CBM 380 Thermistor 27 5 C Luxeon Rebel RGB CW Junction Ti ture 1 452 Luxeon Rebel RGR aN unction Temperature 1 Red gt Junction Temperature 4 Green 32 2 C Junction Temperature 2 Blue 31 9 C Junction Temperature 3 White 30 7 C Total current to LED 12 3 A Current for Power Stage 1 Red 12 2 A Current for Power Stage 4 Green 0 0 A Current for Power Stage 2 Blue 0 0 A Current for Power Stage 3 White 0 0 A Model Luminus PhlatLight CBM 380 LED Controller Freescale Semiconductor Inc DMX512 Start Address 1 Current DMX512 Personality Direct power level control eo fr eescale Current DMX512 Footprint 4 slots semiconductor The thermistor reading measures the temperature of the heat sink Software on the slave board uses this value together with the power consumption to calculate the junction temperature s within the LED package and so regulate the power in order to prevent
33. he Freescale slave board software never sends this type of response If required it can be handled T TYPE ACK TIMER meaning that the slave isn t yet ready to respond in application code or by a simple modification to the controller routine rdm_get_ response Endian Dependencies DMX512 SIP and RDM packets use big endian byte ordering for integer values which are more than one byte wide The MCF52259 processor used on the controller board also uses big endian byte ordering conventions as does the CodeWarrior compiler used for the slave board However to make the software as portable as possible all multi byte accesses are done through macros read big endian ul6 read big endian u32 store big endian _ul6 store big endian u32 For example the following code reads a 32 bit unsigned value and replaces it with another value read big endian u32 pointer store big endian _u32 pointer value l 27 DALI implementation on the Controller and Slave Boards On both controller and slave board DALI data is sent and received using a GPIO port Data is sent using a routine which tightly controls the timing of the generated bi phase signal to match the DALI specification Data is received by using an interrupt service routine which over samples the signal The signal has a frequency of 1200 bits per second but it is bi phase encoded so there are 2400 phases per second The interrupt frequency is 9600 sa
34. he use of SIP packets improves the reliability of DMX512 by adding checksum information but slightly reduces the maximum throughput You can control the generation of SIPs using the sip _set_checksumming routine The use of SIPs is recommended in most situations Function Prototype void sip set _checksumming DMX HANDLE inHandle boolval inEnableDisable 35 Changing the RDM personality of a slave device As a convenience the routine rdm_set_personality can be used to change the current personality used by a slave device Note that personalities are numbered from 1 upwards in RDM Function Prototype DMX ERROR rdm_set_ personality DMX HANDLE inHandle DMX SLAVE RECORD inSlave uint 8 inPersonality Specifying CIE1931 Colour Space values The routine rdm_ set chromaticity allows the application to control the chromaticity and luminance of a slave device It takes an x y chromaticity coordinate and a Y luminance value as arguments The luminance argument is in the range 0 0 to 1 0 to request 0 100 of the maximum lumens that the slave can deliver at the requested chromaticity Function Prototype DMX ERROR rdm_set_ chromaticity DMX HANDLE inHandle DMX SLAVE RECORD inSlave double in x double in y double in Y Sending other RDM commands Application software can send other RDM commands to a slave device by using the sequence tx packet rdm_make command inHandl
35. ication These build options are controlled by C pre processor macros The following are defined through the CodeWarrior Compiler for HCO8 Target Settings panel a To enable disable DMX512 RDM support define DMX SLAVE 1 or undef DMX SLAVE b To enable disable DALI support define DALI SLAVE 1 or undef DALI SLAVE c To enable the mini DALI version define MINI DALI 1 d To specify whether the code runs on actual hardware or in the simulator define SLAVE BOARD 1 or define SIMULATED BOARD 1 Mini DALI version of the slave software The slave software can also be built in a mini DALI version which has a very small memory footprint 8K of Flash and 512 bytes of RAM for the complete application This version allows a monochrome LED to be controlled using DALI commands Compared to the full slave software it lacks the following features e Colour control e Thermal regulation e Control via the DMX512 RDM protocol instead of DALI e XMLdescription of LED characteristics All of the source files used by the mini DALI version are the same ones used for the full version with the exception of two files main c is replaced by mini dali main c 48 led_hes08 c is replaced by mini dali hes08 c A separate CodeWarrior project is provided for building the mini DALI version LED Control A typical LED package consists of three or four separately controllable colours e g Red Green Blue an
36. lips Lumileds Luxeon Rebel RGB Cool White 2 Luminus PhlatLight CBM 380 This information is used to determine how to drive the LEDs maximum current colour balance etc Note The values above correspond to the lt id gt tag in the XML descriptions of LED characteristics stored on the slave board Specifying a unique DMX512 RDM UID Every board which implements the Remote Device Management RDM protocol extension to DMX512 must have a Unique ID UID The UID is a 48 bit number consisting of a 16 bit ESTA assigned Manufacturer ID and a 32 bit device ID If you are building a product based on the Freescale Reference Design you should complete the following steps 1 Apply to ESTA for a unique Manufacturer ID 2 Ensure that every device you manufacture has a unique device ID Two devices with the same UID on the same DMX512 lighting circuit will fail to operate properly For the Reference Design the device portion of the UID on the slave boards is assigned a value from 0 9 based on the ten way switch labelled 100 s You must make sure that every board has its 100 s switch set to a different value For the Reference Design the controller UID is hard coded Note Use of the 100 s switch to assign the slave board UID is done here for convenience as is the hard coded UID used by the controller board For a shipping product it s not an acceptable solution you need to ensure that each device manufactured has a unique ID st
37. low you to walk the slave list d Return count of the number of slave records found uint 32 dali count slaves DALI HANDLE inHandle e Return pointer to first slave record or NULL if no slaves found DALI SLAVE RECORD dali_ slave list DALI HANDLE inHandle f Return pointer to Nth slave starting from 0 or NULL if no such record exists DALI_SLAV r RECORD dali_ find nth slave DALI HANDLE inHandle int inIndex During the DALI discovery process the controller will also allocate a DALI Short Address 0 63 to any slave which does not have one Specifying CIE1931 Colour Space values The routine dali _ set chromaticity allows the application to control the chromaticity and luminance of a slave device It takes an x y chromaticity coordinate and a Y luminance value as arguments The luminance argument is in the range 0 0 to 1 0 to request 0 100 of the maximum lumens that the slave can deliver at the requested chromaticity Function Prototype DALI ERROR dali_set chromaticity DALI HANDLE inHandle DALI SLAVE RECORD inSlave double in x double in y double in Y Sending other DALI commands The set of commands defined by the DALI protocol can be divided into four categories 42 e Direct commands instructing the ballast to switch to a specified power level 0 255 e Normal DALI commands for which a response is not expected e g OFF STE
38. mple per second i e 4 samples per phase Software compares the samples to ensure that they match Because the received signal may vary slightly in frequency or duty cycle software considers a match of 3 4 or 5 samples to be acceptable The DALI protocol is really designed for controlling single colour lights which it calls ballasts The controller can instruct individual ballasts to light up change to a specified power level fade up or down etc Ballasts can also be addressed as groups instead of individually or added to pre set scenes The DALI protocol also includes a means for the controller to discover which DALI slaves are connected DALI commands from controller to slave are two bytes long and replies from slave to controller are a single byte Many commands don t result in a reply Each DALI slave has a unique Short Address in the range 0 63 The DALI implementation used by the controller and slave is standard in all respects except for one extension the standard DALI protocol does not include any way for a controller to instruct an LED to change colour rather than brightness so a way is needed to achieve this In the Freescale implementation the normal DALI commands affect the brightness of the LED in CIE 1931 colour space terminology the power level corresponds to the Y luminance In fact DALI uses a logarithmic dimming curve so the value is derived from the log of the luminance Since this is the way all DALI
39. new hardware has been attached and will look for a suitable driver If you are installing from CD the process should be automatic but if you are installing from disk you need to use the following steps 1 Windows will ask whether you want to install the driver 7 Found New Hardware x Windows needs to install driver software for your Unknown Device Locate and install driver software recommended Windows will guide you through the process of installing driver software for your device gt Ask me again later Windows will ask again the next time you plug in your device or log on Don t show this message again for this device Your device will not function until you install driver software 2 If you are installing from a downloaded package Windows will first look in standard locations for the driver before giving you the opportunity to specify the driver folder This may take several minutes k J Driver Software Installation Installing device driver software l EE Unidentified Device Searching Windows Update 11 3 Eventually you will be prompted to provide a location for the driver software manually Unknown Devic Windows couldn t find driver software for your device gt Check for a solution Windows will check to see if there are steps you can take to get your device working Browse my computer for driver software advanced i Locate and install driver
40. nk Typical DALI Configuration USB cable DALI cable Controller Slave Board Slave Board Board 12V Power 12V Power Supply Supply Choice of DMX512 or DALI protocol The LightingDemo application allows you to control the high brightness LEDs using either the DMX512 or DALI protocol The choice of which protocol to use is determined by the settings of switches on the Controller and Slave boards Controller Board Set the DMX DALI switch appropriately Slave Board Set the Mode switch as follows 1 i DALI 2 DMX512 Notes This choice determines whether the controller board talks to the slaves through the DMX or DALI interface It does not affect the connection between PC and controller board which uses a simple proprietary message format sent over USB For demonstration purposes you can connect the boards together using both DMX512 and DALI cabling You can switch between DMX and DALI at any time without re booting the boards or re launching the LightingDemo application simply by changing the switches on the boards After changing the switches repeat the device discovery process using the Repeat Search for Devices button in the LightingDemo application s Devices window Specifying the type of LED There are two ten way switches marked 10 s and 1 s on the slave boards Together these allow you to specify one of 99 different types of high brightness LED At the time of writing the possible values are 1 Phi
41. nk Cycone Pow I y BS Oy Files Link Order Targets Code Data CE3 Sources ef main c ED support c EA led_descriptions asm Eq dm 512 E dmx_slave c if dmx_sub_device c E dmx_support c EA dmx_debug c off dmx_hes08 c Ea dali H E dali_slave c ff dali_support c EA dali_debug c bef dali_hes08 c Eg led device of led c ff led_hes08 c E4 Includes 0 eof derivative h 0 EA mce13213 h 0 Libs 57183 ED ansifs lib 57183 ff me13213 0 E Project Settings 132 HE3 Startup Code 132 Soff Start8 c 132 24 Linker Files 0 EA burner bbl n a Project prm n a ect map n a ooon moooneoTcce oe ooo BEE ka ka ha ha ha ka ha ha ka ka ha ha ha eee ee eee Mie Mie Mea Mia Ma 22 files 93700 The ansifs lib Library The application makes use of floating point data types to calculate colour balancing parameters and hence requires the support of the ansifs lib library which incorporates software floating point routines In the ansifs 1ib library the double data type is represented in the 4 byte IEEE754 format C Pre processor Definitions for the slave board The Slave board software can be built in a number of configurations 47 e DMX512 slave DALI slave or both e Amini DALI version which occupies only 8K of Flash and 512 bytes of RAM e Code to run on the actual board or code running in the simulator option used by the LightingDemo appl
42. nnels individually but only allows a maximum of 32A in total A value of 0 can be specified if this problem does not exist lt board_type gt Possible values are O for the low power board and 1 for the high power board This information is used by the software to determine how to control the Enable signals to the board s drive stages 50 lt temperature_matrix gt This matrix is used in temperature calculations See the section Temperature Regulation for more details lt channel gt The channel tag should be repeated once for each independently controlled LED primary in the package The channels should be listed in the same order as they will occur in the DMX512 footprint lt pwm_channel gt Specifies which of the PWM channels is used to control this device Possible values are 1 4 for TPM2CH1 TPM2CH4 This information is used in the routine led update power levels lt forward_current gt Specifies the forward current in Amps which the LED channel uses at 100 PWM duty cycle lt forward_voltage gt Specifies the forward voltage in Volts corresponding to the forward current value The software uses these two values to calculate power dissipation at 100 PWM duty cycle in order to perform thermal regulation lt flux gt Specifies the luminous flux in Lumens produced at 100 PWM duty cycle This information is used for colour balancing lt cie1931_x gt and lt cie1931_y gt Specify the x y ch
43. ored in Flash Installing the LightingDemo Application Requirements The LightingDemo application runs under 32 bit versions of Windows XP or Vista It requires the NET framework version 3 0 or later which is always present under Vista but may require installing under XP Installation of the LightingDemo application consists of two parts installing the application and installing the USB driver The easiest way is to install from CD using the following steps Installing from CD 1 Start with the controller board not connected to the PC i e do not plug in the USB cable at this stage Insert the installation CD This should cause the installer program to launch automatically 3 When prompted to do so by the installer connect the USB cable This should cause Windows to recognize that new hardware has been attached 4 Windows will locate the USB device driver on the CD and install it automatically 5 Continue with the installation of the application If you do not have the NET framework installed the installer will prompt you to install it You need to be connected to the net if a download of the NET framework installer is required Installing the LightingDemo application manually If you are installing the LightingDemo application from an electronic download instead of CD you can run the installer by launching setup_freescale lcb exe Installing the USB Driver manually When you connect the USB cable Windows will recognize that
44. p DMX512 Devi sRGB Colour Space CIE 1931 Colour Space Direct Control Sensors evices PhlatLight CBM 380 Luxeon Rebel RGB CW sat Luxeon Rebel RGB CW Chromaticity coordinates i x 0 3368 i y 0 5400 Luminance Y 50 1 Q a a g a E ao 0 100 Model Luminus PhlatLight CBM 380 LED Controller Freescale Semiconductor Inc xy DMX512 Start Address 1 Wa Current DMX512 Personality Colour space control op e freescale Current DMX512 Footprint 1 slot To discuss the CIE 1931 Colour Space we must first define some terms Consider two colours like White SRGB 255 255 255 and Gray 128 128 128 In fact these are normally considered to have the same tint but different brightness To use more formal language White and Gray have the same chromaticity but different luminance The CIE 1931 colour space is an attempt to separate the specification of colours into a chromaticity component and a luminance component Colours are specified in the form xyY where x y are the chromaticity coordinates and Y is the luminance You may also see colours specified in the form XYZ which is closely related to xyY The XYZ values are known as the tristimulus values The diagram below shows the possible chromaticity values x and y from 0 to 1 The coloured horse shoe shaped area represents all the colours which the human eye can see The outer curve is the known as the spectral locus and shows singl
45. r hardware dali_device_ init dali_controller ifdef SUPPORT DEBUGGING Set debugging level dali_set_debug_ level dali_controller DEBUG PACKETS endif Perform DALI discovery process to find out which slaves are present dali discovery dali_controller Ask the first slave what its device type is slave dali find nth slave dali_controller 0 if slave NULL return for attempt 0 attempt lt 3 attempttt Send QUERY DEVICE TYPE command addressByte uint_ 8 slave gt shortAddress lt lt 1 1 errcode dali send normal command dali controller addressByte DALI QUERY DEVICE TYPE if errcode ERR DALI OK continue Any response errcode dali wait response dali_controller amp response if errcode ERR DALI OK Do something with the device type information here break 44 Send direct power instruction to first slave addressByte uint 8 slave gt shortAddress lt lt 1 errcode dali send normal command dali controller addressByte 45 100 46 Slave Board Software The following screen snapshot shows the files used to implement the application on the slave board If you are building a product based on this software you will probably want to remove either the DMX512 or DALI code as appropriate e slave_board mcp 2 8 gt PaE Matii
46. r which devices are connected to the DMX512 network The application software on the controller board implements both DMX512 with SIP support and RDM RDM is used to find out which slave devices are connected ask them for detailed information about capabilities and assign DMX512 start addresses A DMX512 RDM slave consists of a Root device and optionally one or more sub devices The slave board software implements one sub device used to control a single multi colour LED package In principle the software could easily be adapted to support multiple sub devices for example multiple independent white LEDs 26 The DMX512 RDM implementation on the slave boards supports two RDM personalities a PERSONALITY xyY CONTROL When configured via RDM to use this personality the slave board has a footprint of a single DMX512 slot The controller uses the slot to send a CIE 1931 Y luminance value 0 255 and sends the x y chromaticity values using a separate RDM command b PERSONALITY DIRECT CONTROL In this personality the slave board has a footprint of up to four DMX512 slots one for each channel that the LED supports For example an LED with three primaries Red Green and Blue will have a footprint of three slots The values in the DMX512 slots are in the range 0 255 and correspond to 0 100 duty cycles Note that the controller software doesn t perform any special handling for RDM responses from a slave sent with REPONS T
47. roller board has the DALI power supply connected The board itself is bus powered from the USB connection but the DALI interfaces requires a separate power supply Device control Once the device discovery process has successfully completed you can select a device from the list shown at the left of the LightingDemo window Depending on which protocol you are using the following options are present e sRGB Colour Space control e CIE 1931 Colour Space control e Direct control For DMX512 this option allows you to control the individual colours of a multi colour LED directly This option is not present for DALI e Sensor display For DMX512 this option allows you to monitor the on board sensors on the slave board This option is not present for DALI The last two options are not available for DALI because the protocol is much less sophisticated Using DMX512 multi byte RDM packets can be exchanged with a slave for example to inquire about sensor data By contrast DALI is limited to two byte messages from controller to slave and one byte replies 16 sRGB Colour Space Control The sRGB Colour Space is probably the most familiar to users because it s a standard colour space used with computers A colour defined in the sRGB space has three components Red Green and Blue Each of these is typically represented by an 8 bit value in the range 0 255 leading to a 24 bits per pixel representation of colour For example a pure red i
48. romaticity coordinates of the LED Both values are in the range 0 0 1 0 This information is used for colour balancing lt max_temperature gt Specifies the maximum junction temperature for the LED channel See the section Temperature Regulation for more details Regenerating the XML File The XML descriptions are held in a source file led_descriptions xm1 which needs to be stored in Flash on the slave board Unfortunately the standard version of CodeWarrior for the slave board cannot include an arbitrary binary file you need to buy a bean to let you do this so some way is needed of including the XML descriptions in the build The solution used here is to use a separate utility to convert the XML file into an assembler source file led_descriptions asm containing ASCII strings e g 51 dep m lt id gt 1 lt id gt dc b lt name gt Luxeon Rebel RGB CW lt name gt dc b 7 lt manufacturer gt Philips Lumileds lt manufacturer gt The utility is a small exe program that runs at the Windows command prompt make xml_asm lt XML file gt lt assembler file gt Full source code of the utility is included in the xml_ utility folder Colour Balancing Colour balancing is performed by the routine led _ convert xy to_levels The CIE 1931 Colour Space chromaticity coordinate x y and luminance value Y are related to the equivalent XYZ tristimulus values by the following equations x Y X Y Z y yY X
49. rt Code packets cccccccccceccccceeeeseeeeeeeesseesssssssseseseeseeeeseees 34 System Information Packets SIPS cccccccccccccssssssscceeeseeeeceeeeeceseeeseeeeeeeeeeeeeeseeseseeeeseaaaeeeeeeeeeees 34 Changing the RDM personality of a slave device ccccccceecccceceeeceeeesaaeeaeeesseessssseseeseeeeseeeeeeess 35 Specifying CIE1931 Colour Space ValUCS cccssssesssssscssecccceccececeeeeeeeeaaeeaassesseesseasssssseeeeeseeeeeess 35 Sending other RDM COMMANAS cccccscccsssssesseeseeeeseeeeeceeeeeeeeeeeeeeeeeeeessaeeesseeeseeeseeessseseseeseeeeeeess 35 Example Gode 4h vate eke EEEE E IAEA EEEE EAA PEE AEAEE ote Gee EAEE 37 Using DALI on the Controller Board ccccceesssesesseesseeeeeceeeeeeeeeeeeeeeeeaeeeeaeesaeeeeeeeessensesseseeseeeeeeseess 40 Initialising the DALI HANDLE rerea e aniraa eaea N E EAA EEA E eean e aie 40 Initialising ERATE O E E AEAEE EEEE A EE EAE E EE SEE 40 DALI DiISCOV Ty ciona a i a a o a aE 40 Specifying CIE1931 Colour Space ValUCS ccssseesssssscssececeecceeeeeeeseeeesaeeaasessseeeseeeseeeseeeeseeeeeeess 41 Sending other DALI commands aaaea ea seuss fe E va REEE E EEEE A E AREA AEAEE 41 Example Cod sni in ea a a a ener ev a e a EER 43 Slave Board So Wae ee sais ack ete aaaea adh aaa raa aa aa aaa Paa aAa a Aaa aaa ria ek a riet 46 THE ansitS lib Libary oiea neaten na a ah Sond hatin sea ve eee ete ee 46 C Pre processor Definitions for the slave board cccccccces
50. s specified as 255 0 0 The sRGB Colour Space could be thought of as a three dimensional cube with Red Green and Blue as the axes In the colour picker show below the square area represents a slice through the cube showing all possible Green and Blue values when Red 255 Lighting Demo Eile Edit Help sRGB Colour Space CIE 1931 Colour Space Direct Control Sensors DMX512 Devices PhlatLight CBM 380 255 b lt 255 Luxeon Rebel RGB CW Luxeon Rebel RGB CW Red 255 Green 5 Green 48 Blue 47 0 Blue 255 Model Luminus PhlatLight CBM 380 LED Controller Freescale Semiconductor Inc DMX512 Start Address 1 Current DMX512 Personality Colour space control Current DMX512 Footprint 1 slot 2s Po freescale semiconductor Note that the primary colours Red Green and Blue of the sRGB colour space are not the same as the Red Green Blue primaries used by a typical high brightness LED In order to achieve a given sRGB colour using the LED primaries software has to perform a colour transformation CIE1931 Colour Space Control Although sRGB is widely used for computers it s not ideal for specifying colours There are many colours which are visible to the human eye but which cannot be represented accurately on the computer screen To specify these colours it is necessary to use another Colour Space such as CIE 1931 17 M Lighting Demo la Eile Edit Hel
51. software manually 4 Specify the driver folder in the LightingDemo package Unknown Devic Browse for driver software on your computer Search for driver software in this location Include subfolders You should be prompted whether to install the driver 12 Emons E Would you like to install this device software Name MicroAPL Ltd for Freescale Semiconductor a Publisher MicroAPL Ltd Always trust software from MicroAPL Ltd You should only install driver software from publishers you trust How can I decide which device software is safe to install 5 You can verify that the Controller board has been recognized by checking the Windows Device Manager ai Devwcemanaer CO File Action View Help eo TIDE m 8 FaRs S DELL SIMON ERS Computer G Disk drives H A Display adapters 83 DVD CD ROM drives te Floppy drive controllers wa Oy Human Interface Devices m ca IDE ATA ATAPI controllers B P Jungo re Keyboards Lighting Controller i i P Freescale DMX DALI Lighting Controller B A Mice and other pointing devices HE Monitors Network adapters HAP Ports COM amp LPT we Processors q Sound video and game controllers a Storage controllers H System devices re Universal Serial Bus controllers 13 Using the LightingDemo Application Device Discovery When the LightingDemo application is launched it will first attempt to contact the
52. t uint_16 inDeviceNumber uint_8 inUniverseNumber RDM UID inUID In principle the software could support multiple DMX512 universes if the hardware allowed it Initialising the hardware After the DMX HANDLE has been initialised the application should call the routine dmx device init to initialise the hardware interface Function Prototype DMX ERROR dmx device init DMX HANDLE inHandle Note that the controller board software to accompany the LightingDemo application allows the user to switch between DMX512 and DALI protocols dynamically This is achieved by calling dmx device init dmx device deinit and the DALI equivalents as appropriate RDM Discovery To perform an RDM discovery process in order to find out which slaves are attached to the DMX512 network call the rdm_discovery routine Function Prototype DMX ERROR rdm discovery DMX HANDLE inHandle boolval inDoCompleteDiscovery This will cause the controller software to initiate RDM discovery searching the 48 bit RDM address space for enabled devices For each slave that is found the software will request additional information such as the device manufacturer number of personalities footprint etc The result is added to a linked list of all known slaves in which each item has the following structure Note that where a slave implements one or more sub devices there will be one entry in the linked list for the Root device and one for each sub device
53. t all if the answer to a query is no In order to accommodate this the 43 dali wait response returns a 16 bit response value where RESPONSE_NO value 0x100 indicates that no response was received c DALI special commands can be sent using the following subroutine Function Prototype DALI_ERROR dali send special command DALI HANDLE inHandle uint 8 inCommand uint 8 inByte2 The following example sends the DATA TRANSFER REGISTER command to all devices instructing them to load the DTR register with the value 100 dali send special command dali_controller DALI SC_ DATA TRANSFER REGISTER 100 Example Code The following code shows a more complete example using the DALI controller software It includes the following steps e Initialise the controller e Perform an DALI discovery process e Senda DALI packet to ask the first slave for its device type e Send direct power control instruction to the first slave For clarity some error checking has been omitted include dali h include dali _controller h include dali support h void dali demonstration void DALI HANDLE dali controller DALI ERROR errcode DALI SLAVE RECORD slave int attempt uint_ 8 addressByte uint 16 response Initialise controller dali controller dali_controller init 0 if dali controller NULL return Initialise controlle
54. uty cycles one or more values may turn out to be negative This happens when the target colour is outside the triangular gamut of all possible colours that can be produced by mixing the three LED primaries In this case the colour is adjusted so that it is in gamut by adding just enough to bring the colour to the edge of the triangle The discussion above considered the simplified case of only three primaries Many LED packages have four primaries e g Red Green Blue and White Effectively this means that matrix M has three rows but has four columns i e it is 3 x 4 instead of 3 x 3 meaning that there is no unique solution to the colour balancing problem The software on the slave board considers the four primaries in groups of three at at time e g Red Green Blue Red Green White Red Blue White and Green Blue White The target colour can normally be represented by either of two of these combinations so the software chooses a solution that will deliver maximum brightness Adjusting Duty Cycles The routine led_ convert xy to_levels discussed above will calculate the duty cycles necessary to achieve the target colour at maximum brightness These duty cycles may need to be scaled back a Because the application software requested a luminance value of less than 100 b Because driving the LED package with the calculated duty cycles would exceed its maximum rated current c Because driving the LED package with the calculated duty cycl
Download Pdf Manuals
Related Search
Related Contents
Samsung SGH-D520 manual de utilizador LG 60LP645H 59.58" Full HD Black LED TV MANUEL D`UTILISATION TAILLE-HAIE HC-155ES ナースのための人工呼吸器 86120B User Manual - Custom-Cal Copyright © All rights reserved.
Failed to retrieve file