background image

Getting started with PSoC

 6 MCU on PSoC

 Creator

About this document

Scope and purpose
AN221774 introduces the PSoC

 6 MCU, a dual-CPU programmable system-on-chip with Arm

®

 Cortex

®

M4 and

Cortex-M0+ processors. This application note helps you explore PSoC

 6 MCU architecture and development

tools, and shows you how to create your first project using PSoC

 Creator. This application note also guides

you to more resources available online to accelerate your learning about PSoC

 6 MCU. To get started with the

PSoC

 6 MCU with Bluetooth

®

 Low Energy (LE) Connectivity device family, refer to 

AN210781

 – Getting Started

with PSoC

 6 MCU with BLE Connectivity on PSoC

 Creator.

Associated part family
All 

PSoC

 6 MCU

 devices

Software version

PSoC

 Creator 4.2

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

.

Please visit the 

GitHub

 site for a comprehensive collection of code examples using ModusToolbox IDE for PSoC

6. You can also explore the PSoC

 video library

 here

.

Table of contents

About this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Table of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.1

Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.1.1

Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4

1.1.2

Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4

2

Development ecosystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

2.1

PSoC

 resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2

Firmware/application development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

2.2.1

Choosing an IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2.2

PSoC

 Creator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6

2.2.2.1

PSoC

 Creator help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2.3

Software development kits for PSoC

 6 devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3

Support for other IDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.4

RTOS support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9

2.4.1

RTOS support with PSoC

 Creator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.5

Programming/debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.6

PSoC

 6 MCU development kits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3

Device features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4

My first PSoC

 6 MCU design using PSoC

 Creator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

4.1

Using these instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

AN221774

Application Note

Please read the sections "Important notice" and "Warnings" at the end of this document

002-21774 Rev. *G

www.infineon.com

2022-07-21

Summary of Contents for PSoC 6

Page 1: ...list of hundreds of PSoC code examples please visit our code examples web page Please visit the GitHub site for a comprehensive collection of code examples using ModusToolbox IDE for PSoC 6 You can a...

Page 2: ...27 4 6 Part 4 Write the firmware 29 4 7 Part 5 Build the project and program the device 34 4 8 Part 6 Test your design 36 5 Summary 38 Related application notes and code examples 38 Glossary 40 Revisi...

Page 3: ...lexibility and dynamic fine tuning of the design using PSoC Creator the schematic based design tool Figure 1 illustrates an application level block diagram for a real world use case using PSoC 6 MCU M...

Page 4: ...E221773 for PSoC Creator For hardware design considerations see AN218241 PSoC 6 MCU Hardware Design Considerations 1 1 Prerequisites Before you get started make sure that you have a development kit an...

Page 5: ...etooth connectivity for development on ModusToolbox Training Videos Video training on our products and tools including a dedicated series on PSoC 6 MCU is available 2 2 Firmware application developmen...

Page 6: ...6 MCU device not supported on PSoC Creator PSoC Creator is the long standing proprietary tool that runs on Windows only This mature IDE includes a graphical editor that supports schematic based desig...

Page 7: ...you use in your firmware and include various middleware libraries for additional functionality like Bluetooth Low Energy LE connectivity or FreeRTOS This source code makes it easier to develop the fir...

Page 8: ...d and pre validated Components However the PDL is a source code library that you can use with any development environment The PDL includes the following key software resources Header and source files...

Page 9: ...Library FreeRTOS as shown in Figure 3 Figure 3 Import FreeRTOS in PSoC creator project If you have a preferred RTOS use the resources provided as examples on how to integrate such code with the PDL 2...

Page 10: ...devices with PSoC Creator refer to the PSoC Creator Help 2 6 PSoC 6 MCU development kits PSoC 6 Wi Fi BT Pioneer Kit CY8CKIT 062 WiFi BT and PSoC 6 Wi Fi BT Prototyping Kit CY8CPROTO 062 4343W are de...

Page 11: ...faces Up to 12 UDBs for custom digital peripherals Up to 32 TCPWM blocks configurable as 16 bit 32 bit timer counter PWM or quadrature decoder Up to 13 SCBs configurable as I2C Master or Slave SPI Mas...

Page 12: ...Figure 4 PSoC 6 MCU block diagram Getting started with PSoC 6 MCU on PSoC Creator 3 Device features Application Note 12 002 21774 Rev G 2022 07 21...

Page 13: ...nd follow all the instructions in this application note you use the code example as a reference while following the instructions You can download the code example from the website by clicking the link...

Page 14: ...Launch PSoC Creator and get started 1 Ensure that PSoC Creator can find the PDL This should be set correctly automatically during installation but nothing works if this isn t set up right Refer to Fi...

Page 15: ...workspace and open the workspace Figure 8 Open existing code example workspace 3 Select PSoC 6 MCU as the target device PSoC Creator speeds up the development process by automatically setting various...

Page 16: ...part number this is the place you choose to Launch Device Selector option in Target device and select the appropriate part number a b c d Figure 9 Selecting target device 4 Pick a project template a C...

Page 17: ...this step you set the name and location for your workplace and a name for the project See Figure 12 for help with this step A workspace is a container for one or more projects a Set the Workspace name...

