AN2730 Application note High power LED driver for single Flash with I²C interface Introduction This application note is dedicated to the design of a Flash LED driver using the STCF06 device, which is a buck-boost current mode converter with an I2C interface. The schematic, functional description, recommendations for PCB layout and external components selection are also discussed in this application note. This device is designed for driving a single LED with a forward voltage range from 2.7 to 5 V. Figure 1. April 2008 STCF06 demonstration board Rev 1 1/28 www.st.com Contents AN2730 Contents 1 Schematic description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.1 2 3 Application schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Selection of external components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1 Input and output capacitor selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 Inductor selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3 LED selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4 D1 selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.5 RFL selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.6 RTR selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.7 NTC AND RX resistor selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 PCB design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 PCB design rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.2 PCB layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.2.1 4 Internal registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.1 5 6 2/28 Accessing the internal registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Operation modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.1 Shutdown mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.2 Shutdown mode with the NTC feature activated . . . . . . . . . . . . . . . . . . . 14 5.3 Ready mode and NTC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.4 Torch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5.5 Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 The status register and the ATN pin . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 6.1 7 A four-layer PCB with application area 55 mm2 for BGA package . . . . . 10 The status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Reading and writing to the STCF06 registers through the I2C bus . . 19 7.1 Writing to a single register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 7.2 Writing to multiple registers with incremental addressing . . . . . . . . . . . . 19 AN2730 8 9 Contents 7.3 Reading from a single register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 7.4 Reading from multiple registers with incremental addressing . . . . . . . . . 20 Examples of register setup for each mode . . . . . . . . . . . . . . . . . . . . . . 21 8.1 Example 1: 1066 mA Flash with 200 ms duration . . . . . . . . . . . . . . . . . . 21 8.2 Example 2: 48 mA torch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 8.3 Example 3: an auxiliary LED running at 10 mA for 500 ms . . . . . . . . . . . 23 8.4 Example 4: red-eye reduction (multiple short flashes) . . . . . . . . . . . . . . . 24 8.5 Example 5: a Flash pulse longer than 1.5 s . . . . . . . . . . . . . . . . . . . . . . . 25 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3/28 List of tables AN2730 List of tables Table 1. Table 2. Table 3. Table 4. Table 5. Table 6. Table 7. Table 8. Table 9. Table 10. Table 11. Table 12. Table 13. Table 14. Table 15. Table 16. Table 17. Table 18. Table 19. Table 20. Table 21. Table 22. Table 23. Table 24. Table 25. Table 26. Table 27. Table 28. Table 29. Table 30. Table 31. 4/28 Recommended components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Accessibility of internal registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 COMMAND register data to enter shutdown mode (version A) . . . . . . . . . . . . . . . . . . . . . 14 COMMAND register data to enter shutdown mode (version B) . . . . . . . . . . . . . . . . . . . . . 14 COMMAND register data to enter shutdown mode with NTC activated . . . . . . . . . . . . . . . 14 COMMAND register data to enter ready mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 COMMAND register data to enter ready mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 COMMAND register data to enter torch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 COMMAND register data to enter Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 STATUS register bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Effect of the status register bits on the operation of the device . . . . . . . . . . . . . . . . . . . . . 18 Torch mode and Flash mode DIMMING registers settings. . . . . . . . . . . . . . . . . . . . . . . . . 21 COMMAND register data to enter Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 DIMMING register data for the Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 I2C data packet for activating the Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 COMMAND register data for the torch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 DIMMING register data for the torch mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 I2C data packet for activate torch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 I2C data packet for terminating the torch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 COMMAND register data for the AUX_LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 AUX_LED register data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 I2C data packet for activating the ready mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 I2C data packet for activating the AUX_LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 COMMAND register data for Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 DIMMING register data for Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 I2C data packet for activating the Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 I2C data packet for activating the Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 1st I2C data packet to restart the Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2nd I2C data packet to restart of the Flash mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3rd I2C data packet to restart of the Flash mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 AN2730 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. STCF06 demonstration board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 A typical application schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Top layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Middle layer 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Middle layer 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Bottom layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Top overlay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Splitting the Flash pulse into several shorter pulses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Writing to a single register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Writing to multiple registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Reading from a single register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Reading from multiple registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Multiple flashes handled by the TRIG pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 I2C bus packets timing for a Flash lasting longer than FTIM max . . . . . . . . . . . . . . . . . . . 27 5/28 Schematic description 1 AN2730 Schematic description The Flash LED driver STCF06 has a high operational frequency (1.8 MHz) which allows the usage of small external components. 1.1 Application schematic Figure 2. A typical application schematic (Note 2) STCF06 (Note 1) (Note 2) (Note 2) Note 1: connect to V1, or GND or SDA or SCL to choose one of the 4 different I²C slave addresses Note 2: optional components to support auxiliary functions 6/28 AN2730 Selection of external components 2 Selection of external components 2.1 Input and output capacitor selection It is recommended to use ceramic capacitors with low ESR as input and output capacitors. It is recommended to use 2x10 µF/6.3 V as a minimum value for the input capacitor, and 4.7 µF/6.3 V as the optimal value for the output capacitor to achieve a good stability of the device, for a supply range varying from low input voltage (2.7 V) to the maximum ratings of output power. Note: see recommended components in Table 1. 2.2 Inductor selection A thin shielded inductor with a low DC series resistance of winding is recommended for this application. To achieve a good efficiency in step-up mode, it is recommended to use an inductor with a DC series resistance RDCL=RD/10 [ Ω; Ω ], where RD is the dynamic resistance of the LED. For nominal operation, the peak inductor current can be calculated by the following formula: Equation 1 IPEAK = ((IOUT / η) + ((VOUT – VIN) x VIN ²) / (2 x L x f x VOUT²)) x VOUT / VIN Where: ● IPEAK: Peak inductor current ● IOUT: Current sourced at the VOUT - pin, this is the LED current ● η: Efficiency of the STCF06 ● VOUT: Output voltage at the VOUT - pin ● VIN: Input voltage at the VBAT - pin ● L: Inductance value of the inductor ● f: Switching frequency Note: see recommended components in Table 1. 2.3 LED selection All LEDs with a forward voltage range ranging from 2.7 V to 5 V are compatible with STCF06. The forward voltage spread of any selected LED must however lay within this range (2.7 V to 5 V). It is possible to set the maximum level of the LED current in Flash mode and Torch mode by setting the values of the corresponding sensing resistors, lower current values can be then set through the I2C port. It is strongly recommended to use the LED with forward voltage as low as possible to get the best performance in terms of current consumption and efficiency Note: see recommended components in Table 1. 7/28 Selection of external components 2.4 AN2730 D1 selection All the Schottky diodes are compatible with the STCF06. It is recommended to use the Schottky diode with forward voltage as low as possible to get the best performance of the application in terms of input current consumption and efficiency of the application. Note: see recommended components in Table 1. 2.5 RFL selection The value of the RFL resistor can be calculated by the following equations: Equation 2 RFL=VFB2/IFLASH(max) where VFB2= 227 mV Equation 3 PRFLASH=RFL*IFLASH2 where PRFL is the power dissipated on the RFL resistor. It is recommended to use a thin metal film resistor in the 0606 package size and 1% tolerance. The maximum LED current in Flash mode for STCF06 is 1.5 A for a battery voltage ranging from 3.5 V to 5.5 V, 1.3 A from 3 V to 3.5 V and 1 A from 2.7 V to 3 V. 2.6 RTR selection The value of the RTR resistor can be calculated by the following equations: Equation 4 RTR= (VREF - ITORCH * RFL)/ITORCH and Equation 5 PRTORCH=RTR*ITORCH2 where PRTORCH is the power dissipated on the RTR resistor. It is recommended to follow the equation RTR=6.66* RFL to avoid any jump in the current DIMMING values. It is recommended to use a thin metal film resistor with 1% or 5% tolerance. The maximum LED current in torch mode for SCTF03 is 370 mA for a battery voltage ranging from 2.7 V to 5.5 V. 2.7 NTC AND RX resistor selection STCF06 supports the usage of a negative thermistor (NTC) for sensing the LED temperature. In order to implement this functionality, the RX resistor and an external voltage reference are needed too. Once the NTC feature is activated, the internal switch connects the RX resistor to the NTC, and this creates a voltage divider supplied by the external reference voltage connected to the NTC. 8/28 AN2730 Selection of external components If the temperature of the NTC-thermistor rises due to the heat dissipated by the LED, the voltage on the NTC pin increases. When this voltage exceeds 0.56 V, the NTC_W bit in the STATUS register is set to high, and the ATN pin is set to low to inform the microcontroller that the LED is becoming hot. The NTC_W bit is cleared by reading the status register. If the voltage on the NTC pin rises further and exceeds 1.2 V, the NTC_H bit in the status register is set to high, and the ATN pin is set to low to inform the microcontroller that the LED is too hot and the device goes automatically to the ready mode to avoid damaging the LED. This status is latched, until the microcontroller reads the status register. Reading the STATUS register clears the NTC_H bit. The selection of the NTC and RX resistor values strongly depends on the power dissipated by the LED and all components surrounding the NTC-thermistor and on the cooling capabilities of each specific application. The RX and the NTC values in Table 1 below work well in the demonstration board presented in this application note. A real application may require a different type of NTC-thermistor to achieve optimal thermal protection. The procedure to activate the NTC-feature is described in Section 5.2. Table 1. Recommended components Component Manufacturer Part number Value Size CI TDK C1608X5R0J106M 10 µF 0603 CO TDK C1608X5R0J475M 4.7 µF 0603 L TDK VLF4014AT-1R5M1R8-1 1.5 µH 3.7 x 3.5 x 1.4 mm NTC Murata NCP21WF104J03RA 100 kΩ 0805 RFL Tyco RL73K1JR15JTD 0.15 Ω 0603 RTR Rohm CRG0805F1R0 1Ω 0805 RX Rohm MCR01MZPJ15K 15 kΩ 0402 LED Luxeon LED LXCL-PWF1 0805 D1 STMicroelectronics STPS1L20MF 3.8x1.9x0.85 mm D1(1) STMicroelectronics BAT20J-FILM 2.7x1.3x1.1 mm 1. When the minimum application area is targeted, the BAT20J should be used, then the output current performance is decreased. 9/28 PCB design AN2730 3 PCB design 3.1 PCB design rules The STCF06 is a powerful switching device where the PCB must be designed in line with switched supplies design rules. The power tracks (or wires in the demonstration board) must be as short as possible and wide enough, because of the large currents involved. It is recommended to use a 4-layer PCB to get the best performance. All the external components must be placed as close as possible to the STCF06. All high-energy switched loops should be as small as possible to reduce EMI. Most of the LEDs need efficient cooling, which could be done by using a dedicated copper area on the PCB. Please refer to the selected LED's reference guide to design the heatsink. Place the RFL resistor as close as possible to the PGND pins and the ground pin of the COUT capacitor. In case a modification of any PCB layer is required, it is highly recommended to use enough vias. Place the NTC resistor as close as possible to the LED for good temperature sensing. Direct connection between GND and PGND is necessary in order to achieve correct output current value. No LED current should flow through this track. Voltage sensing on the RFL resistor must be done on a track from ball FB2 and directly connected to the RFL resistor. Again, no current should flow through this track. Pin FB2S must be connected to the RFL resistor pin. Vias connecting the STCF06 pins to the copper tracks (if used) must be 0.1 mm in diameter for BGA version. It is recommended to use the filled vias. 3.2 PCB layout 3.2.1 A four-layer PCB with application area 55 mm2 for BGA package Figure 3. 10/28 Top layer AN2730 PCB design Figure 4. Middle layer 1 Figure 5. Middle layer 2 Figure 6. Bottom layer 11/28 PCB design AN2730 Figure 7. 12/28 Top overlay AN2730 Internal registers 4 Internal registers 4.1 Accessing the internal registers There are 4 internal registers in the STCF06: COMMAND, DIMMING, AUX_LED, STATUS. The STATUS register is read-only. The COMMAND register can be accessed in any operation mode. All the other registers can be accessed in any mode, except in shutdown mode. When the device enters shutdown mode, the DIMMING, AUX_LED and status registers are cleared. The COMMAND register value remains untouched when entering shutdown mode. The table below shows the accessibility of each register in all operation modes. Table 2. Accessibility of internal registers Mode Register Address Shutdown Ready Torch Flash Shutdown value PowerON reset value COMMAND 00 Read / write Read / write Read / write Read / write Untouched Cleared DIMMING 01 Inaccessible Read / write Read / write Read / write Cleared Cleared AUX_LED 02 Inaccessible Read / write Read / write Read / write Cleared Cleared Status 03 Inaccessible Read only Read only Read only Cleared Cleared 13/28 Operation modes AN2730 5 Operation modes 5.1 Shutdown mode Shutdown mode is entered after the Power-ON reset. This mode is mainly used to decrease the power consumption of the device. During this mode, only the I2C interface is alive. The only thing which can be done in shutdown mode is to access the COMMAND register. Entering shutdown mode by writing to the COMMAND register aborts any running operation and clear the values of the DIMMING, AUX_LED and status registers. The COMMAND register value is not affected by entering shutdown mode. The following data must be written to the COMMAND register to enter shutdown mode. Table 3. CMD_REG COMMAND register data to enter shutdown mode (version A) PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 0 x x X x x x x MSB Table 4. CMD_REG LSB COMMAND register data to enter shutdown mode (version B) PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 0 x x 0 x x x x MSB 5.2 LSB Shutdown mode with the NTC feature activated When this operation mode is activated, the microcontroller can still monitor the NTC voltage through its A/D converter, while STCF06 remains in shutdown mode and therefore saves power. The following data must be written to the COMMAND register to enter shutdown mode + NTC. Table 5. CMD_REG COMMAND register data to enter shutdown mode with NTC activated PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 0 x x 1 x x x x MSB 5.3 LSB Ready mode and NTC The ready mode allows the user to access all the internal registers. The NTC feature can be activated in this mode and the temperature of the LED can be sensed by the A/D converter of the microcontroller. The following data must be written to the COMMAND register to enter ready mode. 14/28 AN2730 Table 6. CMD_REG Operation modes COMMAND register data to enter ready mode PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 0 0 0 x x x x MSB LSB The following data must be written to the COMMAND register to activate the NTC feature. Table 7. CMD_REG COMMAND register data to enter ready mode PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 0 0 1 x x x x MSB LSB As soon as the NTC feature is activated, the internal switch connects the NTC resistor to the RX resistor, thereby creating a voltage divider. The voltage on this divider can be, if desired, monitored by the A/D converter of the microcontroller. An external voltage reference must be connected to the NTC to use this feature. The bits NTC_W and NTC_H of the STATUS register will not be properly set if there is no external reference voltage connected to the NTC. If the NTC feature is not going to be used, neither the negative thermistor, nor the external reference needs to be connected. In this case, it is recommended to ground the RX pin. As the NTC feature is automatically activated during the Flash and torch mode, leaving the RX pin floating could lead to unwanted interruptions of the light due to non-defined voltages on the RX pin. 5.4 Torch mode This mode is intended to be used for low light intensities. The LED current in TORCH mode can be adjusted in a range from 29 mA up to 370 mA. The torch mode is activated by writing the following data to the COMMAND register. Table 8. CMD_REG COMMAND register data to enter torch mode PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 0 1 x x x x x MSB LSB The DIMMING register value (TDIM) must be set as well, unless it has already been set during a previous operation. If TDIM register is not set, then the default output current value is at the minimum. There is no internal timer which controls the torch duration. Therefore, as soon as the torch mode is activated, it remains active until a new mode is entered by writing a new data to the COMMAND register. If the torch mode has been terminated by entering ready or Flash mode, it can be restarted again by writing the corresponding data to the COMMAND register only, because entering any of the ready and Flash modes does not influence the TDIM value. If the torch mode was 15/28 Operation modes AN2730 terminated by entering into shutdown mode, then the TDIM value must be set again during the restart of the torch because entering the shutdown mode clears the TDIM value. As soon as the torch mode is activated, the NTC feature is automatically activated too in order to protect the LED against overheating. The NTC feature is activated even if the NTC_ON bit in the COMMAND register is set to zero. 5.5 Flash mode This mode is intended to be used for high light intensities. The LED current in Flash mode can be adjusted up to 1.5 A with the input voltage ranging from 3.5 V up to 5.5 V. The Flash mode is activated by writing the following data to the COMMAND register. Table 9. CMD_REG COMMAND register data to enter Flash mode PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 1 x x x x x x MSB LSB The DIMMING register value (FDIM) must be set as well, unless it has already been set during a previous operation. The activation of the Flash mode requires the TRIG pin to be high. The FLASH mode is active only when both the TRIG_EN bit in the COMMAND register is set to 1 and the TRIG pin is high. This gives the user the possibility to choose between soft and hard triggering of the FLASH . The soft triggering is done by writing data to the internal registers only, while the TRIG pin is permanently kept high, for example by connecting it to VBAT. This saves one pin of the microcontroller, which can be used for a different purpose, but this way of triggering is less accurate than the hard one. The second disadvantage of this solution is that the Flash duration can only be set in discrete increments of the internal timer ( increment = approx. 100 ms). Hard-triggering of the Flash mode requires the microcontroller to manage the TRIG pin. The COMMAND and the DIMMING registers are loaded with data before the TRIG pin is set to high. This allows the user to avoid the I2C-bus latency. Flash mode then starts as soon as the TRIG pin is set to high. It takes typically about 0.7 ms to ramp up the LED current to the adjusted value. This time may vary according to the LED current value and the battery voltage. When the TRIG pin is kept High long enough, the internal timer reaches zero and the Flash mode is over. As soon as the Flash is timed out, the ATN pin is pulled down for 11 µs to inform the microcontroller that the status register has been updated and the flash is over. If the TRIG pin is set to low before the internal timer reaches zero, the Flash mode will be interrupted and can be restarted by setting the TRIG pin to high again. The internal timer is paused while the TRIG pin is low. This means that the user can split the Flash into several pulses of a total length equal to the FTIM value. Figure 8 shows how to split the Flash into several shorter pulses. The cumulative length of all the pulses is determined by the FTIM value. Figure 8 shows the case for FTIM = 9 (900 ms Flash time). The cumulative time when the TRIG pin is high is 1000 ms (5 pulses 200 ms long). The last Flash pulse is only 100 ms long. The reason is that the internal Flash timer reaches zero and the TRIG_EN bit is set to 0. 16/28 AN2730 Operation modes Figure 8. Splitting the Flash pulse into several shorter pulses 1300 ms 200 ms Time when the internal flash timer reaches 0 100 ms I2C bus packet TRIG_EN bit TRIG pin LED current Internal Flash timer values 9 8 7 6 5 4 3 2 1 0 Hard triggering allows therefore a smooth setting of the Flash duration. The resolution is about 8.8 µs. The minimum Flash duration is limited by the ramp-up time of the LED current and the maximum is limited by the FTIM value. If it is necessary to make a flash pulse longer than the maximum allowed by FTIM, then it is necessary to reload the COMMAND register before the internal timer reaches zero (start a new Flash before the previous one elapses). See Section 8.5 for more details. 17/28 The status register and the ATN pin AN2730 6 The status register and the ATN pin 6.1 The status register Table 10. STATUS register bits Bit name N/A F_RUN LED_F NTC_W NTC_H OT_F OC_F MSB VOUTOK_N LSB A detailed description of each bit is also given in the STCF06 datasheet. Table 11. Effect of the status register bits on the operation of the device Bit name Default value VOUTOK_N F_RUN LED_F NTC_W NTC_H OT_F OC_F (STAT_REG) (STAT_REG) (STAT_REG) (STAT_REG) (STAT_REG) (STAT_REG) (STAT_REG) 0 0 0 0 0 0 0 (1)) NO YES YES YES YES NO YES Forces Ready mode when set NO YES NO YES YES NO YES Sets ATN low when set NO YES YES YES YES NO YES Latched ( 1. YES means that the bit is set by internal signals and is reset to its default value by an I2C-read operation of STAT_REG; NO means that the bit is set and reset by internal signals in real-time. When the status register is latched, reading and writing to the registers is still possible, but the bits TRIG_EN and TCH_ON in the COMMAND register and AUXL register cannot be changed, until the device is unlatched. It is necessary to read the STATUS register to unlatch the device. The ATN pin is also pulled down when the internal timer reaches zero in Flash mode. In this case the ATN pin is pulled down for 11 µs only. It is recommended to connect the ATN pin to the interrupt input of the microcontroller. If it is not connected to the interrupt input, the ATN pin should be pulled fast enough not to miss the 11µs pulse, for example by a programming loop which is entered after the start of the Flash mode. This loop runs until the ATN pin becomes low. It is recommended to make a timeout of such a loop. 18/28 AN2730 Reading and writing to the STCF06 registers through the I2C bus 7 Reading and writing to the STCF06 registers through the I2C bus 7.1 Writing to a single register Writing to a single register starts with a START bit followed by the 7-bit device address of STCF06. The 8th bit is the R/W bit, which is 0 in this case. R/W = 1 means a Reading operation. Then the master awaits an acknowledgement from STCF06. The 8-bit address of the desired register is sent afterwards to STCF06. It is also followed by an acknowledge pulse. The last transmitted byte is the data that is going to be written into the register. It is followed again by an acknowledge pulse from STCF06. Then the master generates a stopbit and the communication is over, see Figure 9 below. Figure 9. Writing to a single register W R I T E DEVICE ADDRESS 7 bits ADDRESS OF REGISTER DATA SDA LINE L R A M S / C S B W K B S M T S A B R T 7.2 L A S S C T B K O P L A M S C S B K B Writing to multiple registers with incremental addressing It would be unpractical to send several times the device address and the address of the register when writing to multiple registers. STCF06 supports writing to multiple registers with incremental addressing. When data is written to a register, the register address is automatically incremented (by one), and therefore the next data can be sent without sending again the device address and the register address, see Figure 10 below. Figure 10. Writing to multiple registers DEVICE ADDRESS 7 bits W R I T E ADDRESS OF REGISTER i DATA i DATA i+1 DATA i+2 DATA i+2 DATA i+n SDA LINE S M T S A B R T L R A M S / C S B W K B L A M S C S B K B L A M S C S B K B L A M S C S B K B L A M S C S B K B L A M S C S B K B L A S S C T B K O P 19/28 Reading and writing to the STCF06 registers through the I2C bus 7.3 AN2730 Reading from a single register The reading operation starts with a START bit followed by the 7-bit device address of STCF06. The 8th bit is the R/W bit, which is 0 in this case. STCF06 confirms the receiving of the address + R/W bit by an acknowledge pulse. The address of the register which should be read is sent after and confirmed by an acknowledge pulse from STCF06 again. Then the master generates a START-bit again and sends the device address followed by the R/W-bit, which is 1 now. STCF06 confirms the receiving of the address + R/W-bit by an acknowledge pulse, and starts to send data to the master. No acknowledge pulse from the master is required after receiving the data. Then the master generates a STOP bit to terminate the communication, see the Figure 11 below. Figure 11. Reading from a single register DEVICE ADDRESS 7 bits W R I T E ADDRESS OF REGISTER i DATA i DATA i+1 DATA i+2 DATA i+2 DATA i+n SDA LINE L R A M S / C S B W K B S M T S A B R T 7.4 L A M S C S B K B L A M S C S B K B L A M S C S B K B L A M S C S B K B L A M S C S B K B L A S S C T B K O P Reading from multiple registers with incremental addressing Reading from multiple registers starts in the same way like reading from a single register. As soon as the first register is read, the register address is automatically incremented. If the master generates an acknowledge pulse after receiving the data from the first register, then reading from the next register can start immediately without having to send once more the device and the register addresses. The last acknowledge pulse before the STOP bit is not required. See the Figure 12 below. Figure 12. Reading from multiple registers DEVICE ADDRESS 7 bits W R I T E DEVICE ADDRESS 7 bits ADDRESS OF REGISTER i R E A D DATA i DATA i+1 DATA i+2 DATA i+2 DATA i+n SDA LINE S M T S A B R T 20/28 L R A M S / C S B W K B L A S S C T B K A R T R A / C W K L A M S C S B K B L A M S C S B K B L A M S C S B K B L A M S C S B K B L N S S O T O B A P C K AN2730 Examples of register setup for each mode 8 Examples of register setup for each mode Table 12. Torch mode and Flash mode DIMMING registers settings T_DIM (hex) 0 1 2 3 4 5 6 7 F_DIM (hex) 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D 220 266 313 373 446 526 633 753 893 1066 12 13 14 15 16 17 18 19 20 21 22 23 24 F LED curren t [mA] 29 34 40 48 58 69 82 98 Intern al step 1 2 3 4 5 6 7 8 VREF1 [mV] 33 40 47 56 67 80 95 113 134 160 190 227 33 40 47 56 67 79 95 113 134 160 190 227 Sense Resist. RFL + RTR RFL RFL + + RTR RT RFL + RT RFL + RT RFL + RT RFL + RTR RFL + RTR RFL RFL RFL RFL + + + + RTR RT RT RT RFL RFL RFL RFL RFL RFL RFL RFL RFL RFL RFL RFL R R R R 120 139 165 197 E 9 10 R 11 R 1266 1513 R Note: LED current values refer to RFL= 0.15 Ω, RTR = 1 Ω 8.1 Example 1: 1066 mA Flash with 200 ms duration Let's suppose that RFL = 0.15 Ω. The targeted value of the flash current is 1066 mA and the flash duration should be 200 ms. The reference voltage must be set to 160 mV to achieve a 1066 mA flash current with a 0.15 Ω sensing resistor. The value of FDIM (4 bits) must be set to 0xD to set up the reference voltage to 160 mV (see Table 12). The flash duration timer can be set to 100ms up to 1500 ms in 100ms increments. If the desired flash duration is 200 ms the value FTIM (4 bits) must be set to 0x2. Table 13. CMD_REG ● Bit PWR_ON of the COMMAND register must be set to 1 ● Bit TRIG_EN of the COMMAND register must be set to 1 ● Bit TCH_ON of the COMMAND register must be set to 0 ● Bit NTC_ON of the COMMAND register can be set to any value, because NTC is automatically ON when the Flash mode is active. Setting this bit to 0 does not switch off the NTC. COMMAND register data to enter Flash mode PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 1 x X 0 0 1 0 MSB LSB 21/28 Examples of register setup for each mode Table 14. AN2730 DIMMING register data for the Flash mode TDIM_3 TDIM_2 TDIM_1 TDIM_0 FDIM_3 FDIM_2 FDIM_1 FDIM_0 0 0 0 0 1 1 0 1 DIM_REG MSB LSB It is necessary to write 4 bytes to the STCF06 to make a Flash. Table 15. I2C data packet for activating the Flash mode Byte Hex 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 D2 1 1 0 1 0 0 1 0 Data of the COMMAND register 4 0D 0 0 0 0 1 1 0 1 Data of the DIMMING register 8.2 Binary Comment Example 2: 48 mA torch Let's suppose that RFL = 0.15 Ω, RTR = 1 Ω and the targeted value of the torch current is 48 mA. The reference voltage must be set to 56 mV to achieve 48 mA in torch mode with the resistor values mentioned above. The value of TDIM (4 bits) must be set to 0x3 to set up the reference voltage to 56 mV. Table 16. CMD_REG ● Bit PWR_ON of the COMMAND register must be set to 1. ● Bit TRIG_EN of the COMMAND register must be set to 1. ● Bit TCH_ON of the COMMAND register must be set to 0. ● Bit NTC_ON of the COMMAND register can be set to any value, because NTC is automatically ON, when torch mode is active. Setting this bit to 0 does not switch off the NTC. COMMAND register data for the torch mode PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 0 1 1 0 0 0 0 MSB Table 17. DIM_REG LSB DIMMING register data for the torch mode TDIM_3 TDIM_2 TDIM_1 TDIM_0 FDIM_3 FDIM_2 FDIM_1 FDIM_0 0 0 1 1 0 0 0 0 MSB It is necessary to write 4 bytes to the STCF06 to run the torch mode. 22/28 LSB AN2730 Examples of register setup for each mode Table 18. I2C data packet for activate torch mode Byte Hex Binary Comment 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 B0 1 0 1 1 0 0 0 0 Data of the COMMAND register 4 30 0 0 1 1 0 0 0 0 Data of the DIMMING register The duration of the torch mode is "unlimited". Torch mode is terminated by setting the TCH_ON bit in the COMMAND register to 0. Termination of the torch mode can be done by writing the following data to STCF06. Table 19. I2C data packet for terminating the torch mode Byte Hex Binary Comment 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 80 1 0 0 0 0 0 0 0 Data of the COMMAND register This puts the STCF06 into ready mode. 8.3 Example 3: an auxiliary LED running at 10 mA for 500 ms STCF06 must be into ready mode (both bits TRIG_EN and TCH_ON are 0) to activate the auxiliary LED. A 10 mA output current is reached when AUXI is set to 0x8. AUXT must be set to 0x5 to have a 500 ms duration of the auxiliary LED lighting. Table 20. CMD_REG COMMAND register data for the AUX_LED PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 0 0 0 0 0 0 0 MSB Table 21. AUX_LED LSB AUX_LED register data AUXI_3 AUXI_2 AUXI_1 AUXI_0 AUXT_3 AUXT_2 AUXT_1 AUXT_0 1 0 0 0 0 1 0 1 MSB LSB Writing the 3 bytes in Table 22 to STCF06 puts it into ready mode. This can be skipped if it already is in ready mode. 23/28 Examples of register setup for each mode Table 22. AN2730 I2C data packet for activating the ready mode Byte Hex Binary Comment 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 80 1 0 0 0 0 0 0 0 Data of the COMMAND register Writing the following 3 bytes to STCF06 activates the auxiliary LED for the desired time. Table 23. I2C data packet for activating the AUX_LED Byte Hex 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 02 0 0 0 0 0 0 1 0 Auxiliary LED register address 3 85 1 0 0 0 0 1 0 1 Data of the auxiliary LED register 8.4 Binary Comment Example 4: red-eye reduction (multiple short flashes) There are two ways to manage this task. The first one is to use hardware triggering of the flashes through the TRIG pin. This is the most suitable and recommended solution, as it reduces the usage of the I2C bus and the length of each flash pulse can be adjusted continuously. The second solution is to use the software triggering feature, which means a periodical reloading of the COMMAND register. This however increases traffic on the I2C bus and the flashes can only have length adjustable in 100 ms increments only. Let's suppose that RFL = 0.15 Ω and the targeted value of the flash current is 1066 mA. The task is to make 5 flashes of 100 ms duration with a 100 ms pause between each. The setting of the reference voltage is identical to the one in Section 8.1. The Flash timer (FTIM) is set to 0xF, which represents 1.5 s. Table 24. CMD_REG COMMAND register data for Flash mode PWR_ON TRIG_EN TCH_ON NTC_ON FTIM_3 FTIM_2 FTIM_1 FTIM_0 1 1 0 1 1 1 1 1 MSB Table 25. DIM_REG LSB DIMMING register data for Flash mode TDIM_3 TDIM_2 TDIM_1 TDIM_0 FDIM_3 FDIM_2 FDIM_1 FDIM_0 0 0 0 0 1 1 0 1 MSB The data packet which has to be sent is given in Table 26. 24/28 LSB AN2730 Examples of register setup for each mode Table 26. I2C data packet for activating the Flash mode Byte Hex Binary Comment 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 DF 1 1 0 1 1 1 1 1 Data of the COMMAND register 4 0D 0 0 0 0 1 1 0 1 Data of the DIMMING register Figure 13 shows the TRIG pin and the I2C bus timings. Figure 13. Multiple flashes handled by the TRIG pin I2C bus packet TRIG_EN bit TRIG pin 100 ms 100 ms 100 ms 100 ms 100 ms 100 ms 100 ms 100 ms 100 ms 900 ms 8.5 Example 5: a Flash pulse longer than 1.5 s Let's suppose that RFL = 0.15 Ω and the targeted value of the flash current is 630 mA. The task is to make a single flash pulse with a 4-second duration. It is necessary to reload FTIM in the COMMAND register before the internal flash timer reaches zero. This guarantees that the Flash continues and does not stop after 1.5 sec. The first packet must contain also the DIMMING register data, if they are different from those which were used in the previous operation. ● Packet 1 Sets Flash mode with 1.5 s duration and the proper DIMMING. Table 27. I2C data packet for activating the Flash mode Byte Hex Binary Comment 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 AF 1 0 1 0 1 1 1 1 Data of the COMMAND register 4 0D 0 0 0 0 1 0 1 0 Data of the DIMMING register 25/28 Examples of register setup for each mode ● AN2730 Packet 2 Sets Flash mode with 1.5 s duration. DIMMING is not set again as it is same as before Table 28. 1st I2C data packet to restart the Flash mode Byte Hex Binary 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 AF 1 0 1 0 1 1 1 1 Data of the COMMAND register ● Comment Packet 3 Sets Flash mode with 1.5 s duration. DIMMING remains untouched again. Table 29. 2nd I2C data packet to restart of the Flash mode Byte Hex Binary 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 Command register address 3 AF 1 0 1 0 1 1 1 1 Data of the COMMAND register ● Comment Packet 4 Sets Flash mode with 1 s duration. DIMMING remains untouched again. Table 30. 3rd I2C data packet to restart of the Flash mode Byte Hex Binary Comment 1 62 0 1 1 0 0 0 1 0 Device address + R/W bit 2 00 0 0 0 0 0 0 0 0 COMMAND register address 3 AA 1 0 1 0 1 0 1 0 Data of the COMMAND register Please refer to Figure 14 for more details about the I2C-bus packets timing. The solution described above is using a software termination of the Flash pulse. (It is timed out by the internal timer.) The Flash pulse could be also terminated by setting the TRIG pin to low after 4 seconds. In this case, the fourth packet could be the same as packets 2 and 3 because the timing of the Flash is done by the TRIG pin and it is not necessary to change the value of FTIM in the COMMAND register. This way of periodical reloading of the COMMAND register can be used to achieve a continuous Flash light. In this case, it is very strongly recommended to guarantee an efficient cooling of both the LED and the chip, otherwise the light can be interrupted by activation of the thermal protections. 26/28 AN2730 Revision history Figure 14. I2C bus packets timing for a Flash lasting longer than FTIM max Timeout of the first Flash Timeout of the second Flash 1.5s Timeout of the third Flash 1.5s Timeout of the fourth Flash – ending of the whole Flash pulse 1.5s 1.0s 1.0s 1.0s 1.0s I2C bus packets TRIG_EN bit TRIG pin 4.0s 9 Revision history Table 31. Document revision history Date Revision 30-Apr-2008 1 Changes Initial release 27/28 AN2730 Please Read Carefully: Information in this document is provided solely in connection 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 RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK. 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. © 2008 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com 28/28