Please Note That Cypress Is An Infineon Technologies Company
Please Note That Cypress Is An Infineon Technologies Company
The document following this cover page is marked as “Cypress” document as this is the
company that originally developed the product. Please note that Infineon will continue
to offer the product to new and existing customers as part of the Infineon product
portfolio.
www.infineon.com
AN77759
Getting Started with PSoC 5LP
Author: Nidhin MS
Associated Part Family: All PSoC 5LP parts
Related Documents: For a complete list, click here.
To get the latest version of this application note, or the associated project file, please
visit http://www.cypress.com/go/AN77759.
More code examples? We heard you.
To access an ever-growing list of hundreds of PSoC code examples, please visit our code
examples web page. You can also explore the Cypress video training library here.
AN77759 introduces you to PSoC® 5LP, an Arm® Cortex®-M3-based programmable system-on-chip. It describes the
PSoC 5LP architecture and development environment, and shows you how to create a simple design using
PSoC Creator™, the development tool for PSoC 5LP. This application note also guides you to more resources for in-
depth learning about PSoC 5LP as well as PSoC in general.
Contents
1 Introduction ............................................................... 1 6.3 Part 1: Create the Design ................................ 9
2 PSoC Resources ...................................................... 2 6.4 Part 2: Program the Device ........................... 16
3 PSoC Creator ........................................................... 2 7 Summary ................................................................ 18
3.1 PSoC Creator Help .......................................... 3 8 Related Documents ................................................ 18
3.2 Technical Support ............................................ 3 Document History............................................................ 22
4 Code Examples ........................................................ 4 Worldwide Sales and Design Support ............................. 23
5 PSoC 5LP Feature Set ............................................. 5 Products .......................................................................... 23
5.1 PSoC is More Than an MCU ........................... 7 PSoC® Solutions ............................................................. 23
5.2 The Concept of PSoC Creator Components .... 7 Cypress Developer Community....................................... 23
6 My First PSoC 5LP Design ....................................... 8 Technical Support ........................................................... 23
6.1 Before You Begin ............................................. 8
6.2 About The Design ............................................ 9
1 Introduction
PSoC 5LP is a true programmable embedded system-on-chip, integrating custom analog and digital peripheral
functions, memory, and an Arm Cortex-M3 CPU on a single chip.
PSoC 5LP provides a cost-effective alternative to the combination of MCU and external ICs. The PSoC 5LP
architecture boosts performance through:
▪ 32-bit Arm Cortex-M3 core plus DMA controller and digital filter processor, at up to 80 MHz
2 PSoC Resources
Cypress provides a wealth of data at www.cypress.com to help you to select the right PSoC device for your design,
and quickly and effectively integrate the device into your design. For a comprehensive list of resources, see
KBA86521, How to Design with PSoC 3, PSoC 4, and PSoC 5LP. The following is an abbreviated list for PSoC 3:
▪ Overview: PSoC Portfolio, PSoC Roadmap ▪ Technical Reference Manuals (TRM): Provide
detailed descriptions of the architecture and registers
▪ Product Selectors: PSoC 1, PSoC 3, in each of the PSoC 3, PSoC 4, PSoC 5LP, and
PSoC 4, PSoC 5LP, or PSoC 6 MCU. In PSoC 6 MCU device families.
addition, PSoC Creator includes a device
selection tool. ▪ PSoC Training Videos: These videos provide step-
by-step instructions on how to get started building
▪ Datasheets: Describe and provide electrical complex designs with PSoC.
specifications for the PSoC 3, PSoC 4,
PSoC 5LP, and PSoC 6 MCU device ▪ Development Kits:
families.
CY8CKIT-030 is designed for analog performance.
▪ CapSense® Design Guides: Learn how to It enables you to develop and evaluate high-
design capacitive touch-sensing applications precision analog, low-power, and low-voltage
with the PSoC 3, PSoC 4, PSoC 5LP, and applications.
PSoC 6 MCU families of devices. CY8CKIT-001 provides a common development
▪ Application Notes and Code Examples: platform where you can prototype and evaluate
different solutions using any one of the PSoC 1,
Cover a broad range of topics, from basic to
advanced level. Many of the application PSoC 3, PSoC 4, or PSoC 5LP architectures.
notes include code examples.
3 PSoC Creator
PSoC Creator is a free Windows-based Integrated Design Environment (IDE). It enables concurrent hardware and
firmware design of systems based on PSoC 3, PSoC 4, and PSoC 5LP. See Figure 1 – with PSoC Creator, you can:
1. Drag and drop Components for hardware 3. Configure Components using configuration tools
system design in the main design workspace 4. Explore the library of 100+ Components
2. Codesign your application firmware with the 5. Review Component datasheets
PSoC hardware
▪ Quick Start Guide: Choose the menu item Help > Documentation > Quick Start Guide. This guide gives you
the basics for developing PSoC Creator projects.
▪ Simple example projects: Choose the menu item File > Code Examples. These example projects demonstrate
how to configure and use PSoC Creator Components.
▪ System Reference Guide: Choose the menu item Help > System Reference > System Reference Guide. This
guide lists and describes the system functions provided by PSoC Creator.
▪ Component datasheets: Right-click a Component and select “Open Datasheet.” Visit the PSoC 5LP
Component Datasheets page for a list of all PSoC 5LP Component datasheets.
▪ Document Manager: PSoC Creator provides a document manager to help you to easily find and review
document resources. To open the document manager, choose the menu item Help > Document Manager.
▪ Self-help
▪ Review the code example for the selection. You can copy
and paste code from this window to your project, which can
help speed up code development, or
Analog Interconnect
Digital Interconnect
SIO
System Wide Digital System
GPIOs
Sequencer
16- Bit
Timer
Slave
Usage Example for UDB
( Optional) PWM UDB UDB
UDB UDB UDB UDB
22
Xtal
USB
Osc UDB FS USB
Clock Tree
PWM
IMO
GPIOs
Logic
32.768 KHz UDB UDB UDB UDB
UDB UDB
( Optional)
UART 12- Bit PWM
RTC
Timer
System Bus
GPIOs
Memory System CPU System Program &
WDT Debug
and Interrupt
EEPROM SRAM Cortex M3CPU Program
Wake Controller
Debug &
GPIOs
Trace
EMIF FLASH Cache PHUB Boundary
Controller DMA Scan
ILO
Clocking System
GPIOs
Digital Analog System
Power Management
SIOs
LCD Direct
System Filter +
Drive
Block 4x
ADCs 2x Opamp
POR and 3 per
LVD SAR -
Opamp
4 x SC / CT Blocks ADC
Sleep (TIA, PGA, Mixer etc)
Power
+
1.71 to
Temperature
5.5 V
GPIOs
1.8 V LDO Sensor 4x
4x DAC 1x CMP
Del Sig -
SMP CapSense ADC
0. 5 to 5.5 V
( Optional)
Following is a list of major features of the PSoC 5LP. For details, see Related Documents, or see a PSoC 5LP device
datasheet.
▪ Performance ▪ Memories
DC to 80-MHz operation Up to 256 KB program flash
32-bit Arm Cortex-M3 CPU, 32 interrupts Up to 32 KB additional flash for error correcting code
24-channel direct memory access (DMA) (ECC)
controller Up to 64 KB of SRAM
24-bit 64-tap digital filter processor (DFB) 2 KB EEPROM
Figure 5. Block Diagram of a Typical MCU Figure 6. PSoC 5LP Block Diagram
Gen I/O
Gen I/O
UART Digital System
ADC
(w/ Programmable Logic)
SPI
DAC ARM
CPU
Gen I/O
Gen I/O
I2C
Arm8051
Cortex-M3
Timer PWM
System Interconnect
Gen I/O
Gen I/O
Port C Port D Analog System
A typical MCU requires CPU firmware to process state machines, use a timer for timing, and drive an output pin.
Thus the functional path is almost always through the CPU. However with PSoC asynchronous parallel processing is
possible. You can configure a PSoC to have elements that operate independently from the CPU.
For example, Figure 6 shows that PSoC 5LP has no UART. However, you can make as many UARTs as you need
within the configurable digital logic, using the predesigned and pretested UART Component in PSoC Creator. You
can configure each UART to have as few or as many features as you need.
▪ Shows how to build a simple PSoC design and install it in a development kit
▪ Provides detailed steps that make it easy to learn PSoC design techniques using the PSoC Creator IDE
Figure 7. Breathing LED Schematic (Pin and LED are selected for CY8CKIT-059)
2. Select the project type for the CY8CKIT-059 kit. See Figure 9.
PSoC Creator can speed up the development process by automatically setting various project options for
specified development kits or target devices.
A. Click Target hardware.
B. In the pull-down menu, select Kit: CY8CKIT-059 (PSoC 5LP).
C. Click Next.
D
E
A project is created. Several new panes are displayed: Workspace Explorer, Schematic (TopDesign.cysch),
and Component Catalog.
A C
E
B
F
6. Drag from the Component Catalog to the schematic, and configure, the additional Components listed in Table 2.
The Off-Chip Components are not required, but help to show the overall purpose of the design.
Note that in each configuration dialog the Name field is automatically populated; you can change the name to
any valid text. Each Component name must be unique in the schematic.
Component Catalog
7. Select the wire tool (Figure 13) to connect Figure 13. Select the Wire Tool
the logic (or press ‘w’ as a shortcut).
Wire the Components as Figure 7 shows.
8. At this point, the hardware design is complete, however the Pin Component must still be associated with a
physical pin.
Choose the physical pin for the LED on the development kit that you are using. (For the CY8CKIT-059, the pin
used is port 2, pin 1, pr P2[1].)
A. In the Workspace Explorer window, double-click the .cydwr file in your project, as Figure 14 shows. This
opens the design-wide resources (DWR) window.
B. Select the Pins tab. The Pin Components defined in the project are displayed, as well as a pin diagram of
the target device.
C. Associate the schematic Pin Component with the desired physical pin.
9. You must now write a couple of lines of firmware. Before doing so, it is best to have PSoC Creator generate all of
the code that is associated with the Components.
Select the PSoC Creator menu item Build > Figure 15. Generate Application
Generate Application, as Figure 15 shows.
If there are no errors, PSoC Creator
generates several code files, under the folder
Generated_Source.
10. Add code to the auto-generated file main.c. It has a framework for adding code; the code that you must add, to
start the two PWM Components, is highlighted, as Code 1 shows. In the Workspace Explorer window, double-
click the main.c file in your project to open it.
Note: This code assumes that the PWM Components have the default names. If you renamed your PWM
Components to something other than the default values, use those names in the _Start() function calls.
int main()
{
//CyGlobalIntEnable; /* Enable global interrupts. */
for(;;)
{
/* Place your application code here. */
}
}
11. If you skipped to this step without going through the design process, do the following:
A. Download the code example file CE203303.zip from CE203303, and extract it to a convenient location in
your computer.
B. Download and install PSoC Creator as described in step 1 on page 9.
C. Open the file CE203303.cywrk in PSoC Creator.
D. Confirm that the project pin assignments match your development kit (DVK), as described in step 8 on
page 14.
E. Select the PSoC Creator menu item Figure 16. Build Project
Build > Build <project name>, as
Figure 16 shows. If there are no errors,
the project is built and ready to program
to the target DVK.
3. To program the PSoC 5LP, select the PSoC Figure 20. Program Device
Creator menu item Debug > Program, as
Figure 20 shows.
4. Programming begins; programming status is
displayed in the PSoC Creator status bar
(the lower-left corner of the window, as
Figure 21 shows).
Note: You may see a warning message
“This programmer is currently out of date”.
Refer to the KitProg User Guide in your kit
documentation for information on how to
upgrade your programmer firmware.
On the CY8CKIT-059 DVK, the blue LED gradually transitions from full ON to full OFF over a few seconds.
7 Summary
This application note explored the PSoC 5LP architecture and development tools. The most important concept to be
gained from this application note is that PSoC is more than an MCU. PSoC 5LP is a truly programmable embedded
system-on-chip, integrating configurable analog and digital peripheral functions, memory, and a 32-bit Cortex-M3
CPU on a single chip.
Because of the integrated features and low-leakage power modes, PSoC 5LP is an ideal choice for low-power and
cost- effective embedded systems.
8 Related Documents
Table 3 lists system-level and general application notes that are recommended for the next steps in learning about
PSoC and PSoC Creator:
Table 4 lists application notes (AN), code examples (CE), and knowledge base articles (KBA) that are linked to the
device description in PSoC 5LP Feature Set.
Memory
CE95375 SPI Master and DMA with PSoC® 3 and PSoC 5LP
CE95376 SPI Slave and DMA with PSoC® 3 and PSoC 5LP
CE95316 Filter From to ADC to VDAC Using DFB with PSoC® 3 and PSoC 5LP
CE95317 Filter From to ADC to VDAC Using DFB in Polling Mode with PSoC® 3 and PSoC 5LP
I2C
USB
AN52701 PSoC® 3 and PSoC 5LP – Getting Started with Controller Area Network (CAN)
CE95282 CAN as Control Node with PSoC® 3 and PSoC 5LP
CE95283 CAN as Remove Node with PSoC® 3 and PSoC 5LP
KBA86565 Difference Between Full CAN and Basic CAN Mailbox
KBA86566 Acceptance Filter Implementation for CAN Receive Message
KBA86567 Modifying the Full CAN Mailbox’s Identifier in the Program
AN82250 PSoC® 3, PSoC 4, and PSoC 5LP – Implementing Programmable Logic Designs with Verilog
AN82156 PSoC® 3, PSoC 4, and PSoC 5LP – Designing PSoC CreatorTM Components with UDB Datapaths
CE95295 8-Bit UDB Counter with PSoC® 3 and PSoC 5LP
CE95384 16-Bit UDB-Based Timer with PSoC® 3 and PSoC 5LP
CE95323 Hardware Fan Control with PSoC® 3 and PSoC 5LP
KBA85325 Comparison of Resource Utilization Between PSoC® 3 and PSoC 5LP UDBs and Other Vendor CPLDs
KBA86336 Just Enough Verilog for PSoC®
AN84783 Accurate Measurement Using PSoC® 3 and PSoC 5LP Delta-Sigma ADC
CE95277 Delta-Sigma ADC in Single-Ended Mode with PSoC® 3 and PSoC 5LP
CE95271 Delta-Sigma ADC in Differential Mode with PSoC® 3 and PSoC 5LP
CE95276 Sequencing SAR ADC with PSoC® 3 and PSoC 5LP
KBA81866 Best Method of Amplification to Get Better Performance from PSoC® 3 and PSoC 5LP Delta-Sigma ADC
KBA84753 Choice of Reference Voltage for Accurate ADC Measurements in PSoC® 3, PSoC 4 and PSoC 5LP
AN60305 Using PSoC® 3 and PSoC 5LP IDACs to build a better VDAC
AN64275 PSoC® 3 and PSoC 5LP: Getting More Resolution from 8-Bit DACs
AN69133 PSoC® 3 and PSoC 5LP Easy Waveform Generation with the WaveDAC8 Component
CE95397 Voltage DAC with PSoC® 3 and PSoC 5LP
CE95309 Dithered Voltage DAC with PSoC® 3 and PSoC 5LP
KBA84732 VDAC8 Output Voltage in PSoC® 3 and PSoC 5LP
KBA83238 Driving an External Load using VDAC in PSoC® 3 or PSoC 5LP
Comparator
CapSense
I/O
Segment LCD
Document History
Document Title: AN77759 - Getting Started with PSoC 5LP
Document Number: 001-77759
Products
PSoC® Solutions
Arm® Cortex® Microcontrollers cypress.com/arm
PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP | PSoC 6 MCU
Automotive cypress.com/automotive
Clocks & Buffers cypress.com/clocks Cypress Developer Community
Interface cypress.com/interface Forums | WICED IOT Forums | Projects | Videos | Blogs |
Training | Components
Internet of Things cypress.com/iot
Memory cypress.com/memory Technical Support
Microcontrollers cypress.com/mcu cypress.com/support
PSoC cypress.com/psoc
Power Management ICs cypress.com/pmic
Touch Sensing cypress.com/touch
USB Controllers cypress.com/usb
Wireless Connectivity cypress.com/wireless
All other trademarks or registered trademarks referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
© Cypress Semiconductor Corporation, 2012-2018. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including
Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by
Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such
laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other
intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with
Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to
sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for
use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end
users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of
Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for
use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD
TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. No computing device can be absolutely secure. Therefore, despite security
measures implemented in Cypress hardware or software products, Cypress does not assume any liability arising out of any security breach, such as
unauthorized access to or use of a Cypress product. In addition, the products described in these materials may contain design defects or errors known
as errata which may cause the product to deviate from published specifications. To the extent permitted by applicable law, Cypress reserves the right to
make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or
circuit described in this document. Any information provided in this document, including any sample design information or programming code, is
provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and
safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as
critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or
systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances
management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A
critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or
system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim,
damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and
against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of
Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are
trademarks or registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit
cypress.com. Other names and brands may be claimed as property of their respective owners.