Page 18: ...files You view these files in the Workspace Explorer pane to the left The project schematic opens by default This is the TopDesign cysch file Double click the file name in the explorer pane to open t...

Page 19: ...omponent Catalog expand the Communications group drag a UART SCB Component into the schematic and drop it It doesn t matter where you put a Component b Expand the Ports and Pins group and drag a Digit...

Page 20: ...ive LOW that is the logic HIGH pin drive state turns OFF the LED and the logic LOW pin drive state turns it ON Figure 15 shows the configuration Double click the Component placed on the schematic to o...

Page 21: ...Components to a design External Components on the schematic are included for descriptive purposes only they have no effect on the generated code Off chip Components are optional but can assist the ha...

Page 22: ...e clock source of the TCPWM is the peripheral clock Clk_Peri The design will use this interrupt to toggle the LED state Open the Component customizer and follow the steps illustrated in Figure 18 a Ch...

Page 23: ...mponent A B Figure 19 SysInt_PDL Settings As the final step connect the interrupt output of the TCPWM Component to the Isr_TCPWM Component input This routes the TCPWM interrupt to the CM4 CPU the sele...

Page 24: ...in the corresponding field or use the drop down menu to pick the port or pin Typically the port number is used instead of the pin number since these names are independent of the specific package being...

Page 25: ...Here you can see the clock tree and modify the clocks as required Note that there are tabs for different types of clocks such as Source Clocks FLL PLL High Frequency Clocks and Miscellaneous Clocks c...

Page 26: ...ick the Interrupts that is under Design Wide Resources The list of interrupts appears b Enable Isr_Timer for the CM4 CPU The interrupt numbers are generated automatically by PSoC Creator when you gene...

Page 27: ...before writing firmware PSoC Creator will automatically create macros constants and API calls that you may then use in your firmware 1 Generate the application Choose Build Generate Application PSoC C...

Page 28: ...ce file and select Properties Figure 25 shows the Properties dialog window By default the main_cm0p c file is targeted to the Cortex M0 and the main_cm4 c file is targeted to the Cortex M4 You do not...

Page 29: ...respective source codes to main_cm0p c and main_cm4 c from the code snippet provided in this section If you are using the code example files are already in your project Firmware flow In the remaining...

Page 30: ...enabled the UART Component is started and prints a Hello World message on the terminal emulator A Timer Counter PWM TCPWM Component is configured to generate an interrupt every second At each interrup...

Page 31: ...T_PutString UART_HW x1b 2J x1b H Cy_SCB_UART_PutString UART_HW CE221773 PSoC 6 MCU Hello World Example r n n Cy_SCB_UART_PutString UART_HW Hello World r n n Cy_SCB_UART_PutString UART_HW Press Enter k...

Page 32: ...oid Configure the TCPWM peripheral Counter_config structure is defined based on the parameters entered in the Component configuration Cy_TCPWM_Counter_Init Timer_HW Timer_CNT_NUM Timer_config Enable t...

Page 33: ...sage Hello World on to UART terminal Enter key pressed Yes No CM0 CPU CM4 CPU On TCPWM Interrupt Clear the TCPWM Interrupt Set the LEDupdateFlag Exit TCPWM Interrupt Handler LEDupdateFlag true Clear L...

Page 34: ...atch and encounter errors revisit prior steps to ensure that you accomplished all the required tasks You can work to resolve errors or switch to the code example for these final steps 1 Select the deb...

Page 35: ...gging this choice matters The debugger will see only the CPU you connect to These instructions do not use the debugger 2 Program the board Choose Debug Program to program the device with the project a...

Page 36: ...ctions on updating the firmware 4 8 Part 6 Test your design This section describes how to test your design Follow the steps below to observe the output of your design Note that the below steps use Ter...

Page 37: ...e printed from CM4 CPU 4 Enable the LED Blinking functionality Press the Enter key to start blinking the LED When the LED starts blinking the following message will be displayed on the UART terminal a...

Page 38: ...241 PSoC 6 MCU Hardware Design Considerations AN219434 PSoC 6 MCU Importing Generated Code into an IDE AN219528 PSoC 6 MCU Low Power Modes and Power Reduction Techniques Table 3 lists the application...

Page 39: ...Guide Bootloader AN213924 PSoC 6 MCU Bootloader Software Development Kit SDK Guide CE213903 PSoC 6 MCU Basic Bootloaders Communications CE220541 PSoC 6 MCU SCB EzI2C Audio CE218636 PSoC 6 MCU Inter IC...

Page 40: ...embedded system design with reliable easy to use solutions such as touch sensing and enables low power designs ModusToolbox An Eclipse based embedded design platform for IoT designers that provides a...

Page 41: ...B 2018 10 31 Updated images C 2018 11 15 Updated for public release D 2019 02 19 Updated for ModusToolbox 1 1 E 2019 10 14 Removed content for ModusToolbox 1 1 F 2021 03 14 Updated to Infineon Templat...

Page 42: ...liabilities of any kind including without limitation warranties of non infringement of intellectual property rights of any third party with respect to any and all information given in this application...

Reviews: