CY3270 PSoC® 1 FirstTouch™ Kit Guide Document No. 001-15945 Rev. *D Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone (USA): 800.858.1810 Phone (Intnl): 408.943.2600 http://www.cypress.com Copyrights Copyrights © Cypress Semiconductor Corporation, 2007-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 life-support 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. PSoC Designer™ and Programmable System-on-Chip™ are trademarks and PSoC® is a registered trademark of Cypress Semiconductor Corp. I²C is a registered trademark of Philips Electronics. All other trademarks or registered trademarks referenced herein are property of the respective corporations. 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. 2 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Contents 1. Introduction 1.1 1.2 1.3 1.4 5 Kit Contents ..............................................................................................................................6 Additional Learning Resources.................................................................................................6 1.2.1 Reference Documents ..................................................................................................6 Document History .....................................................................................................................7 Document Conventions ............................................................................................................7 2. Getting Started 2.1 2.2 2.3 2.4 2.5 2.6 Introduction ...............................................................................................................................9 CD Installation ..........................................................................................................................9 PSoC Designer .......................................................................................................................14 PSoC Programmer .................................................................................................................15 Install Hardware......................................................................................................................15 Run CapSense Touch Sensing Design ..................................................................................16 3. Kit Operation 3.1 3.2 9 17 Introduction .............................................................................................................................17 3.1.1 MultiFunction Expansion Card (FTMF) .......................................................................17 FTMF Expansion Card Demonstrations .................................................................................17 3.2.1 CapSense Touch Sensing Demonstration (Default)....................................................18 3.2.2 Temperature Sensing Demonstration..........................................................................18 3.2.3 Light Sensing Demonstration ......................................................................................18 3.2.4 CapSense Proximity Sensing Demonstration .............................................................18 4. Hardware 19 4.1 4.2 System Block Diagram ...........................................................................................................19 FTPC Bridge (First Touch PC Bridge) ....................................................................................20 4.2.1 LED Usage..................................................................................................................21 Expansion Card Overview ......................................................................................................23 Expansion Card Details ..........................................................................................................23 4.4.1 FirstTouch MultiFunction Expansion (FTMF) Card......................................................23 4.3 4.4 5. Code Examples 5.1 5.2 5.3 29 My First Code Example ..........................................................................................................29 5.1.1 Project Objective .........................................................................................................29 5.1.2 Flowchart.....................................................................................................................30 5.1.3 Creating My First PSoC 1 Project ...............................................................................31 MultiFunction Expansion Card Light Sensor...........................................................................51 5.2.1 Device Configuration...................................................................................................52 5.2.2 Firmware Architecture .................................................................................................53 MultiFunction Expansion Card Proximity Sensor....................................................................54 5.3.1 Device Configuration...................................................................................................55 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 3 Contents 5.4 5.3.2 Firmware Architecture................................................................................................. 56 Multifunction Expansion Card Temperature Sensor............................................................... 57 5.4.1 Device Configuration .................................................................................................. 58 5.4.2 Firmware Architecture................................................................................................. 59 A. Appendix 61 A.1 Schematic............................................................................................................................... 61 A.1.1 First Touch PC Bridge Schematic ............................................................................... 61 A.1.2 First Touch Multifunction Card Schematic .................................................................. 62 Board Layout .......................................................................................................................... 63 A.2.1 PDCR-9402 Primary side ........................................................................................... 63 A.2.2 PDCR-9402 Secondary Side ...................................................................................... 63 A.2.3 Assembly Drawing of First touch Multifunction Card (Primary side) ........................... 63 A.2.4 Assembly Drawing of First touch Multifunction Card (Secondary Side) ..................... 64 A.2.5 PDCR-9403 Primary Side ........................................................................................... 64 A.2.6 PDCR-9403 Secondary Side ...................................................................................... 64 A.2.7 Assembly Drawing for FirstTouch PC Bridge .............................................................. 65 BOM ....................................................................................................................................... 66 A.3.1 FirstTouch Multifunction Board ................................................................................... 66 A.3.2 FirstTouch PC Bridge .................................................................................................. 67 A.2 A.3 4 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 1. Introduction Thank you for your interest in the CY3270 PSoC® 1 FirstTouch™ Kit (FTK). You can design your own projects with Cypress's easy-to-use Integrated Development Environment (IDE), PSoC Designer™, or by altering sample projects provided along with this kit. The CY3270 PSoC 1 FTK is described in the Help guides and examples projects that are available. The project “MF_CS_SLIDE” is programmed on the CY3270 PSoC 1 FTK as the default project for demonstration purposes. For more information on the default project, refer to Chapter 5. The CY3270 PSoC 1 FTK includes a USB interface dongle, referred to as the FTPC bridge, and a multifunction expansion card, referred to as the FTMF Expansion Card. The FTMF Expansion Card demonstrates a variety of applications using ‘PSoC Powered Peripherals’. The FTMF Expansion Card connects to the bridge through the bridge’s built-in 8×2 pin expansion port. As the name implies, the FTPC bridge forms the connection between the FTMF Expansion Card and the various PC applications that control and communicate with the FTMF Expansion Card. The FTPC bridge portion of the kit contains a programmed Cypress CY8C24894 PSoC that performs all of the USB and expansion card interface functions. The firmware that is run by this PSoC performs the following primary functions: ■ Functions as a USB physical and logical interface ■ Provides PSoC MiniProg emulation for in system serial programming (ISSP) of the expansion cards ■ Provides communications with the PSoC programming utility ■ Performs HID data channel communications ■ ■ Performs expansion card I2C communications Performs expansion card SPI communications There are no other active components inside of the FTPC bridge. All of these interfaces run on a single PSoC device. Future projects for the FirstTouch kit allow you to modify the FTPC firmware and try some USB Interface designs of your own. The FirstTouch expansion card connects to the FTPC bridge through the bridge’s 8×2 pin expansion port. This expansion port provides all of the necessary signals to program the host PSoC on the expansion card. The expansion port also provides power, ground, and I2C or SPI communications to and from the expansion card host PSoC and PC. The FirstTouch expansion card has a dedicated host PSoC. Therefore, when it is programmed with your design, the expansion cards can operate either detached from the FTPC bridge in standalone mode or connected to your system hardware. It is necessary to provide power and ground for the expansion card to operate in either of these two arrangements. There are four unused analog or digital GPIO pins on the FTPC port and four unused analog or digital GPIO pins on the expansion card. This allows you to create custom designs and connect the signals you want to the FTPC bridge or the FirstTouch expansion cards. These GPIO pins on the PSoC are not connected to the header by default; zero ohm resistors (R9-R12) must be placed to use these GPIOs. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 5 Introduction Chapter 2 describes the installation and configuration of the CY3270 PSoC 1 FTK. Chapter 3 describes the kit operation. It explains the programming of a PSoC 1 device with the PSoC Programmer, and the usage of the kit with the help of an example project. Chapter 4 describes the hardware operation. Chapter 5 provides information about the firmware and example project. The Appendix A section provides the schematics and BOM associated with the PSoC Designer 5.1. You can evaluate the included sample projects and then experiment with the included hardware and software to create your own designs. 1.1 Kit Contents The CY3270 PSoC 1 FTK contains: ■ FirstTouch PC bridge. ■ FirstTouch multifunction card ■ CY8C21434-24LTXI sample ■ Single strand wire (for proximity) ■ CY3270-FTK Kit CD ❐ PSoC Designer installation file ❐ PSoC Programmer installation file ❐ Bridge control panel installation file (packaged along with PSoC Programmer) ❐ Code examples ❐ Hardware files ❐ Kit guide ❐ Quick start guide Release notes Inspect the contents of the kit. If any parts are missing, contact your nearest Cypress sales office for ❐ further assistance. 1.2 Additional Learning Resources Visit www.cypress.com for additional learning resources in the form of data sheets, technical reference manual, and application notes. 1.2.1 Reference Documents ■ ■ ■ 6 Application note - AN2216 - PSoC® 1 - Estimating PSoC Power Consumption http://www.cypress.com/?rID=2913 PSoC CY8C21434 - Chip features and related documents: http://www.cypress.com/?mpn=CY8C21434-24LQXI PSoC CY8C27443- Chip features and related documents: http://www.cypress.com/?mpn=CY8C27443-24SXI ■ FIRST TOUCH MF_Board Schematic.pdf http://www.cypress.com/?docID=22557 ■ For more information regarding PSoC Designer functionality and releases: www.cypress.com/go/psocdesigner ■ For more information regarding PSoC Programmer, supported hardware and COM layer: www.cypress.com/go/psocprogrammer ■ For a list of PSoC Designer-related trainings, see http://www.cypress.com/?rID=40543 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Introduction 1.3 Document History PDF Creation Revision Date Origin of Description of Change Change ** 08/17/2007 SXF *A 02/08/2011 RKPM Updated template. New document *B 02/16/2011 GNKK Formatted page layout in TOC. Updated link in CD Installation section. *C 02/22/2011 RKPM Removed reference to PSoC Express from Copyright information. Removed references to PSoC Designer version in Chapter 2. *D 1.4 05/25/2011 RKPM Changed document title to CY3270 PSoC® 1 FirstTouch™ Kit Guide. Code Examples chapter: Added ‘My First Code Example’ section; updated all flowcharts. Document Conventions Table 1-1. Document Conventions for Guides Convention Courier New Italics [Bracketed,Bold] File > Open Bold Times New Roman Text in gray boxes Usage Displays file locations, User entered text, and source code: C:\ ...cd\icc\ Displays file names and reference documentation: Read about the sourcefile.hex file in the PSoC Designer User Guide. Displays keyboard commands in procedures: [Enter] or [Ctrl][C] Represents menu paths: File > Open >New Project Displays commands, menu paths, and icon names in procedures: Click the File icon and then click Open. Displays an equation: 2+2=4 Describes cautions or uniwue functionality of the product. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 7 Introduction 8 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 2. 2.1 Getting Started Introduction This chapter describes how to install and configure the CY3270 PSoC 1 FTK. 2.2 CD Installation To install the CY3270 PSoC 1 FTK, 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 menu appears. Note You can also download the latest kit installer from http://www.cypress.com/go/CY3270-FTK. Three different types of installers are available for download. ■ CY3270-FTK_ISO: This file (ISO image) is an archive file of the optical disc provided with the kit. You can use this to create an installer CD or extract information using WinRar or similar tools. ■ CY3270-FTK_ Single Package: This executable file installs the contents of the kit CD, which includes PSoC Programmer, PSoC Designer, kit code examples, kit hardware files, and user documents. ■ CY3270-FTK_Single Package (without prerequisites): This executable file installs only the kit contents, which includes kit code examples, hardware files, and user documents. Download the kit installer ISO file and create an installer CD, or extract the ISO using WinRar and install the executables. 2. Click Install CY3270-FTK to start the installation as shown in Figure 2-1. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 9 Getting Started Figure 2-1. Kit Installer Menu Note If auto-run does not execute, double-click cyautorun.exe file on the root directory of the CD as shown in Figure 2-2. Figure 2-2. Root Directory of the CD 3. The InstallShield Wizard screen appears. On this screen, 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. 10 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Getting Started Figure 2-3. InstallShield Wizard 5. On the Product Installation Overview screen, select the installation type that best suits your requirement. The drop-down menu has three 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. After the installation begins, a list of all packages appears on the Installation Page. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 11 Getting Started 8. A green check mark appears next to each package as it is downloaded and installed (see Figure 2-5. 9. Wait until all the packages are downloaded and installed successfully. Figure 2-5. Installation Page 12 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Getting Started 10.Click Finish to complete the installation of the kit installer as shown in Figure 2-6. Figure 2-6. Installation Completion Page After installing the software, verify that you have all hardware and drivers setup for the CY3270 PSoC 1 FTK by connecting the kit to your PC through its USB interface. As this is the first time you connect the board to this PC, initial drivers get 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 kit board attached. Note Advanced users can skip to the Code Examples chapter. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 13 Getting Started 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 on the PSoC Designer <version> menu or click File > Open to work with an existing project on the PSoC Designer <version> menu Figure 2-7. PSoC Designer Interconnect View 3. To experiment with the example projects, go to Chapter 5. Note For more details on PSoC Designer go to the PSoC Designer IDE Guide at the following location: <InstallDirectory>:\Program Files\Cypress\PSoC Designer\<version>\Documentation See Additional Learning Resources on page 6 for links to PSoC Designer training. The PSoC Designer quick start guide is available at http://www.cypress.com/?rID=47954. 14 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Getting Started 2.4 PSoC Programmer 1. Click Start > All Programs > Cypress > PSoC Programmer <version>> PSoC Programmer <version> (Figure 2-8). 2. Select the MiniProg from the port selection as shown in Figure 2-8. Figure 2-8. PSoC Programmer Window 3. Click File Load to load the hex file. 4. Use the Program button to program the hex file on to the chip. 5. After programming is successful, Programming Succeeded appears in the Action Pane. 6. Close PSoC Programmer. Note For more details on PSoC Programmer go to the Programmer user guide at: <InstallDirectory>:\Program Files\Cypress\Programmer\<version>\Documents. 2.5 Install Hardware Insert the PSoC FirstTouch Starter Kit (FTPC Bridge and FTMF Expansion Card connected) into your computer’s USB port. In the ‘Found New Hardware Wizard’ window, select No, not this time. In the second ‘Found New Hardware Wizard’ window, select Install the software automatically. Alternatively, direct the New Hardware wizard to \..\Program Files\Cypress\PSoC Programmer\drivers\ on your computer. If prompted with a 'Driver Verification' message, click Continue Anyway. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 15 Getting Started 2.6 Run CapSense Touch Sensing Design To install the kit hardware and run the CapSense touch sensing design, continue as follows: 1. Remove both end caps from the FTPC Bridge and then connect the FTMF Expansion Card into the header of the FTPC Bridge such that ‘Cypress Perform’ is visible on both boards. Insert the assembled kit in your computer’s USB port. Select Cancel in the ‘Found New Hardware Wizard’ window that appears. 2. Slide your finger along the CapSense touch sensing slider found on the furthest point away from your computer. Notice the LED variation based on the position of your finger on the slider. This is the CapSense touch sensing design working right out of the box. 16 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 3. 3.1 Kit Operation Introduction The CY3270 PSoC 1 FTK examples help you develop applications using the PSoC 1 family of devices. The kit is designed to showcase how PSoC 1 can be used to easily develop temperature, CapSense, light, and proximity sensing applications. 3.1.1 MultiFunction Expansion Card (FTMF) The FTMF card is connected to the PC bridge as shown in Figure 3-1. Figure 3-1. FTMF Card connected to PC Bridge 3.1.1.1 Programming FTMF FTMF is programmed using the PC bridge and power is supplied through USB to the card. PSoC Programmer is used to program the .hex file on to the FTMF card. 3.2 FTMF Expansion Card Demonstrations The FTMF expansion card provided in your kit is capable of supporting a variety of demonstrations. Each demonstration has an associated PSoC Designer project and a datasheet that describes the operation and usage of each of the demonstrations in detail. Since the FTMF expansion card has its own PSoC, you can remove it from the FTPC bridge and insert it into your target hardware or another development platform. To observe each of the various FTMF demonstrations, it is necessary to reprogram the FTMF card with the appropriate demonstration firmware. A short description of this follows. See Chapter 5 for more information. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 17 Kit Operation Figure 3-2. FTMF Expansion Card 3.2.1 CapSense Touch Sensing Demonstration (Default) The pre-programmed CapSense touch sensing demonstration shows how to use the CapSense touch sensing slider at the end of the board to control LED color. Run your finger across the CapSense touch sensing slider and notice how the color of the LED changes. The CY8C21434 PSoC that resides on the FTMF expansion card detects your finger’s position on the CapSense touch sensing slider and controls the LED’s output. 3.2.2 Temperature Sensing Demonstration The temperature sensing demonstration shows how to use a temperature sensor to control LED color. Touch the temperature sensor and notice how the LED color changes. Removing your finger leads to the LED color slowly reverting back to its initial state. PSoC detects the temperature and controls the LED’s output. 3.2.3 Light Sensing Demonstration The light sensing demonstration shows how to use an ambient light sensor to control LED intensity. Cover the light sensor with the palm of your hand and notice how the intensity of the LED changes. Removing your palm leads to the LED intensity reverting back to its initial state. PSoC detects the ambient light and controls the LED’s output. 3.2.4 CapSense Proximity Sensing Demonstration The CapSense proximity sensing demonstration shows how to use a proximity sensor to control LED color. The proximity detector requires a proximity antenna and can sense an object with approximately 2 to 3 inches of range. In the FirstTouch Kit, this sense antenna is formed by attaching the provided wire into the pin socket labeled PRX1 as shown in Figure 3-2. Note how the shape and position of the wire affects the demonstration operation and the proximity sensing distance. Approach the CapSense proximity sensor slowly with your fingers and notice how the color of the LED changes. Removing your fingers leads to the LED color slowly reverting back to its initial state. The CY8C21434 PSoC that resides on the FTMF expansion card detects the relative proximity of your fingers to the FTMF expansion card and controls the LED’s output. 18 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 4. 4.1 Hardware System Block Diagram The CY3270 PSoC 1 FTK has the following sections. ■ PC bridge (FTPC bridge) ■ Multifunction card Figure 4-1. System Block Diagram for FirstTouch PC Bridge (FTPC Bridge) USB Port Blue LED Programming and Interface Connector PSoC CY8C24894 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 19 Hardware Figure 4-2. System Block Diagram for First Touch Multifunction Card Ambient Light Detector Blue LED Programming and Interface Connector PSoC CY8C21434 CapSense Slider RGB Clusters CapSense Proximity Sensor Thermistor 4.2 FTPC Bridge (First Touch PC Bridge) The PC bridge consists of the CY8C24894 Hub. It contains a 16-pin connector to connect to the MultiFunction Board for application data exchange.The FTPC Bridge is the interface bridge between the expansion card, your PC, and the various applications. Since the FTPC Bridge enumerates as a special type of 'composite device' that contains a PSoC Mini-Prog interface, the standard PSoC Programmer utility can identify and communicate with the FTPC bridge. Universal Serial Bus (USB) is used to establish communication between the FTPC Bridge and a host controller (usually personal computers).The FTPC Bridge acts as the interface bridge between the expansion cards, your PC, and various applications such as PSoC Designer and the PSoC Programmer utility. The master CY8C24894 also acts as a PSoC programmer and downloads the firmware hex file on to the application. The ISSP programmer programs PSoC ICs with .hex files created with the Cypress PSoC Designer software. The programmer programs a PSoC chip mounted on your PCB, one at a time. It connects to your PCB with a 5-wire cable and to your PC with a USB cable. Programming operation can be automated by incorporating the programmer into a PC-based test system. The tester software communicates with the programmer-control software through a command-line interface. 20 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Hardware 4.2.1 LED Usage Blue LED The blue LED blinks fast when the bridge is first connected to the USB port of a PC. After hot plug and play is established, it blinks at a periodic interval to indicate that the hub is enumerated and functioning normally. The schematic for the FTPC Bridge shown in Figure 4-3 is in the CD included in the kit and on the CY3270 PSoC 1 FTK web page. Figure 4-3. CY8C24894 Schematic V50 J1 XRES894 CLK894 DAT894 V50 1 2 3 4 5 ISSP894 C2 0805 V50 0.1 uFd C3 0805 0.1 uFd C4 0805 A ISSP-RADON + C5 10 uFd 10v 0.1 uFd U1 R4 R5 0805 1 2 3 4 5 6 27 27 0805 ISSP-RADON USB A RA PLUG SMD R6 100 R8 0805 0805 R7 SPI_nSS R1 100 Zero 0805 VBUS DM DP GND S1 S2 100K DM DP 21 20 DM DP XRES894 36 XRES ISSP_DAT 45 54 46 53 47 52 48 51 P0_0 P0_1 P0_2 P0_3 P0_4 P0_5 P0_6 P0_7 P3_0 P3_1 P3_2 P3_3 P3_4 P3_5 33 10 34 9 35 8 P3_7 7 25 18 26 17 27 16 28 15 P1_0 P1_1 P1_2 P1_3 P1_4 P1_5 P1_6 P1_7 P4_0 P4_1 P4_2 P4_3 P4_4 P4_5 P4_6 P4_7 37 6 38 5 39 4 40 3 41 2 42 1 43 56 44 55 P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7 P5_0 P5_1 P5_2 P5_3 P5_4 P5_5 P5_6 P5_7 29 14 30 13 31 12 32 11 P7_0 P7_7 24 23 P02 P03 P04 P05 ISSP_XRES ISSP_CLK 0805 ISSP-RADON DAT894 CLK894 0805 C6 R16 SDA_MOSI R15 SCL_SCLK R14 Zero 0805 Zero 0805 0.01 uFd SPI_MISO 22 49 Resettable Fuse J2 VDD1 VDD2 1206L V50 F1 350mA Zero 0805 DETECT TYPE TP0 TP2 TP4 TP6 D1 1 RADIAL 2 R13 1K GND1 GND2 EPAD V50 LED_ALIVE LED_ALIVE CY8C24894 QFN56 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 19 50 57 0805 LED Blue 21 Hardware Note that the CY8C24894 PSoC device is the only active component in the entire circuit. This single PSoC handles all communications between the applications, USB, and expansion card interfaces. The FirstTouch expansion card connects to the FTPC bridge through the 8×2 expansion port (this is a built-in port on the bridge). If you are using only the FirstTouch expansion card, it is not necessary to understand everything about this expansion port or the signals that it contains. By attaching an expansion card, all of the necessary connections are made. Figure 4-4 is the pinout diagram for the FTPC expansion port. Refer to this figure as you create projects. As you get more accustomed to the FirstTouch Kit and design flow, you may want to make your own expansion cards and, at that time, want to review the interface signals. Figure 4-4. FTPC Expansion Port Pinout Diagram V50 A + C1 22 uFd 10v NO LOAD 8x2 0.100" FEMALE Expansion Receptacle J3 1 3 5 7 9 11 13 15 ISSP_XRES ISSP_CLK ISSP_DAT TYPE SPI_MISO SPI_nSS VLOCAL VEXP_IN VEXP_OUT GND ISSP_XRES SDA-MOSI ISSP_CLK SCL-SCLK ISSP_DAT GPIO5 EXP_TYPE GPIO4 MISO GPIO3 SPI_nss GPIO2 2 4 6 8 10 12 14 16 DETECT SDA_MOSI SCL_SCLK GPIO5 GPIO4 GPIO3 GPIO2 8X2 PIN RECPT RA 22 100K R2 0805 0805 R3 100K CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Hardware 4.3 Expansion Card Overview The FirstTouch expansion card is designed to plug and play with the FTPC bridge. All power for the included expansion cards is provided by the FTPC bridge directly from the USB bus. No other power supply is necessary when an expansion card is connected to the FTPC bridge. Connection to the FTPC expansion port is through the 8×2 pin header on the expansion card. The FirstTouch expansion cards have a dedicated host PSoC device installed. The particular PSoC installed was chosen to act as an example as to which PSoC is most suitable for the types of applications that the particular expansion card supports. This also makes it easier to transfer your design from the FirstTouch kit to your hardware. By having a dedicated host PSoC, you can program and then remove the expansion card from the FTPC bridge. When removed, it operates in a standalone mode or connects to your system-level hardware. This creates a design that provides ‘PSoC Powered Peripherals’ and quickly integrates them into your system. Before doing so, it is important to review the schematic for the particular expansion card to determine the proper power and ground connections and voltage levels. The expansion card contains a variety of peripheral components that allow you to experiment with many different sensors and signal types. Each of the sensors use dedicated host PSoC I/O pins. Therefore, it is important to note which pins connect the various sensors to the host PSoC. These details are provided in the expansion card-specific portion of this guide. 4.4 Expansion Card Details This section provides details for the expansion cards included with the CY3270 PSoC 1 FTK. Future expansion cards will include additional documentation and demonstration projects that are specific to their operation and configuration. 4.4.1 FirstTouch MultiFunction Expansion (FTMF) Card The FTMF expansion card contains a CY8C21434 PSoC that acts as the 'host' for various demonstrations. The FTMF expansion card has hardware to support the following PSoC-powered peripheral applications: ■ CapSense '7-Element Touch Slider' ■ CapSense 'NonTouch/Proximity Detection' ■ Ambient light-level detection ■ Thermistor-based temperature measurement In addition to the above input sensors, the FTMF card also provides the following output devices: ■ Red-green-blue triple LED cluster ■ Buzzer ■ I2C digital communications ■ Four unused A/D GPIO lines for user functions The dedicated sensors and output devices on the FTMF expansion card help you quickly evaluate and experiment with a variety of PSoC applications, without having to build any hardware. Your PSoC Designer project completely determines the remaining FTMF expansion card functions. The kit installation contains demonstration projects that use the following input sensors: ■ CapSense slider ■ Temperature sensor ■ Ambient light sensor ■ CapSense proximity sensor CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 23 Hardware The FTMF expansion card uses a standard FirstTouch expansion header to connect to the FirstTouch RF expansion board or other target hardware. Figure 4-5. FTMF Expansion Card Expansion Header Signals Note that the 8×2 pin expansion header also includes four GPIO connections labeled P02 to P05. These are hard wired to four unused Port 0 I/O pins on the CY8C21434 host and allow you to easily connect the FTMF expansion card to your specific hardware or sensors. GPIO pins on the PSoC are not connected to the header by default; zero ohm resistors (R9-R12) must be placed to use these GPIOs. These I/O pins are specifically chosen because they can operate as analog outputs, analog inputs, digital inputs, digital outputs, or any combination of the four types; this pin selection makes them true analog or digital GPIO. PSoC Designer project designates the specific function for these A/D GPIO pins. You can use the sensors and output devices in any way you want within your project, but make certain you always assign the correct pins within your project. Failure to do so may cause unpredictable or unplanned project results. Figure 4-6. On Board Thermistor Schematic TV8 VEXP R1 R20 0603 0603 1 10K .1% RT1 10K 1% D4 2.4V 150mW 2 ZVREF 25 Temperature Sensor 2 560 1 TSENSE The thermistor is used to measure the temperature and will be given as the input to PSoC. The LEDs are used to represent the different values received from the device. A buzzer can be used as a sound alert when the data goes above or below a certain level. 24 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Hardware Figure 4-7. CapSense Slider Schematic CSB1 CSENSE1 R12 560 1 CS GND 2 0603 Cap Sense FTMF CSB2 CSENSE2 R13 560 1 CS GND 2 0603 Cap Sense FTMF CSB3 CSENSE3 R14 560 1 CS GND 2 0603 Cap Sense FTMF CSB4 CSENSE4 R15 560 1 CS GND 2 0603 Cap Sense FTMF CSB5 CSENSE5 R16 560 1 CS GND 2 0603 Cap Sense FTMF CSB6 CSENSE6 R17 560 1 CS GND 2 0603 Cap Sense FTMF CSB7 CSENSE7 R18 560 1 CS GND 2 0603 Cap Sense FTMF The CY8C21434 PSoC that resides on the FTMF expansion card detects your finger’s position on the CapSense touch sensing slider and controls the LEDs output. Adopting capacitive sensing as an interface technology in high-volume, high-visibility applications such as portable media players and mobile handsets has created demand for the same technology in more conventional consumer electronics. Its hardware details are shown in the Figure 4-7. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 25 Hardware Figure 4-8. Light Sensor Schematic 1 VEXP + PR1 LX1972A 2 Ambient Light Detector LSENSE 0603 R19 4.99K 1% Ambient light sensors consist of a filter to sample visible light, a photo diode for detection of brightness, a digital filter, and a digital/analog converter. They are able to detect the intensity of surrounding light. Figure 4-9. Proximity Sensor Schematic 1 VEXP + PR1 LX1972A 2 Ambient Light Detector LSENSE 0603 R19 4.99K 1% The proximity detector requires the use of a proximity antenna and can sense an object within approximately 2 to 3 inches of range. In the FirstTouch Kit, this sense antenna is formed by attaching the provided wire into the pin socket labeled PRX1. Note Upon power-up, the FTMF establishes a baseline reading of the proximity antenna. It is, therefore, necessary to connect the proximity antenna prior to plugging in the FirstTouch kit.The project is set up to recalculate this baseline approximately every 30 seconds. Note how the shape and position of the wire affects the demonstration operation and the proximity sensing distance. 4.4.1.1 CY8C21434 Chip The FTMF expansion card connects the various sensors and output devices to a predefined I/O of the host CY8C21434. It is important that you follow the pin assignment shown in Figure 4-10 and Table 4-1. Port P0[6] “LSENSE” is connected to the light sensor to receive signals for light sensitivity, P0[0] to sense temperature incident on the MF card. P1[6] drives a buzzer. P1[2], P1[3], and P1[4] are driving LED blue, red, and green respectively. P2[1] to P2[7] sense the touch on the 7-element CapSense region of the card. 26 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Hardware Figure 4-10. CY8C21434 Master VEXP VEXP VEXP PO2 PO3 PO4 PO5 LSENSE ZVREF TV2 TV3 TV4 TV5 24 1 25 31 26 30 27 29 P0_0 P0_1 P0_2 P0_3 P0_4 P0_5 P0_6 P0_7 20 5 21 4 22 3 23 2 P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7 17 ISSP_XRES P1_0 P1_1 P1_2 P1_3 P1_4 P1_5 P1_6 P1_7 13 11 14 10 15 9 16 8 ISSP_DAT ISSP_CLK LED_BLUE LED_RED LED_GRN I2C_SDA ALARM I2C_SCL 1 R7 560 P3_0 P3_1 P3_2 P3_3 18 7 19 6 R5 2.2K 2K C1 0603 12 32 CP CSENSE1 CSENSE2 CSENSE3 CSENSE4 CSENSE5 CSENSE6 CSENSE7 VSS VSS CP 1 RECEPTACLE 1x1 0603 28 XRES PRX1 0603 y VCC TSENSE 2.2K R9 0603 U3 0603 R10 0.01 uFd CY8C21434 MLF32 Table 4-1. FTMF PSoC Pin Assignments Pin Number Port Number 1 P0[1] CapSense modulator capacitor Design Function 2 P2[7] CapSense slider element 7 3 P2[5] CapSense slider element 5 4 P2[3] CapSense slider element 3 5 P2[1] CapSense slider element 1 6 P3[3] Unused / no-connect 7 P3[1] CapSense feedback resistor 8 P1[7] I2C clock line (SCL) 9 P1[5] I2C data line (SDA) 10 P1[3] Red LED drive 11 P1[1] In system programming clock (ISSP_SCLK) 12 GND 13 P1[0] In system programming data (ISSP_DAT) 14 P1[2] Blue LED drive 15 P1[4] Green LED drive 16 P1[6] Alarm/buzzer FET drive 17 XRES In system programming reset pin (ISSP_XRES) 18 P3[0] Unused / no-connect CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 27 Hardware Table 4-1. FTMF PSoC Pin Assignments 28 Pin Number Port Number Design Function 19 P3[2] Unused / no-connect 20 P2[0] CapSense proximity antenna pad (PRX1) 21 P2[2] CapSense slider element 2 22 P2[4] CapSense slider element 4 23 P2[6] CapSense slider element 6 24 P0[0] Thermistor temperature sensor analog input 25 P0[2] User A/D-GPIO 26 P0[4] User A/D-GPIO 27 P0[6] Ambient light detector analog input 28 +Vdd 29 P0[7] Thermistor drive-voltage reference analog input 30 P0[5] User A/D-GPIO 31 P0[3] User A/D-GPIO 32 GND CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 5. Code Examples 5.1 My First Code Example 5.1.1 Project Objective This code example demonstrates the CapSense feature of the FTMF board. The color of the LED changes with respect to the position of finger on the board. The code example contains the following User Modules: ■ CSD: The CSD module is used to scan the CapSense sensors and determine the finger position on the slider when touched. ■ LED: LED is used to display the output based on the data from CapSense. ■ EzI2Cs: The EzI2Cs module configures the PSoC on the multifunction board as an I2C slave. The slave data is available for acquisition using a bridge board that is configured as I2C master. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 29 Code Examples 5.1.2 Flowchart Start Enable Global Interrupts Initialize CSD, LED, EzI2Cs Module Read Finger Position on CapSense Slider If finger position is on slider positions CSB1- CSB3 Yes Turn ON Blue LED Yes Turn ON Green LED No If finger position is on slider positions CSB4, CSB5 No If finger position is on slider positions CSB6, CSB7 Yes Turn ON Red LED No Update EzI2Cs Registers 5.1.3 Creating My First PSoC 1 Project 1. Open PSoC Designer. 2. To create a new project, click File > New Project. 3. In the New Project window, select the Chip-level icon. Name the project Example_My_First_PSoC_Project; see Figure 5-1. 4. Click Browse and navigate to the directory in which the project is being created. 30 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples Figure 5-1. New Project Window 5. Click OK. The Select Project Type window opens. 6. In this window, under Select Target Device, click View Catalog. Figure 5-2. Select Project Type Window 7. The Device Catalog window opens. Click the All Devices tab. 8. For this project click CY8C21434-24LFXI and then click Select. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 31 Code Examples Figure 5-3. Device Catalog Window 32 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 9. Under Generate 'Main' File Using, select C and click OK. 10.By default, the project opens in chip view. Figure 5-4. Default View 11. Now place and configure the modules required for this design. Connect the modules together and to the pins of the PSoC. In the User Modules window, select the Cap Sensors folder. Figure 5-5. User Modules Window CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 33 Code Examples 12.In the Cap Sensors folder, right click on CSD and select Place. Figure 5-6. User Modules Window-CSD Select 13.A pop-up window opens with the configuration of the CSD module to be selected. Select CSD without clock prescaler as the default module. Click OK. Figure 5-7. CSD Configuration Window Select 34 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 14.The User Module (UM) CSD is placed in the analog and digital blocks respectively. Figure 5-8. CSD User Module Placement 15.Rename CSD_1 as CSD and configure the CSD properties. Figure 5-9. Configure CSD Parameters Window CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 35 Code Examples 16.Right click on the CSD user module icon and select the CSD Wizard option to assign pins to the sensors properly. Figure 5-10. Select CSD Wizard Window 36 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 17.Open the CSD Wizard window. Figure 5-11. Default CSD Wizard Window 18.The following screenshot shows the default settings in the Global Settings window. Figure 5-12. Default Global Settings Window CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 37 Code Examples 19.Configure the parameters in the window. Figure 5-13. Configured Global Settings Window 20.Click on Slider in the CSD wizard window. Following are the default settings in the Sensors Settings window. Figure 5-14. Default Sensors Settings 21.Configure the parameters in the Sensors Settings window. Figure 5-15. Configured Sensor Settings 38 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 22.To assign the sensor on the particular pin, click and drag from the sensor block to the required pin in the Pin Assignment window. Drag and drop S1 (0) of the slider to pin P2 [0]. The assignment of the sensor pins can be done in either Table Pin Assignment View (Figure 5-16) or Chip Pin Assignment View (Figure 5-17). Figure 5-16. S1 (0) Placed on P2 [0] Pin Block Figure 5-17. S1 (0) Assigned to Pin P2 [0] CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 39 Code Examples 23.Similarly, assign all the sensors from S1(1) through S1(7) to pins P2[1] through P2[7] and click OK. Figure 5-18. Sensors Assigned – Table Pin Assignment View 40 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 24.All the assigned sensors can be seen in Chip Pin Assignment View. Figure 5-19. Sensors Assigned - Chip Pin Assignment View CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 41 Code Examples 25.After configuration in the CSD Wizard window, the pins to which sensors are assigned can be seen in the Chip Level diagram. Figure 5-20. CSD Component 26.In the User Modules window, expand the Digital Comm folder, right click on EzI2Cs, and select Place to place an EzI2Cs in the design. Figure 5-21. EzI2Cs User Module selection 42 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 27.The EzI2Cs module does not require any digital or analog blocks for placement. It requires either (configurable) P1[0] and P1[1] or P1[5] and P1[7] port pins to operate as SCL and SDA. 28.Configure the EzI2Cs properties: Figure 5-22. EzI2Cs Properties CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 43 Code Examples 29.The EzI2Cs module can be seen in the Chip window. Figure 5-23. EzI2Cs Component 44 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 30..In the User Modules window, expand the Misc Digital folder, right click on LED, and select Place to place the LED. Figure 5-24. User Modules Window- LED Select 31.Configure LED properties and rename as LED_BLUE. Figure 5-25. LED Properties CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 45 Code Examples 32.After the configuration, LED_BLUE is assigned and is visible in the Chip Level diagram. Figure 5-26. LED User Module Placement 46 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 33.Place two more LED modules and configure as shown in the following screenshots. Figure 5-27. LED Red Properties. Figure 5-28. LED Green Properties CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 47 Code Examples 34.Place LED_GREEN, LED_RED, and LED_BLUE in their respective ports. Figure 5-29. All LEDs Placed 35.Keep the default values for the Global Resources window. Figure 5-30. Global Resources Window 48 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 36.Open the existing main.c file within Workspace Explorer. Replace the existing main.c content with the content of the embedded Example_ My_First_PSoC_Project_Main.c file, which is attached with this document. Figure 5-31. Workspace Explorer Window 37.Save the project. 38.Build the project; Build > Generate/Build 'Example_My_First_PSoC_Project' Project. 39.Connect the FirstTouch Multifunction Expansion(FTMF) card to the PC Bridge. Figure 5-32. FTMF Card Connection with PC Bridge 40.FTMF is programmed using PC Bridge. 41.The blue LED blinks fast when the bridge is first connected to the USB port of a PC. After hot plug and play is established, it blinks at a periodic interval to indicate that the bridge is enumerated and functioning normally. 42.To program the board through PSoC Designer IDE, follow these steps. 43.Click Program > Program Part (see Figure 5-33). Note When programming the board through PSoC Designer, close any open instance of PSoC Programmer. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 49 Code Examples Figure 5-33. Program Part Window 44.In the Program Part window, set up the following: a. In the Port Selection drop down box, FirstTouch/<MiniProg Number> is selected and it is 'Connected' b. Acquire Mode: Reset c. Verification: Off d. Power Settings: 5.0 V 45.Click on the Program button to start programming the board. The programming status can be observed on the progress bar. Figure 5-34. Programming Status 46.When programming is successful, the Operation Succeeded! message is displayed. Figure 5-35. ‘Operation Succeeded!’ Message 47.Disconnect the PC Bridge from the USB port of the PC. 50 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 5.1.3.1 Verify Output 1. Connect the PC Bridge to PC. 2. Connect the MultiFunction card to the PC bridge. 3. Move your finger across the CapSense slider to detect LED color change. ■ When the finger position is on slider position CSB1-CSB3, the LED emits the color blue. ■ When the finger position is on the slider position CSB4 or CSB5, the LED emits the color green. ■ When the finger position is on the slider position CSB6 or CSB7, the LED emits the color red. 4. For all other slider positions, the LED is OFF. This includes the absence of a finger on the slider. Figure 5-36 shows the change in LED color with respect to position of the finger on the board. Figure 5-36. LED Color Variation with Respect to Finger Position 5.2 MultiFunction Expansion Card Light Sensor The purpose of this code example is to demonstrate a light sensor. In this code example, the light sensor is used to control the brightness of the LED array The code example contains following User Modules: ■ ADC8: This module converts the analog input to the digital form.The ADC8 module is used to obtain the digital values for the light intensity. ■ LED: LED is used to display the output based on the data from ADC. ■ EzI2Cs: The EzI2Cs module configures PSoC on the MultiFunction board as I2C slave. The slave data is available for acquisition using a bridge board that is configured as I2C master. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 51 Code Examples 5.2.1 Device Configuration The chip level view of the code example, after placing all the required user modules, is shown in Figure 5-37 Figure 5-37. Device Configuration of Light Sensor 52 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 5.2.2 Firmware Architecture 5.2.2.1 Flowchart Start Enable Global Interrupts Initialize ADC, LED, EzI2Cs Modules Get ADC Data from Light Sensor If ADC_Data >ZERO Yes Turn ON Blue LED No Turn OFF Blue LED 5.2.2.2 Verify Output 1. When light is present, the LED is switched ON 2. When light is not present, LED is switched OFF CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 53 Code Examples Figure 5-38. Light Sense Output 5.3 MultiFunction Expansion Card Proximity Sensor This code example demonstrates the capacitive sensing and proximity detection capability of Cypress's PSoC technology. Proximity detection requires that you use the supplied blue proximity antenna. Insert the bare end of the wire in the PRX1 connector located in the middle of the board. As you move your finger near and far from the proximity detection antenna, the red and green LEDs turn on and off. At close proximity, the green LED turns ON. The code example contains the following User Modules ■ CSD: The CSD module is used to scan the CapSense based proximity sensor and determine the proximity of a object to the antenna. 54 ■ LED: LED is used to display the output based on the data from CapSense. ■ EzI2Cs: The EzI2Cs module configures the PSoC on Multifunction board as I2C slave. The Slave data is available for acquisition using a Bridge Board that is configured as I2C Master. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 5.3.1 Device Configuration The chip level view of the code example, after placing all the required user modules, is shown in Figure 5-39. Figure 5-39. Device Configuration of Proximity Sensor CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 55 Code Examples 5.3.2 Firmware Architecture 5.3.2.1 Flowchart Start Enable Global Interrupts Initialize CSD, LED, EzI2Cs Modules Get Finger Position around Proximity Sensor If Sensor_data >ZERO Yes Turn ON Green LED No Turn ON Red LED 5.3.2.2 Verify Output 1.The color changes when the finger is taken near the proximity antenna 2.The color remains red when no data is received from the antenna 56 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples Figure 5-40. Proximity Antenna Output 5.4 Multifunction Expansion Card Temperature Sensor This code example demonstrates the temperature sensing, thermistor reading, and calibrating capabilities of the PSoC device. Depending upon the temperature range within which a particular temperature reading is recorded, different colored LEDs (red, green, and blue) are turned ON or OFF. The code example contains following User Modules: ■ ADC10: These modules convert analog input to digital form.The ADC module is used to obtain the digital values for the temperature. ■ LED: LED is used to display the output based on the data from ADC. ■ EzI2Cs: The EzI2Cs module configures PSoC on the MultiFunction board as I2C slave. The Slave data is available for acquisition using a bridge board that is configured as I2C Master. ■ Counter8: This user module is used to control the buzzer output. CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 57 Code Examples 5.4.1 Device Configuration The chip level view of the code example, after placing all the required user modules, is shown in Figure 5-41 Figure 5-41. Device Configuration of Temperature Sensor 58 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D Code Examples 5.4.2 Firmware Architecture 5.4.2.1 Flowchart Start Enable Global Interrupts Initialize ADC, LED, EzI2Cs Module Get ADC Value Convert ADC Value to Temperature Value If temperature is between -10 C to 16 C Yes Turn ON Blue LED No If temperature is between 16 C to 28 C Yes Turn ON Green LED No If temperature is between 28 C to 55 C Yes Turn ON Red LED No Update EzI2Cs Registers 5.4.2.2 Verify Output ■ The red LED is ON only if the temperature is between 28 °C and 55 °C ■ The green LED is ON only if the temperature is between 16 °C and 28 °C ■ The blue LED is ON only if the temperature is between 16 °C and –10 °C" CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D 59 Code Examples Figure 5-42. Temperature Reading and Updated LED Status 60 CY3270 PSoC® FirstTouch™ Kit Guide, Document No. 001-15945 Rev. *D A. Appendix The schematic board layouts and BOM are available on the CY3270-FTK kit CD or at this location: <Install_directory>:\Cypress\CY3270-FTK\<version>\Hardware. A.1 Schematic A.1.1 First Touch PC Bridge Schematic V50 J1 1 2 3 4 5 XRES894 CLK894 DAT894 V50 ISSP894 C2 0805 V50 0.1 uFd C3 0805 0.1 uFd C4 0805 A V50 ISSP-RADON + C5 10 uFd 10v 0.1 uFd A + C1 22 uFd 10v NO LOAD 8x2 0.100" FEMALE Expansion Receptacle J3 1206L V50 ISSP_XRES ISSP_CLK ISSP_DAT TYPE SPI_MISO SPI_nSS J2 R4 R5 0805 1 2 3 4 5 6 22 22 21 20 XRES894 36 ISSP_DAT 45 54 46 53 47 52 48 51 DM DP VEXP_IN VLOCAL GND VEXP_OUT ISSP_XRES SDA-MOSI ISSP_CLK SCL-SCLK ISSP_DAT GPIO5 EXP_TYPE GPIO4 MISO GPIO3 SPI_nss GPIO2 2 4 6 8 10 12 14 16 DETECT SDA_MOSI SCL_SCLK GPIO5 GPIO4 GPIO3 GPIO2 8X2 PIN RECPT RA 0805 0805 0805 R8 100 SPI_nSS R1 100 Zero P02 P03 P04 P05 ISSP_XRES ISSP_CLK 0805 R7 100K P0_0 P0_1 P0_2 P0_3 P0_4 P0_5 P0_6 P0_7 P3_0 P3_1 P3_2 P3_3 P3_4 P3_5 P1_0 P1_1 P1_2 P1_3 P1_4 P1_5 P1_6 P1_7 P4_0 P4_1 P4_2 P4_3 P4_4 P4_5 P4_6 P4_7 P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7 P5_0 P5_1 P5_2 P5_3 P5_4 P5_5 P5_6 P5_7 P3_7 R2 0805 R3 XRES 0805 ISSP-RADON USB A RA PLUG SMD R6 DM DP VDD1 VDD2 U1 22 49 Resettable Fuse VBUS DM DP GND S1 S2 1 3 5 7 9 11 13 15 F1 350mA 100K 100K 33 10 34 9 35 8 7 0805 0805 DAT894 CLK894 SPI_MISO R16 SDA_MOSI R15 SCL_SCLK R14 Zero 0805 Zero 0805 Zero 37 6 38 5 39 4 40 3 R9 P05 GPIO5 NO LOAD R10 P04 GPIO4 0805 0805 TYPE 41 2 42 1 43 56 44 55 29 14 30 13 31 12 32 11 TP0 24 23 LED_ALIVE NO LOAD R11 P03 TP2 GPIO3 0805 DETECT NO LOAD R12 TP4 P02 TP6 GPIO2 0805 0.01 uFd 25 18 26 17 27 16 28 15 0805 ISSP-RADON C6 NO LOAD GND1 GND2 EPAD V50 D1 1 2 R13 1K LED_ALIVE RADIAL P7_0 P7_7 CY8C24894 QFN56 19 50 57 0805 LED Blue CY3270 PSoC® FirstTouch™ Kit Guide, Document No, 001-15945 Rev. *D 61 Appendix First Touch Multifunction Card Schematic RGB LED Cluster TV8 VEXP LED_BLUE R2 TSENSE LED_RED R4 CSB1 6 B CSENSE1 R12 5 G 3 560 1 4 CS GND 2 Cap Sense FTMF CSB2 R LED BLUE GREEN RED Temperature Sensor CSENSE2 R13 560 1 CS GND 2 2 0603 25 2 2 1K RT1 10K 1% D4 2.4V 150mW ZVREF 680 0603 1 1 0603 0603 10K .1% LED_GRN R3 0603 560 1 0603 R1 R20 7-Element CS Slider D1 560 0603 A.1.2 Cap Sense FTMF CSB3 CSENSE3 VEXP VCC 1 P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7 ISSP_XRES P1_0 P1_1 P1_2 P1_3 P1_4 P1_5 P1_6 P1_7 13 11 14 10 15 9 16 8 ISSP_DAT ISSP_CLK LED_BLUE LED_RED LED_GRN I2C_SDA ALARM I2C_SCL P3_0 P3_1 P3_2 P3_3 18 7 19 6 R5 CSENSE4 2.2K R15 560 1 CS GND 2 Cap Sense FTMF CSB5 CSENSE5 R16 560 1 CS GND 2 Cap Sense FTMF CSB6 CSENSE6 R17 560 1 CS GND 2 Cap Sense FTMF CSB7 2K CSENSE7 C1 0603 VSS VSS CP 2 0603 20 5 21 4 22 3 23 2 17 12 32 CP CSENSE1 CSENSE2 CSENSE3 CSENSE4 CSENSE5 CSENSE6 CSENSE7 R9 R18 560 0603 560 0603 Proximity PRX1 Sensor R7 1 1 Loop RECEPTACLE 1x1 P0_0 P0_1 P0_2 P0_3 P0_4 P0_5 P0_6 P0_7 XRES 2 0603 R19 4.99K 1% 24 1 25 31 26 30 27 29 CS GND Cap Sense FTMF CSB4 0603 PO2 PO3 PO4 PO5 LSENSE ZVREF TV2 TV3 TV4 TV5 LSENSE 1 0603 Ambient Light Detector TSENSE 2.2K 560 0603 + PR1 LX1972A 0603 28 U3 0603 R10 VEXP R14 VEXP 0603 VEXP 1 CS GND 2 0.01 uFd Cap Sense FTMF CY8C21434 MLF32 VEXP 0.100" 8x2 Male Pin Header VEXP VEXP 1 J1 LS1 CSS-J4D20 ISSP_XRES ISSP_CLK ISSP_DAT VEXP 2 TV1 0402 C2 0.1 uFd 0402 C3 0.1 uFd A + C4 4.7 uFd 16v NC VEXP_IN VEXP_OUT GND ISSP_XRES SDA-MOSI ISSP_CLK SCL-SCLK ISSP_DAT GPIO5 EXP_TYPE GPIO4 MISO GPIO3 SPI_nss GPIO2 2 4 6 8 10 12 14 16 I2C_SDA I2C_SCL PO5 PO4 PO3 PO2 8X2 PIN HDR RA 0603 R8 100 1 3 5 7 9 11 13 15 3 NOTE: This Expansion Board Does Not Have An Onboard Voltage Regulator - DO NOT Power With > 5Vdc SOT-23 ALARM R6 1K Q1 2N7002 1 VEXP TV7 PCB:PDCR-9402 0603 2 0603 R11 CYPRESS SEMICONDUCTOR © 2007 10K 1% Title FIRST TOUCH MULTI FUNCTION BOARD TV6 Size B 62 Document Number REF-14209 CY3270 PSoC® FirstTouch™ Kit Guide, Document No, 001-15945 Rev. *D Appendix A.2 Board Layout A.2.1 PDCR-9402 Primary side A.2.2 PDCR-9402 Secondary Side A.2.3 Assembly Drawing of First touch Multifunction Card (Primary side) CY3270 PSoC® FirstTouch™ Kit Guide, Document No, 001-15945 Rev. *D 63 Appendix A.2.4 Assembly Drawing of First touch Multifunction Card (Secondary Side) A.2.5 PDCR-9403 Primary Side A.2.6 PDCR-9403 Secondary Side 64 CY3270 PSoC® FirstTouch™ Kit Guide, Document No, 001-15945 Rev. *D Appendix A.2.7 Assembly Drawing for FirstTouch PC Bridge CY3270 PSoC® FirstTouch™ Kit Guide, Document No, 001-15945 Rev. *D 65 Appendix A.3 BOM A.3.1 FirstTouch Multifunction Board Item Qty Reference 1 1 C1 Description CAP 10000 PF 16 V CERM X7R 0603 Manufacturer Panasonic Mfr Part Number ECJ-1VB1C103K 2 2 C2,C3 CAP .10 UF 10 V CERAMIC X5R 040 Kemet C0402C104K8PACTU 3 1 C4 CAP 4.7 UF 16 V Tantalum 3216 Nichicon F931C475MAA SMLLX3632SISUGSBC 4 1 D1 LED RGB 3.2×3.6 MM CLR LENS SMD Lumex Opto/ Components Inc 5 1 D4 DIODE ZENER 2.4 V 150 MW S-MINI 2P Panasonic - SSG MAZ802400L 6 1 J1 CONN HEADER 16POS .100" R/A TIN Molex/Waldom Electronics Corp 90122-0128 7 1 LS1 BUZZER MAGNETIC 8.5 MM 3-5 V SMD CUI Inc CSS-J4D20 8 1 PRX1 Low Profile Single Pin Socket Thru Hole Samtec CES-101-01-T-S 9 1 PR1 IC AMBIENT LIGHT DETECTOR 1206 Microsemi-IPG LX1972IBC-TR 10 1 Q1 MOSFET N-CH 60V 115 MA SOT-23 Diodes Inc 2N7002-7-F 11 1 RT1 THERMISTOR NTC 10 KΩ 1% LEADED BC Components 2381 640 55103 12 1 R1 RES CHIP 10.0 KΩ 1/16 W .1% 0603 SMD Panasonic - ECG ERA-3AEB103V 13 1 R11 RES CHIP 10.0 KΩ 1/16 W 1% 0603 SMD Phycomp USA Inc 9C06031A1002FKHFT 14 1 R3 RES 680 Ω 1/10 W 5% 0603 SMD Panasonic - ECG ERJ-3GEYJ681V 15 2 R4,R6 RES 1.0 KΩ 1/16 W 5% 0603 SMD Panasonic - ECG ERJ-3GEYJ102V 16 1 R5 RES 2.0 KΩ 1/16W 5% 0603 SMD Panasonic - ECG ERJ-3GEYJ202V 17 1 R8 RES 100 Ω 1/16W 5% 0603 SMD Panasonic - ECG ERJ-3GEYJ101V 18 2 R10,R9 RES 2.2 KΩ 1/10W 5% 0603 SMD Panasonic - ECG ERJ-3GEYJ222V 19 1 R19 RES 4.99 KΩ 1/16W 1% 0603 SMD Panasonic - ECG ERJ-3EKF4991V 20 10 R2,R7,R12,R13,R14 ,R15, RES 560 Ω 1/10W 5% 0603 SMD R16,R17,R18,R20 Panasonic - ECG ERJ-3GEYJ561V 21 1 U3 IC PROGRAMMABLE SOC MLF32 Cypress Semiconductor CY8C21434-24LFXI 22 1 PCB PRINTED CIRCUIT BOARD Cypress Semiconductor PDCR-9402 Rev ** 23 1 LABEL1 Serial Number 24 1 LABEL2 PCA LABEL 121R-40200 Rev ** DO NOT INSTALL 25 7 CSB1-CSB7 26 8 TV1,TV2,TV3,TV4,T TEST VIA 40 HOLE 20 PLATED V5,TV6, TV7,TV8 66 CapSense Touch Element FTMF NA NA NONE CY3270 PSoC® FirstTouch™ Kit Guide, Document No, 001-15945 Rev. *D Appendix A.3.2 Item FirstTouch PC Bridge Qty Reference Description CAP .1 UF 50 V CERAMIC X7R 0805 Manufacturer Mfr Part Number Panasonic - ECG ECJ-2YB1H104K 1 3 C2,C3,C4 2 1 C5 CAP TANT LOWESR 10 UF 10 V 20% SMD AVX Corporation TPSA106M010R1800 3 1 C6 CAP 0.01 UF 50 V CERAMIC X7R 0805 Panasonic - ECG ECJ-2VB1H103K 4 1 D1 LED 3 MM DUAL FLANGE BLUE CLEAR LITE-ON INC LTL1CHTBK3 5 1 F1 THERMISTOR PTC 6 V .35 A RESETTABL Littelfuse Inc 1206L035YR 6 1 J2 CONN PLUG USB 4POS RT ANG Molex/Waldom SMD Electronics Corp 48037-1000 7 1 J3 PC Board Connector, Dual Row, Right Angle 16 Circuits Molex/Waldom Electronics Corp 90152-2116 8 4 R1,R14,R15,R16 RES 0.0 Ω 1/8W 5% 0805 SMD Rohm MCR10EZHJ000 9 3 R2,R3,R6 RES 100 KΩ 1/8W 5% 0805 SMD Rohm MCR10EZHJ104 10 2 R4,R5 RES 22 Ω 1/8W 5% 0805 SMD Panasonic - ECG ERJ-6GEYJ220V 11 2 R8,R7 RES 100 Ω 1/8W 5% 0805 SMD Rohm MCR10EZHJ101 12 1 R13 RES 1.0 KΩ 1/8W 5% 0805 SMD Rohm 13 1 U1 PSoC Mixed-Signal Array 14 1 PCB PRINTED CIRCUIT BOARD 15 1 LABEL1 Serial Number 16 1 LABEL2 PCA LABEL MCR10EZHJ102 Cypress Semiconductor CY8C24894-24LFXI Cypress Semiconductor PDCR-9403 Rev ** 121R-40300 Rev ** DO NOT INSTALL 17 1 J1 HEADER 0.1" SQ 5-PIN SMD AU NA NA 18 4 R9,R10,R11,R12 RES NO LOAD 0805 SMD NA NA 19 4 TP2,TP4,TP6,TP0 NA NA NA 20 1 C1 Kemet T491A226M010AS CAPACITOR TANT 22 UF 10 V 20% SMD CY3270 PSoC® FirstTouch™ Kit Guide, Document No, 001-15945 Rev. *D 67