background image

1

Introduction

PSoC

 6 MCU is an ultra-low-power PSoC

 device with a dual-CPU architecture tailored for smart homes, IoT

gateways, and so on. The PSoC

 6 MCU device is a programmable embedded system-on-chip that integrates the

following features on a single chip:

Single-CPU microcontroller: Arm

®

 Cortex

®

-M4 (CM4) or Dual-CPU microcontroller: Arm

®

 Cortex

®

-M4 (CM4)

and Cortex

®

-M0+ (CM0+)

Programmable analog and digital peripherals

Up to 2 MB of flash and 1 MB of SRAM

Fourth-generation CapSense

®

 technology

PSoC

 6 MCU is suitable for a variety of power-sensitive applications such as the following:

-

Smart home sensors and controllers

-

Smart home appliances

-

Gaming controllers

-

Sports, smart phone, and virtual reality (VR) accessories

-

Industrial sensor nodes

-

Industrial logic controllers

-

Advanced remote controllers

The programmable analog and digital subsystems allow flexibility 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.

Motion Sensor

Ambient Light

Sensor

I2C Block

SAR ADC

Block

CapSense 

Block

Universal Digital 

Block (UDB)-

Based LCD 

Parallel Interface

PWM Block

PSoC 6 MCU

TFT LCD Display

RGB LED

CM4 CPU

Touch 

Interface

CM0+ CPU

Buck 

Converter

Figure 1

Application-level block diagram using PSoC

 6 MCU

PSoC

 6 MCU is a highly capable and flexible solution. For example, the real-world use case in 

Figure 1

 takes

advantage of these features:

A buck converter for ultra-low-power operation

An analog front end (AFE) within the device to condition and measure sensor outputs such as ambient light

sensor

Serial Communication Blocks (SCBs) to interface with multiple digital sensors such as motion sensors

CAPSENSE

 technology for reliable touch and proximity sensing

Getting started with PSoC

 6 MCU on PSoC

 Creator

1 Introduction

Application Note

3

002-21774 Rev. *G

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: