CY3268 PowerPSoC® Lighting Starter Kit Guide Document No. 001-67149 Rev. *D WARNING: HIGH BRIGHTNESS LEDs CAN CAUSE PERMANENT DAMAGE! Do not look at the HBLEDs directly. The HBLEDs illuminate at a very high intensity and can cause permanent eye damage. Use a thick white sheet of paper as diffuser if there is no optical diffuser available. WARNING: Generally all lab work in power electronics must be done with extreme care. Caution must be exercised when using power supplies and/or power related equipment. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone (USA): 800.858.1810 Phone (Intnl): 408.943.2600 http://www.cypress.com [+] Feedback Copyrights Copyrights © Cypress Semiconductor Corporation, 2011. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in lifesupport systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Any Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement. PSoC Designer™ and Programmable System-on-Chip™ are trademarks and PSoC® is a registered trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are property of the respective corporations. Flash Code Protection Cypress products meet the specifications contained in their particular Cypress PSoC Data Sheets. Cypress believes that its family of PSoC products is one of the most secure families of its kind on the market today, regardless of how they are used. There may be methods, unknown to Cypress, that can breach the code protection features. Any of these methods, to our knowledge, would be dishonest and possibly illegal. Neither Cypress nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as ‘unbreakable’. Cypress is willing to work with the customer who is concerned about the integrity of their code. Code protection is constantly evolving. We at Cypress are committed to continuously improving the code protection features of our products. 2 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Contents 1. Introduction 1.1 1.2 1.3 1.4 Kit Contents .................................................................................................................5 Additional Learning Resources....................................................................................6 1.2.1 References.......................................................................................................6 Document History ........................................................................................................7 Documentation Conventions .......................................................................................7 2. Getting Started 2.1 2.2 2.3 2.4 2.5 5.2 19 System Block Diagram ..............................................................................................19 Functional Description ...............................................................................................20 4.2.1 Power Supply .................................................................................................21 4.2.2 PowerPSoC....................................................................................................21 4.2.3 Programming Interface...................................................................................25 4.2.4 CapSense Sensors ........................................................................................25 4.2.5 HBLEDs .........................................................................................................26 4.2.6 RESET Button................................................................................................27 4.2.7 Debug Port .....................................................................................................27 4.2.8 Temperature Sensor.......................................................................................28 5. Code Examples 5.1 15 Introduction ................................................................................................................15 Programming PowerPSoC Device.............................................................................15 CY3268 PowerPSoC Lighting Starter Kit Operation ..................................................17 4. Hardware 4.1 4.2 9 Introduction ..................................................................................................................9 Kit Installation ..............................................................................................................9 PSoC Designer ..........................................................................................................13 PSoC Programmer ....................................................................................................14 Install Hardware.........................................................................................................14 3. Kit Operation 3.1 3.2 3.3 5 29 Code Example 1: CY3268_Example1 .......................................................................29 5.1.1 Project Description .........................................................................................29 5.1.2 Hardware Connections...................................................................................29 5.1.3 Program Flow Diagram ..................................................................................31 5.1.4 Verify Output ..................................................................................................33 Code Example 2: CY3268_Heartbeat .......................................................................33 5.2.1 Project Description .........................................................................................33 5.2.2 Hardware Connections...................................................................................33 5.2.3 Program Flow Diagram ..................................................................................36 5.2.4 Verify Output ..................................................................................................38 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 3 [+] Feedback Contents A. Appendix A.1 A.2 A.3 A.4 4 39 Schematic.................................................................................................................. 39 Board Layout ............................................................................................................. 40 Bill of Materials .......................................................................................................... 42 Safety Precautions .................................................................................................... 44 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback 1. Introduction Thank you for your interest in the CY3268 PowerPSoC® Lighting Starter Kit. You can use this kit with the help of guides and code examples that are provided. The project ‘CY3268_Example1’ is programmed on the CY3268 PowerPSoC Lighting Starter Kit as the default project for demonstration purposes. For more information on this project, see Chapter 5. The CY3268 PowerPSoC Lighting Starter Kit demonstrates the ability of PowerPSoC to create scalable HBLED management solutions and enables designers to evaluate PowerPSoC. The PowerPSoC family of devices features high-performance power electronics including 1 A, 2 MHz rated power FETs, hysteretic controllers, current sense amplifiers, and PrISM™ technology to create a complete solution for HBLED power management. This kit also enables designers to test and evaluate preliminary prototype designs using PowerPSoC and understand the design flow using PSoC Designer™ software for the PowerPSoC device family. Chapter 2 describes how to install and configure software. Chapter 3 explains how to program a PowerPSoC device with PSoC Programmer and use the kit with the help of a code example. Chapter 4 details the hardware operation. Chapter 5 gives a description of the code examples. The Appendix section provides the schematics and bill of materials (BOM). 1.1 Kit Contents The CY3268 PowerPSoC Lighting Starter Kit contains: ■ CY3268 PowerPSoC board ■ 12 V, 1 A power supply ■ Two jumper shunts ■ Five PowerPSoC CY8CLED04D01-56LTXI samples ■ Kit CD, which includes: ❐ PSoC Designer ❐ PSoC Programmer ❐ Demo firmware ❐ Design files ❐ Related documents Inspect the contents of the kit; if any parts are missing, contact your nearest Cypress sales office for help. This kit does not contain the MiniProg, a device that is required to program PowerPSoC. You can purchase the MiniProg online from the Cypress web store: http://www.cypress.com/go/CY3217Miniprog1. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 5 [+] Feedback Introduction 1.2 Additional Learning Resources Visit www.cypress.com/go/powerpsoc for additional learning resources in the form of data sheets, technical reference manuals, and application notes. 1.2.1 References ■ CY3268_PowerPSoC Lighting Starter Kit_Board Schematic.pdf http://www.cypress.com/?rID=36572 ■ CY3268_PowerPSoC Lighting Starter Kit_Board Layout.zip http://www.cypress.com/?rID=36572 ■ CY3268 Kit documentation http://www.cypress.com/go/CY3268 ■ For a list of PSoC Designer-related trainings, see http://www.cypress.com/?rID=40543 ■ PowerPSoC Intelligent LED Driver data sheet http://www.cypress.com/?rID=41013 ■ For more information regarding PSoC Designer functionality and releases, refer to the user guide and release notes on the PSoC Designer web page: www.cypress.com/go/psocdesigner ■ For more information regarding PSoC Programmer, supported hardware, and COM layer, go to the PSoC Programmer web page: www.cypress.com/go/psocprogrammer ■ PrISM™ Technology for LED Dimming – AN47372 http://www.cypress.com/?rID=2922 ■ Multi Channel Color Mixing Using HB LEDs – AN51188 http://www.cypress.com/?rID=34809 ■ PowerPSoC Firmware Design Guidelines – AN51012 http://www.cypress.com/?rID=35365 ■ Switching Regulators Component Design Guide – AN50099 http://www.cypress.com/?rID=34331 ■ Modulation Techniques for LED Dimming – AN49262 http://www.cypress.com/?rID=34683 6 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Introduction 1.3 Document History ** *A PDF Creation Date 02/02/2011 02/11/2011 Origin of Change SNVN SNVN *B 04/25/2011 SNVN *C 05/25/2011 SNVN *D 06/02/2011 SNVN Revision 1.4 Description of Change Initial version of kit guide Updated document properties Content updates throughout the document to implement review comments Section 2.2: CD long name corrected to short name. 'CY3268 PowerPSoC'. Removed redundant step 3 in installation. Section 4.2.3.1. ISSP/I2C changed to ISSP. Section 5.2.4 : 'Example code' changed to 'code example' Corrected formatting in table of contents Documentation Conventions Table 1-1. Document Conventions for Guides Convention Usage Courier New Displays file locations, user entered text, and source code: C:\...cd\icc\ Italics Displays file names and reference documentation: Read about the sourcefile.hex file in the PSoC Designer User Guide. [Bracketed, Bold] Displays keyboard commands in procedures: [Enter] or [Ctrl] [C] File > Open Represents menu paths: File > Open > New Project Bold Displays commands, menu paths, and icon names in procedures: Click the File icon and then click Open. Times New Roman Displays an equation: 2+2=4 Text in gray boxes Describes cautions or unique functionality of the product. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 7 [+] Feedback Introduction 8 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback 2. 2.1 Getting Started Introduction This chapter describes how to install and configure the CY3268 PowerPSoC Lighting Starter kit. 2.2 Kit Installation To install the kit software, follow these steps: 1. Insert the kit CD into the CD drive of your PC. The CD is designed to auto-run and the kit installer startup screen appears; you can also download the latest kit installer ISO file from http://www.cypress.com/go/CY3268 and create the installer CD; the other option is to extract the ISO using WinRar and install the executables. 2. Click Install the CY3268 PowerPSoC to start the installation, as shown in Figure 2-1. Figure 2-1. Kit Installer Startup Screen Note If auto-run does not execute, double-click the cyautorun.exe file on the root directory of the CD, as shown in Figure 2-2. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 9 [+] Feedback Getting Started Figure 2-2. Root Directory of the CD 3. The CY3268 PowerPSoC - InstallShield Wizard screen appears. Choose the folder location to install the setup files. You can change the location of the folder for the setup files using Change, as shown in Figure 2-3. 4. Click Next to launch the kit installer. Figure 2-3. CY3268 PowerPSoC - InstallShield Wizard 10 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Getting Started 5. On the Product Installation Overview screen, select the installation type that best suits your requirement. The drop-down menu has the options Typical, Complete, and Custom, as shown in Figure 2-4. 6. Click Next to start the installation. Figure 2-4. Installation Type Options 7. When the installation begins, a list of all packages appears on the Installation Page. 8. A green check mark appears adjacent to every package that is downloaded and installed, as shown in Figure 2-5. 9. Wait until all the packages are downloaded and installed successfully. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 11 [+] Feedback Getting Started Figure 2-5. Installation Page 10.Click Finish to complete the installation, as shown in Figure 2-6. Figure 2-6. Installation Completion Page 12 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Getting Started After installing the software, verify that you have all hardware and drivers set up for the MiniProg by connecting the MiniProg to your PC through its USB interface. Because this is the first time you have connected the board to this PC, initial drivers are installed. Follow the on-screen dialogs for USB detection to complete the installation process. Verify your installation and setup by opening PSoC Programmer with the MiniProg attached over USB. 2.3 PSoC Designer 1. Click Start > All Programs > Cypress > PSoC Designer <version> > PSoC Designer <version> (Figure 2-7) 2. Click File > New Project to create a new project or go to File > Open Project/Workspace to work with an existing project Figure 2-7. PSoC Designer Interconnect View 3. To experiment with the code examples, go to Code Examples chapter on page 29 Note For more details on PSoC Designer, go to Help Topics from the following directory: <Install_Dir>\Cypress\PSoC Designer\<version>\PSoC Designer 5\Help CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 13 [+] Feedback Getting Started 2.4 PSoC Programmer 1. Click Start > All Programs > Cypress > PSoC Programmer <version> > PSoC Programmer <version> (Figure 2-8) 2. Connect to the MiniProg listed from the Port Selection tab of PSoC Programmer, as shown in Figure 2-8 Figure 2-8. PSoC Programmer Window 3. Click on the File Load button to load the hex file 4. Use the Program button to program the hex file on to the chip 5. When the file is successfully programmed, Programming Succeeded appears on the Action pane 6. Close PSoC Programmer Note For more details on PSoC Programmer, go to Help Topics from the following path: <Install_Dir>\Cypress\Programmer\<version>\PSoc_Programmer.chm. 2.5 Install Hardware No hardware installation is required for this kit. 14 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback 3. 3.1 Kit Operation Introduction The CY3268 PowerPSoC Lighting Starter Kit examples help you develop applications using the PowerPSoC family of devices. The kit is designed to develop lighting applications using PowerPSoC. This chapter assists you in understanding the functionality of the kit. 3.2 Programming PowerPSoC Device The PowerPSoC device on the board can be programmed using a MiniProg. To use MiniProg for programming, use the ISSP programming header J2 on the board, as shown in the following figure. Figure 3-1. ISSP (J2) Programming Header J2 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 15 [+] Feedback Kit Operation Figure 3-2. Connect MiniProg Connect the MiniProg, as shown in the Figure 3-2 and program the board using PSoC Programmer. 16 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Kit Operation 3.3 CY3268 PowerPSoC Lighting Starter Kit Operation Figure 3-3. Kit Board The code example 1 is pre-loaded in the kit, when shipped. 1. Connect the power supply to a wall outlet and to the board. 2. Touch the CapSense® buttons CSB1 to CSB4 to turn on the HBLEDs initially. 3. Touch the CapSense buttons CSB1 to CSB4 to select/deselect corresponding HBLEDs. The HBLEDs blink when selected. 4. Touch the CapSense button CSB5 to increase/decrease the brightness of the selected HBLED. Touching CSB5 repeatedly increases the brightness of the selected HBLED. When the maximum brightness is reached, further touching CSB5 decreases the brightness. 5. Turn off the board by removing the power supply from the wall outlet. WARNING: HIGH BRIGHTNESS LEDs CAN CAUSE PERMANENT DAMAGE! Do not look at the HBLEDs directly. The HBLEDs illuminate at a very high intensity and can cause permanent eye damage. Use a thick white sheet of paper as diffuser if there is no optical diffuser available. WARNING: Generally all lab work in power electronics must be done with extreme care. Caution must be exercised when using power supplies and/or power related equipment. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 17 [+] Feedback Kit Operation 18 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback 4. 4.1 Hardware System Block Diagram The CY3268 PowerPSoC Lighting Starter Kit has the following sections: ■ Power supply system ❐ ■ Power on indicator LED (green) Programming interface ❐ ISSP/I2C header ■ Four HBLEDs (300 mA rating) ■ Five CapSense buttons ■ One reset switch ■ Debug port ■ Temperature sensor Figure 4-1. Block Diagram POWER SUPPLY FET OUTPUT ISSP INDUCTOR/ DIODE HBLEDs POWERPSoC 56 QFN DEBUG PORT OCD TEMP SENSOR GPIO NOTE: Red path is the power path CAPSENSE BUTTONS CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 19 [+] Feedback Hardware 4.2 Functional Description Figure 4-2. Components on the CY3268 PowerPSoC Board OCD Connector High Brightness LEDs Temperature Sensor DC Supply Jack Power Supply Indication LED Shielded Power Inductors RESET Switch PowerPSoC CY8CLED04DOCD1-56LTXI FN0 Extension Header ISSP Programming Header CapSense Buttons 20 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Hardware 4.2.1 Power Supply The power supply system on this board is versatile. It takes input supply from the following source: 7 V - 12 V wall wart supply using connector CON1 Figure 4-3. Power System Structure 4.2.1.1 Grounding Scheme Star Point for all GND points on the board. Figure 4-4. Star Grounding Scheme 4.2.2 PowerPSoC The CY3268 PowerPSoC Lighting Starter Kit is designed as the HBLED driver circuit. The specifications of the driver circuit in this design are: ■ Input voltage: 7 V minimum and 12 V maximum ■ HBLED output current per channel: 300 mA maximum ■ Expected efficiency: > 90% ■ Expected switching frequency: 800 kHz ■ Inductor current ripple: 30% of load current, that is, 30% of 300 mA = 90 mA CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 21 [+] Feedback Hardware Figure 4-5. PowerPSoC Connections 4.2.2.1 22 Applications of PowerPSoC ■ Stage lighting ■ Architectural lighting ■ General purpose lighting ■ Automotive and emergency vehicle lighting ■ Landscape lighting ■ Display lighting ■ Effects lighting ■ Signage lighting CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Hardware 4.2.2.2 Pin Details Table 4-1. Pin Description Pin No. Name Description Connected To 1 P1[0] GPIO/I2C SDA (Secondary)/ISSP SDATA ISSP SDATA (J2) 2 P2[2] GPIO/Direct Switch Cap connection CSB2 3 P0[3] GPIO/Analog Input (Column 0)/ Analog Output (Column 0) Thermistor 4 P0[5] GPIO/Analog Input (Column 0)/ Analog Output (Column 1) / CapSense Ref Cap GND 5 P0[7] GPIO/Analog Input (Column 0)/CapSense Ref Cap CSB4 6 P1[1] GPIO/I2C SCL (Secondary)/ISSP SCLK ISSP_SCK (J2) 7 P1[5] GPIO/I2C SDA (Primary) GND CSB5 8 P1[7] GPIO/I2C SCL (Primary) 9 VSS Digital Ground 10 OCDE On Chip Debugger Port J3 (Used to interface with the ICE for debugging) 11 OCDO On Chip Debugger Port J3 (Used to interface with the ICE for debugging) 12 CCLK On Chip Debugger Port J3 (Used to interface with the ICE for debugging) 13 HCLK On Chip Debugger Port J3 (Used to interface with the ICE for debugging) 14 XRES External Reset ISSP_XRES(J2, J3, Reset push button) 15 VDD Digital Power Supply 16 VSS Digital Ground 17 AVSS Analog Ground 18 AVDD Analog Power Supply 19 CSN2 Current Sense Negative Input 2 20 CSP2 Current Sense Positive Input and Power Supply CSA2 21 CSP3 Current Sense Positive Input and Power Supply CSA3 22 CSN3 Current Sense Negative Input 3 23 SREGCOMP Voltage Regulator Error Amp Comp 24 SREGFB Regulator Voltage Mode Feedback Node 25 SREGCSN Current Mode Feedback Negative 26 SREGCSP Current Mode Feedback Positive 27 SREGSW Switch Mode Regulator OUT 28 SREGHVIN Switch Mode Regulator IN 29 GDVDD Gate Driver Power Supply 30 GDVSS Gate Driver Ground 31 PGND3[2] Power FET Ground 3 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 23 [+] Feedback Hardware Table 4-1. Pin Description Pin No. 24 Name Description Connected To 32 GD3 External Low Side Gate Driver 3 33 SW3 Power Switch 3 34 PGND2[2] Power FET Ground 2 35 GD2 External Low Side Gate Driver 2 36 SW2 Power Switch 2 37 SW1 Power Switch 1 38 GD1 External Low Side Gate Driver 1 39 PGND1[2] Power FET Ground 1 40 SW0 Power Switch 0 41 GD0 External Low Side Gate Driver 0 42 PGND0[2] Power FET Ground 0 43 GDVSS Gate Driver Ground 44 GDVDD Gate Driver Power Supply 45 FN0[0] Function I/O J1 (GPIO 6x1 TH Header (F)) 46 FN0[1] Function I/O J1 (GPIO 6x1 TH Header (F)) 47 FN0[2] Function I/O J1 (GPIO 6x1 TH Header (F)) J1 (GPIO 6x1 TH Header (F)) 48 FN0[3] Function I/O 49 CSN0 Current Sense Negative Input 0 50 CSP0 Current Sense Positive Input and Power Supply CSA0 51 CSP1 Current Sense Positive Input and Power Supply CSA1 52 CSN1 Current Sense Negative Input 1 53 P0[4] GPIO/Analog Input (Column 1) / Bandgap Output 54 VDD Digital Power Supply 55 VSS Digital Ground 56 P1[4] GPIO / External Clock Input CSB3 CSB1 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Hardware 4.2.3 Programming Interface This kit allows programming using the ISSP/I2C programming interface that uses a MiniProg. 4.2.3.1 ISSP Programming The board also provides the option of using the MiniProg. This interface is faster and the ISSP programming is done through the 5-pin connector, J2. Figure 4-6. ISSP Programming The ISSP programming using J2 requires a programmer that can be purchased from here. Connector 4.2.4 Functionality J4 Used with issp_sck pin for programming; short pins 1 and 2 to enable pull-ups on I2C J5 Used with issp_sdata pin for programming; short pins 1 and 2 to enable pull-ups on I2C CapSense Sensors The board has five CapSense buttons. The board layout has considered the special requirements for CapSense. The CapSense button (CSB1) is connected to pin P1[4], CapSense button (CSB2) is connected to P2[2], CapSense button (CSB3) is connected to P0[4], CapSense button (CSB4) is connected to P0[7], and CapSense button (CSB5) is connected to P1[7]. CSB 1 CSB 2 CSB 3 CSB 4 CSB 5 LED 1 LED 2 LED 3 LED 4 DIM ON/OFF ON/OFF ON/OFF ON/OFF CYCLE COLORS CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 25 [+] Feedback Hardware Figure 4-7. CapSense Sensors 4.2.5 HBLEDs HBLEDs used in this kit are 300-mA rated. The third pin of the HBLED is for heatsink slug and is internally connected with the cathode of the HBLED terminals, but each heat slug must be electrically isolated when connected with a common heatsink. Figure 4-8. Converter Circuit for HBLED Operation (All four channels are shown) Inductors Shielded power inductors are normally used for noise suppression and are currently used in all applications. 26 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Hardware 4.2.6 RESET Button There is a reset button (SW1) in this kit. Figure 4-9. RESET Circuit 4.2.7 Debug Port There is a debug port to connect to the on-chip debugger (OCD) device to enable debugging. Figure 4-10. RJ45 - PCB Mounted Jack CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 27 [+] Feedback Hardware 4.2.8 Temperature Sensor There is a thermistor on board that helps to measure the temperature of HBLEDs. Figure 4-11. Thermistor Circuit 28 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback 5. Code Examples All code examples are available in the kit CD or in the installed directory <Install_Dir>\Cypress\CY3268 PowerPSoC\<version>\Firmware To create a project for HBLED applications using PowerPSoC, see application note AN51012 PowerPSoC Firmware Design Guidelines. This code example provides a basic understanding of the user modules available in PowerPSoC and how to use them. 5.1 Code Example 1: CY3268_Example1 5.1.1 Project Description This code example uses CapSense sensors to illuminate an HBLED. When the CapSense sensor (CSB1 to CSB4) is tapped, the corresponding HBLEDs glow. By tapping the CapSense sensor (CSB5), a selected HBLED goes from low to high brightness and back to low brightness. 5.1.2 Hardware Connections No hardware connections are required for this project because all connections are hardwired to specific pins on the board. The functional blocks of CY3268_Example1 are illustrated in Figure 5-1 on page 30. The user module has functional blocks such as CSA, CSD, PRISM, and HYSTCTRL. 5.1.2.1 Current Sense Amplifier (CSA): The CSA consists of two amplifier stages, stage 1 and stage 2. Stage 1 is used to level shift and amplify a high side input. The stage 1 gain is fixed at 4. stage 2 is used to amplify the stage 1 output. The stage 2 gain is fixed and is equal to 5. As a result, the total gain is fixed and is equal to 20. The CSA performs continuous time differential amplification of the input voltage. 5.1.2.2 CapSense Sigma Delta (CSD): CSD is used to scan the active capacitive sensors. The sensing is possible up to 15 mm glass overlay. It has high immunity to AC mains noise, EMC noise, and power supply voltage changes. It supports different combinations of independent and slide capacitive sensors. The CSD provides CapSense functionality using the switched capacitor technique with a sigma-delta modulator to convert the sensing switched capacitor current to digital code. 5.1.2.3 Precise Intensity Signal Modulation (PrISM): The PrISM compares the output of a pseudo-random counter with a signal density value. The comparator output asserts when the count value is less than (or less than or equal to) the value in the signal density register. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 29 [+] Feedback Code Examples 5.1.2.4 Hysteretic Controller (HYSTCTRL): The HYSTCTRL User Module is intended for use in HBLED applications as an intelligent controller for HBLEDs. It provides cycle-by-cycle switch control with a fast transient response. The hysteretic controller simplifies system design because it does not require external compensation. The gate drivers are used to drive either internal or external power FETs. Figure 5-1. PowerPSoC Interconnect Diagram for CY3268_Example1 30 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Code Examples 5.1.3 Program Flow Diagram START ENABLE GLOBAL INTERRUPTS SET LOWER AND UPPER CURRENT THRESHOLDS FOR ALL CHANNELS START CURRENT SENSE AMPLIFIERS AND PWM MODULES START CSD MODULE, SCAN ALL SENSORS AND INITIALIZE BASELINES; SET DEFAULT FINGER THRESHOLD START HYSTERETIC CONTROLLERS; ENERGIZE GATE DRIVES ON ALL CHANNELS B A LOOP FOREVER SCAN ALL SENSORS; UPDATE BASE LINES; SET SENSOR COUNT = 0 INCREMENT SENSOR NUMBER BY 1 NO IS SENSOR COUNT > 5? YES IS SENSOR WITH GIVEN NUMBER ACTIVE? YES IS FLAG FOR THE ACTIVE SENSOR = 1? NO NO SET CORRESPONDING SENSOR FLAG = 1 A YES B CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 31 [+] Feedback Code Examples B SET CORRESPONDING SENSOR FLAG = 0 IS SENSOR ONE, TWO, THREE OR FOUR ACTIVE? SET CORRESPONDING HBLED BRIGHTNESS TO ZERO; BLINK THE HBLED; SET THE BRIGHTNESS TO PREVIOUS SETTING YES NO NO IS SENSOR FIVE ACTIVE? YES UPDATE DIMMING LEVEL CURRENT DIMMING LEVEL = PREVIOUS DIMMING LEVEL + DELTA IS DIMMING LEVEL > MAX OR < MIN ? NO YES DELTA = -1 * DELTA SET NEW DIMMING LEVEL FOR SELECTED HBLED C END 32 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Code Examples 5.1.4 Verify Output When the code example is built and programmed into the device, the output of HBLED1, HBLED2, HBLED3, and HBLED4 glows when you tap the CapSense buttons (CSB1 to CSB4); it changes intensity when you tap CapSense button (CSB5) (see Figure 5-2). Figure 5-2. Verify Output - Code Example ■ CapSense button 1: Touch this button to turn on red HBLED and select it ■ CapSense button 2: Touch this button to turn on green HBLED and select it ■ CapSense button 3: Touch this button to turn on blue HBLED and select it ■ CapSense button 4: Touch this button to turn on amber HBLED and select it ■ CapSense button 5: Touch this button to vary the brightness of the selected HBLED 5.2 Code Example 2: CY3268_Heartbeat 5.2.1 Project Description The code example demonstrates the use of four channel color mixing algorithm using PowerPSoC. This example cycles through preset colors indefinitely when the CapSense button CSB5 is tapped. CSB1 to CSB4, when tapped, turn the HBLEDs on/off. Additionally, to stop cycling of colors, touch and hold CSB5 momentarily. 5.2.2 Hardware Connections No hardware connections are required for this project because all connections are hardwired to specific pins on the board. The functional blocks are illustrated in Figure 5-3. The user module has functional blocks such as CSD, PRISM, CSA, and HYSTCTRL. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 33 [+] Feedback Code Examples 5.2.2.1 CapSense Sigma Delta (CSD): CSD is used to scan the active capacitive sensors. The sensing is possible up to 15 mm glass overlay. It has high immunity to AC mains noise, EMC noise, and power supply voltage changes. It supports different combinations of independent and slide capacitive sensors. The CSD provides CapSense functionality using the switched capacitor technique with a sigma-delta modulator to convert the sensing switched capacitor current to digital code. 5.2.2.2 Precise Intensity Signal Modulation (PrISM): The PrISM compares the output of a pseudo-random counter with a signal density value. The comparator output asserts when the count value is less than (or less than or equal to) the value in the signal density register. 5.2.2.3 Current Sense Amplifier (CSA): The CSA consists of two amplifier stages, stage 1 and stage 2. Stage 1 is used to level shift and amplify a high side input. Stage 1 gain is fixed at 4. Stage 2 is used to amplify stage 1 output. Stage 2 gain is fixed and is equal to 5. As a result, the total gain is fixed and is equal to 20. The CSA performs continuous time differential amplification of the input voltage. 5.2.2.4 Hysteretic Controller (HYSTCTRL): The HYSTCTRL user module is intended for the use in HBLED applications as an intelligent controller for high brightness HBLEDs. It provides cycle-by-cycle switch control with a fast transient response. The hysteretic controller simplifies system design because it requires no external compensation. The gate drivers are used to drive either internal or external power FETs 34 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Code Examples Figure 5-3. PowerPSoC Interconnect Diagram for CY3268_Heartbeat CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 35 [+] Feedback Code Examples 5.2.3 Program Flow Diagram START INITIALIZE ALL VARIABLES; ENABLE GLOBAL INTERRUPT START CURRENT SENSE AMPLIFIERS AND PWM MODULES START HYSTERETIC CONTROLLERS; ENERGIZE GATE DRIVES ON ALL CHANNELS INITIALIZE EACH HBLED (x,y) CIE COORDINATES START CSD MODULE, SCAN ALL SENSORS AND INITIALIZE BASELINES; SET DEFAULT FINGER THRESHOLD A LOOP FOREVER NO IS FLAG = 1? YES B GET 4 CHANNEL HBLED DIMMING VALUES UPDATE DIMMING MODULATORS WITH NEW DIMMING VALUES CHOOSE NEXT COLOR TO DISPLAY; CHECK TO SEE IF COLOR COORDINATES FALL WITH IN THE ALLOWED VALUES B 36 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Code Examples B SCAN ALL SENSORS; UPDATE BASE LINES IS SENSOR ONE, TWO, THREE OR FOUR ACTIVE? YES IS THE CORRESPONDING HBLED ON? YES TURN IT OFF NO NO TURN IT ON NO IS SENSOR FIVE ACTIVE? YES NO IS FLAG = 1? SET FLAG = 1 YES SET FLAG = 0 A TURN OFF ALL HBLEDS A CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 37 [+] Feedback Code Examples 5.2.4 Verify Output When this code example is built and programmed into the device, all the HBLEDs glow indefinitely when CSB5 is touched. The output of HBLED1, HBLED2, HBLED3, and HBLED4 can be turned off and on by touching corresponding CapSense buttons. Figure 5-4. Verify Output - HeartBeat ■ CapSense button 1: Touch to turn red HBLED on/off ■ CapSense button 2: Touch to turn green HBLED on/off ■ CapSense button 3: Touch to turn blue HBLED on/off ■ CapSense button 4: Touch to turn amber HBLED on/off ■ CapSense button 5: Touch to start indefinite sequencing of colors. Touch and hold to stop. Note It is recommended not to look at the HBLEDs directly with the naked eye. For best viewing of colors, place a thick white sheet of paper on the HBLEDs or focus the light on a white wall. 38 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback A. Appendix A.1 Schematic A.1.1 PowerPSoC Device Connections CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 39 [+] Feedback A.2 Board Layout A.2.1 CY3268 PowerPSoC Board - Top Layer 40 CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback A.2.2 CY3268 PowerPSoC Board - Bottom Layer CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D 41 [+] Feedback A.3 Quantity Bill of Materials Reference Part Number Description Manufacturer 1 CON1 RAPC722X CONN Powerjack Mini .08" R/A T/H Switchcraft Inc. 1 C1 TR3B106K025C1100 CAP TANT 10 UF 25 V 10% SMD Vishay 7 C9,C10,C11,C LMK212SD104JG-T 12,C16,C30, CAP CER .10 UF 10 V 0805 LOW DIST Taiyo Yuden C31 5 C13,C19,C21, GRM188R61E105KA12 CAP CER 1UF 25 V X5R 0603 C24,C27 D Murata Electronics 1 C14 C0805C106K8PACTU CAP CERM 10 UF 10 V X5R 0805 Kemet 4 C15,C17,C25, C0603C104J3RACTU C28 CAP .1UF 25 V Ceramic X7R 0603 Kemet 1 C18 ECJ-2VB1C104K CAP .1UF 16V Ceramic X7R 0805 Panasonic - ECG 1 C20 GRM31CR61C106KC31 CAP CER 10UF 16 V 10% X5R 1206 L 1 C22 C0603C222J4RACTU 0603 SMD Ceramic Chip Capacitors 16 V 2200 pF X7R 5% Kemet 1 C26 C0603C104K8RACTU CAP .10UF 10V Ceramic X7R 0603 Kemet 1 C29 EMK107SD103JA-T CAP CER 10000 PF 16 V 0603 LOWDIST Taiyo Yuden 1 C32 GRM1885C1H301JA01 CAP CER 300PF 50V 5% C0G 0603 D 5 D3,D4,D5,D6, RSX051VA-30TR D7 Diode Schottky 30 V 500 MA TUMD2 Rohm 2 FB1,FB2 HF1206J150R-10 FERRITE 1A 19 Ω 1206 SMD Steward 1 F1 0154001.DRT FUSEBLOCK 1A SLO BLO SMD Littelfuse Inc 1 HBLED1 NS6R083T Red LED Nichia 1 HBLED2 NS6G083T Green LED Nichia 1 HBLED3 NS6B083T Blue LED Nichia 1 HBLED4 NS6A083T Amber LED Nichia 1 J1 PPTC061LFBN-RC CONN header female 6POS .1" TIN Sullins Connector Solutions 1 J2 22-23-2051 CONN header 5POS .100 VERT TIN Molex 1 J3 5558341-1 CONN MOD JACK 8-8 RT/A PCB 50AU Tyco 2 J4,J5 22-28-4020 CONN header 2POS .100 VERT TIN Molex/Waldom Electronics Corp 1 LED1 CMD15-21VGC/TR8 LED green clear 1206 SMD CML innovative 4 L1,L2,L3,L4 LPS6235-473MLC Inductor shield PWR 47UH SMD Coilcraft 1 L5 LPS4018-473MLC Inductor shield PWR 47UH SMD Coilcraft 4 M1,M2,M3,M4 PMS 440 0025 PH Screw machine Phillips 4-40X1/4 Building Fasteners 4 M9,M10,M11,M 2205 12 Srandoff hex 4-40THR ALUM 1" Keystone Electronics 1 RT1 2381 615 53103 Thermistor NTC 10K OHM 0805 SMD Vishay 1 R4 ERJ-8GEY0R00V RES 0 Ω 1/4W 5% 1206 SMD Panasonic - ECG 7 R11,R27,R30, ERJ-3GEYJ102V R37,R38,R39, RES 1.0 KΩ 1/10W 5% 0603 SMD Panasonic - ECG 42 Murata Electronics Murata Electronics CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback Quantity Reference Part Number Description Manufacturer R40 1 R12 RES 2.00 KΩ 1/10W 1% 0603 SMD Panasonic - ECG 6 R13,R21,R22, MCR03EZPFX5600 R23,R25,R26 ERJ-3EKF2001V RES 560 Ω 1/10W 1% 0603 SMD Rohm 4 R14,R16,R20, RL1632R-R220-F R24 RES .22 Ω 1/2W 1% 1206 SMD Susumu Co Ltd 1 R15 SR731JTTDR499F 0603 1/10 watt Lo-ohm thick film current KOA Speer sense resistors 0.499 Ω 1% 200 PPM 1 R17 ERJ-3EKF6980V RES 698 Ω 1/10 W 1% 0603 SMD Panasonic - ECG 1 R18 ERJ-3EKF2002V RES 20.0K Ω 1/10 W 1% 0603 SMD Panasonic - ECG 1 R19 ERJ-3EKF4022V RES 40.2K Ω 1/10 W 1% 0603 SMD Panasonic - ECG 2 R28,R31 RC0603JR-070RL RES 0.0 Ω 1/10 W 5% 0603 SMD Yageo Corporation 1 R32 MCR03EZPFX1002 RES 10.0K Ω 1/10 W 1% 0603 SMD Rohm 4 R33,R34,R35, MCR03EZPFX56R0 R36 RES 56.0 Ω 1/10 W 1% 0603 SMD Rohm 2 R41,R42 MCR03EZPFX4701 RES 4.70 KΩ 1/10W 1% 0603 SMD Rohm 1 SW1 EVQ-QXS03W Switch LT 6MM 160GF H=3.1MM SMD Panasonic - ECG 2 TP1,TP2 5004 Test point PC MINI .040"D yellow, through hole Keystone Electronics 1 TP3 5015 PC test point miniature SMT Keystone Electronics 1 U2 CY8CLED04DOCD56LTXI Rev C PowerPSoC intelligent LED driver - OCD Cypress Semiconductor Part 1 - 655-26AB BGA heat sink low profile 0.26" Wakefield Engineering 1 - 67-10-0150-t414 Thermally adhesive tape Chomerics Do Not Install 5 CSB1,CSB2,C SB3,CSB4,CS B5 1 C23 GRM188R61C105KA93 CAP CER 1.0UF 16V 10% X5R 0603 D 1 C33 ECH-U1C681GX5 CAP.00068UF 16V PPS FILM 0603 2% Panasonic - ECG 1 - - Optic CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D Murata Electronics - 43 [+] Feedback A.4 Safety Precautions Preparing a circuit ■ Use only isolated power sources (either isolated power supplies or AC power through isolation power transformers). This helps to use a grounded oscilloscope and reduces the risk of completing a circuit through your body or destroying the test equipment. Powering the circuit ■ Check all connections of the circuit and scope connections before powering the circuit, to avoid shorting or any ground loops that may lead to electrical shocks or damage of test equipment. ■ Know your board well – It is recommended to have the board schematic printed out. Recheck your wiring and circuit connections. Switching on the circuit ■ Apply only lower current settings (preferably 50 mA) while using the hysteretic controller. The demo firmware is configured for driving 300 mA through LEDs. ■ After functionality is proven, increase LED current by varying the hysteretic DAC thresholds, stopping at frequent levels to check for proper functioning of the circuit or to check if any components is hot or for any electrical noise that can affect circuit operation. Do not cross the limits for each of the thresholds mentioned in the sample code. ■ Follow the FET ‘turn on’ sequence suggested in the demo firmware. Switching off or shutting down the circuit ■ 44 Switch off all the power supplies and remove the power supply connections. CY3268 PowerPSoC® Lighting Starter Kit Guide, Document No. 001-67149 Rev. *D [+] Feedback