AN0034 Getting started with PSOC™ 4 HV MS MCUs in ModusToolbox™

About this document
Scope and purpose
This application note helps you explore the PSOC™ 4 high voltage (HV) mixed signal (MS) Automotive MCU architecture and development tools, and shows you how to create your first project using the Eclipse IDE for ModusToolbox™ software. This application note also guides you to more resources available online to accelerate your learning about PSOC™ 4 HV MS: CY8C41x5 and CY8C41x6 MCUs.
Intended audience
This document is intended for users who are new to PSOC™ 4 HV MS MCU and ModusToolbox™ software.
Associated part family
CY8C41x5
CY8C41x6
Software version
3.2 or above.
Introduction
The PSOC™ 4 HV MS MCU device is a microcontroller targeted at automotive applications. The PSOC™ 4 HV MS CY8C41x MCU integrates the following features on a single chip:
CPU subsystem
48 MHz, 32-bit Arm® Cortex®-M0+ CPU with the following:
Single-cycle multiply
Memory protection unit (MPU)
Datawire/peripheral direct memory access (DMA) controller with 8 channels
Integrated memories
Up to 64 KB of flash
Up to 8 KB of SRAM
Programmable analog
12-bit, 1-Msps SAR ADC with differential and single-ended modes, and channel sequencer with signal averaging
16-channel SAR multiplexer with built-in diagnostics (8 I/O channels and 8 diagnostic channels)
Temperature sensor built into SAR ADC
Two low-power comparators that operate in Deep Sleep low-power mode
Programmable digital
Programmable smart I/O logic blocks allowing Boolean operations to be performed on port inputs and outputs
High-voltage subsystem
Regulator output voltage supports 3.3 V or 5 V selectable with ±2% trimmed accuracy
Regulator current: up to 60 mA
Thermal shutdown
Operates directly off 12-V/24-V battery (tolerates up to 42 V)
CAPSENSE™ (multi-sense converter) block
Multi-sense converter (MSC) provides a best-in-class signal-to-noise ratio (SNR) (>5:1) and water tolerance for capacitive sensing
Timing and pulse-width modulation
Five 16-bit timer/counter/pulse-width modulator (TCPWM) blocks
Communication
Two independent run-time reconfigurable serial communication blocks (SCB) with reconfigurable I 2 C, SPI, UART, or LIN slave functionality
Up to two CXPI channels with data rate up to 20 kbps
The
ModusToolbox™ software environment
supports PSOC™ 4 HV MS MCU application development with a set of tools for configuring the device, setting up the peripherals, and complementing your projects with world-class middleware. See the
Infineon
GitHub repo for the KIT_PSOC4-HVMS-64K_LITE BSP, libraries for popular functionality like device firmware upgrade (DFU) and emWin, and a comprehensive array of example applications to get you started.
illustrates an application-level block diagram for a Steering wheel hands-on-detection (HOD) use case using a PSOC™ 4 HV MS MCU.
Figure 1. Application-level block diagram using PSOC™ 4 HV MS MCU
The PSOC™ 4 HV MS MCU is a highly capable and flexible solution. For example, the steering wheel hands-on-detection use case in
Figure 1
has the advantage of the following features:
MCU:
Arm® Cortex®-M0+ MCU with DMA and MPU
Up to 64 KB flash with error correcting code (ECC)
CAPSENSE™:
Handles high parasitic capacitance (Cp) to support long sensors
Temperature compensation along with heated steering wheels
Supports thick overlay/steering wheel covers
Heating coil can be used as an HOD sensor
ADC:
Monitors supply voltage
Measures temperature of the sensor
PWM:
Controls haptic actuator
Controls LED lighting
HV (LDO and LIN PHY):
Connects directly to a 12-V battery supply with the integrated HV regulator
Communicates directly to the LIN bus with an integrated LIN PHY
provides an overview of the product line.
Device series | Details |
---|---|
PSOC™ 4 HV MS CY8C4125 | 24 MHz Cortex®-M0+ 32 KB flash, 4 KB RAM Packages: 32/48/56 QFN |
PSOC™ 4 HV MS CY8C4126 | 24 MHz Cortex®-M0+ 64 KB flash, 8 KB RAM Packages: 32/48/56 QFN |
PSOC™ 4 HV MS CY8C4145 | 48 MHz Cortex®-M0+ 32 KB flash, 4 KB RAM Packages: 32/48/56 QFN |
PSOC™ 4 HV MS CY8C4146 | 48 MHz Cortex®-M0+ 64 KB flash, 8 KB RAM Packages: 32/48/56 QFN |
Note: All features are not available in all the devices in a product line. For more details, see the Device datasheets.
This application note introduces you to the capabilities of the PSOC™ 4 HV MS MCU, gives an overview of the development ecosystem, and gets you started with a simple “Hello World” application wherein you learn to use the PSOC™ 4 HV MS MCU. Additionally, provides how to create the application from an empty starter application, but the completed design is available as a
code example for ModusToolbox™ on GitHub
.
For hardware design considerations, see the
2
.
Development ecosystem
PSOC™ 4 HV MS MCU resources
The
32-bit PSOC™ 4 HV Arm® Cortex® microcontroller
webpage contains wealth of data that will assist you in selecting the right PSOC™ 4 HV MS device and quickly and effectively integrate it into your design. For a comprehensive list of PSOC™ 4 HV MS MCU resources, see
How to design with PSOC™ 4 HV MS MCU
. The following is an abbreviated list of resources for the PSOC™ 4 HV MS MCUs.
- Overview: PSOC™ 4 HV MCU webpage
Product selectors: PSOC™ 4 HV MS CY8C41x5/CY8C41x6 series MCU
Datasheets describe and provide electrical specifications for each device family
Application notes and code examples cover a broad range of topics, from basic to advanced
Reference manuals provide detailed descriptions of the architecture and registers in each device family
PSOC™ 4 HV MS MCU programming specification: Provides the information necessary to program the nonvolatile memory of PSOC™ 4 HV MS MCU devices
Development tools: KIT_PSOC4-HVMS-64K_LITE
- Technical support: PSOC™ 4 Developer Community forum, knowledge base articles
Firmware/application development
For application development with the PSOC™ 4 HV MS MCUs, use the ModusToolbox™ development platform. ModusToolbox™ includes configuration tools, low-level drivers, middleware libraries, operating system support, and other packages for creating MCU.
Choosing an IDE
ModusToolbox™, the latest-generation toolset, includes the Eclipse IDE and therefore, supports across Windows, Linux, and macOS platforms. The Eclipse IDE for ModusToolbox™ is integrated with quick launchers for tools and design configurators in the Quick Panel. Third-party IDEs supported by ModusToolbox™ include Visual Studio Code, Arm® MDK (µVision), and IAR Embedded Workbench. The associated hardware and middleware configurators also work on all three host operating systems.
Use ModusToolbox™ to take advantage of the power and extensibility of an Eclipse-based IDE.
ModusToolbox™ software
ModusToolbox™ is a collection of tools and software that provides an immersive development experience for creating converged MCUs and allows you to integrate our devices into your existing development methodology. To achieve this goal, ModusToolbox™ leverages popular third-party ecosystems, such as FreeRTOS and Arm® Mbed OS, and adds specific features for security.
Eclipse IDE for ModusToolbox™ is a multi-platform development environment that supports application configuration and development.
shows a high-level view of the tools/resources included in the ModusToolbox™ software. For a more in-depth overview of the ModusToolbox™ software, see the
ModusToolbox™ user guide
.
Figure 2. ModusToolbox™ software

The ModusToolbox™ installer includes the design configurators and tools, and the build system infrastructure.
The build system infrastructure includes the new project creation wizard that can be run independent of the Eclipse IDE, the make infrastructure, and other tools.
All the ModusToolbox™ development flows depend on the provided low-level resources. These include:
Board support packages (BSP) – A BSP is the layer of firmware containing board-specific drivers and other functions. The board support package is a set of libraries that provide APIs to initialize the board and provide access to board level peripherals. It includes low-level resources such as Peripheral Driver Library (PDL) for board peripherals. It uses the HAL to configure the board. Custom BSPs can be created to enable support for end-application boards. See the “Board Support Packages” section in the ModusToolbox™ user guide for more information
Hardware Abstraction Layer (HAL)
– HAL provides a high-level interface to configure and use hardware blocks on MCUs. It is a generic interface that can be used across multiple product families. The focus on ease-of-use and portability means that the HAL does not expose all the low-level peripheral functionality. The HAL wraps the lower-level drivers (such as PSOC™ 4 HV MS PDL) and provides a high-level interface to the MCU. The interface is abstracted to work on any MCU. This helps you write application firmware independent of the target MCU
The HAL can be combined with platform-specific libraries (such as PSOC™ 4 HV MS PDL) within a single application. You can leverage the HAL's simpler and more generic interface for most of an application, even if one portion requires finer-grained control
Peripheral Driver Library (PDL)
– The PDL integrates the device header files, startup code, and peripheral drivers into a single package. The PDL supports the PSOC™ 4 HV MS MCU device family. The drivers abstract the hardware functions into a set of easy-to-use APIs. These are fully documented in the PDL API Reference manual
The PDL reduces the need to understand register usage and bit structures, therefore, easing software development for the extensive set of peripherals in the PSOC™ 4 HV MS MCU series. You configure the driver for your application, and then use API calls to initialize and use the peripheral
Extensive middleware libraries that provides specific capabilities to an application. All the middleware is delivered as libraries and via GitHub repositories
PSOC™ 4 HV MS MCU software resources
The PSOC™ 4 HV MS MCU software includes driver and middleware configurators to get you started developing firmware with PSOC™ 4 HV MS MCU. It contains configurators, drivers, libraries, middleware, various utilities, Makefiles, and scripts. It also includes relevant drivers, middleware, and examples for use with industrial applications. You may use any or all tools in any environment you prefer.
Configurators
ModusToolbox™ software provides graphical applications called configurators that make it easier to configure a hardware block. For example, instead of having to search through all the documentation to configure a Serial Communication Block (SCB) as a UART with a desired configuration, open the appropriate configurator and set the baud rate, parity, and stop bits. After saving the hardware configuration, the tool generates the C code to initialize the hardware with the desired configuration.
Configurators are independent of each other, but they can be used together to provide flexible configuration options. They can be used standalone, in conjunction with other tools, or within a complete IDE. Configurators are used for:
Setting options and generating code to configure drivers
Setting up connections such as pins and clocks for a peripheral
Setting options and generating code to configure middleware
The following configurators are available for PSOC™ 4 HV MS MCU applications:
Device Configurator: Sets up the system (platform) functions and the basic peripherals (for example, UART, Timer, and PWM)
CAPSENSE™ Configurator: Configures CAPSENSE™ widgets and generates code to control the application firmware
CAPSENSE™ Tuner Tune CAPSENSE™ applications
Smart I/O Configurator: Configures the smart I/O
Each of these configurators creates their own files (e.g.,
design.cyqspi
for QSPI). The configurator files ( design.modus or
design.cyqspi
) are usually provided with the BSP. The files are copied into the application when an application is created based on a BSP. Additionally, you can create custom device configurator files for an application and override the BSP-provided devices.
Library management for PSOC™ 4 HV MS MCU
With the release of ModusToolbox™ v3.2, applications can optionally share board support packages (BSPs) and libraries. If needed, different applications can use different versions of the same BSP or library. The file types associated with libraries using this flow have a
.mtb
extension.
Section
My first PSOC™ 4 HV MS MCU design using Eclipse IDE for ModusToolbox™ software
of this document describes creating a new application using this flow.
For more information on ModusToolbox™ flow, see the
Library Manager user guide
located at
<install_dir>/ModusToolbox/tools_<version>/library-manager/docs/library-manager.pdf
.
Software development for PSOC™ 4 HV MS MCU
Significant source code and tools are provided to enable software development for PSOC™ 4 HV MS MCUs. You use tools to specify how you want to configure the hardware, generate code for that purpose which you use in your firmware, and include various middleware libraries for additional functionality, like FreeRTOS. This source code makes it easier to develop the firmware for supported devices. It helps you quickly customize and build firmware without the need to understand the register set.
In the ModusToolbox™ environment, you use configurators to configure either the device or a middleware library, such as QSPI functionality.
The PSOC™ 4 HV MS MCU Peripheral Driver Library code is delivered as the
mtb-pdl-cat2
library. Middleware is delivered as separate libraries for each feature/function.
Whether you use the Eclipse IDE, a third-party IDE, or the command-line, firmware developers who wish to work at the register level should see the driver source code from the PDL. The PDL includes all the device-specific header files and startup code you need for your project. It also serves as a reference for each driver. Because the PDL is provided as source code, you can see how it accesses the hardware at the register level.
Some devices do not support particular peripherals. The PDL is a superset of all the drivers for any supported device. This superset design means:
All API elements needed to initialize, configure, and use a peripheral are available
The PDL is useful across various PSOC™ 4 HV MS MCU devices, regardless of available peripherals
The PDL includes error checking to ensure that the targeted peripheral is present on the selected device
This enables the code to maintain compatibility across products of the PSOC™ 4 HV MS MCU family as long as the peripherals are available. A device header file specifies the peripherals that are available for a device. If you write the code that attempts to use an unsupported peripheral, you will get an error at compile time. Check the datasheet for the specific device to ensure that the peripheral is supported before writing the code to use that peripheral.
As shown in
Figure 3
, with the Eclipse IDE for ModusToolbox™ software, you can:
Choose a board support package (BSP)
Create a new application based on a list of starter applications, filtered by kit
Develop your application firmware using the PDL for PSOC™ 4 HV MS MCU
Figure 3. Eclipse IDE for ModusToolbox™ resources



Support for other IDEs
You can develop firmware for PSOC™ 4 HV MS MCUs using your favorite IDE such as
IAR Embedded Workbench
or
Visual Studio Code
.
ModusToolbox™ configurators are standalone tools that can be used to set up and configure PSOC™ 4 HV MS MCU resources and other middleware components without using the Eclipse IDE. The Device Configurator and middleware configurator use the
design.x
files within the application workspace. You can then point to the generated source code and continue developing firmware in your IDE.
If there is a change in the device configuration, edit the
design.x
files using the configurators and regenerate the code for the target IDE. It is recommended that you generate resource configurations using the configuration tools provided with ModusToolbox™ software.
FreeRTOS support with ModusToolbox™
Adding native FreeRTOS support to a ModusToolbox™ application project is like adding any library or middleware. You can import the FreeRTOS middleware into your application by using the Library Manager. Select the application project and click the
Library Manager
link in the
Quick Panel
. Select
freertos
from the Libraries > PSOC™ 4 HV MS MCU Middleware dialog, as shown in
Figure 4
.
The
.mtb
file pointing to the FreeRTOS middleware is added to the application project. The middleware content is also downloaded and placed inside the corresponding folder called freertos. To continue working with FreeRTOS, follow the steps in the Quick Start section of
FreeRTOS documentation
.
Figure 4. Import FreeRTOS middleware in ModusToolbox™ application

Programming/debugging
All PSOC™ 4 HV MS MCU kits have a KitProg3 onboard programmer or debugger. It supports Cortex® microcontroller Software Interface Standard - Debug Access Port (CMSIS-DAP). See the
KitProg3 user guide
for details.
The Eclipse IDE requires KitProg3 and uses the
OpenOCD
protocol for debugging PSOC™ 4 HV MS MCU applications. Additionally, it supports GDB debugging using industry-standard probes like the
Segger J-Link
.
ModusToolbox™ includes the
fw-loader
command-line tool to update and switch the KitProg firmware from KitProg2 to KitProg3.
For more details, see the “Program and debug” section in the
Eclipse IDE for ModusToolbox™ user guide
.
PSOC™ 4 HV MS MCU development kits
- Development kits
PSOC™ 4 HV MS 64K Lite Kit ( PSOC4_HVMS_LITE_KIT )
Device features
CY8C41x6
Figure 5. PSOC™ 4 HVMS-64K MCU block diagram

- CPU subsystem
48 MHz Arm® Cortex®-M0+ CPU
Three DMA controllers
- Integrated memories
Up to 64 KB of code flash
Up to 8 KB of SRAM
- Programmable analog
12-bit, 1-Msps SAR ADC with differential and single-ended modes, and channel sequencer with signal averaging
16-channel SAR multiplexer with in-built diagnostics (8 I/O channels and 8 diagnostic channels)
Temperature sensor built into SAR ADC
Two low-power comparators that operate in Deep Sleep low-power mode
- Programmable digital
Programmable smart I/O logic blocks allowing Boolean operations to be performed on port inputs and outputs
- High-voltage subsystem
Regulator output voltage supports 3.3 V or 5 V selectable with ±2% trimmed accuracy
Regulator current: up to 60 mA
Thermal shutdown
Operates directly off 12-V/24-V battery (tolerates up to 42 V)
Integrated local interconnect network (LIN)/clock extension peripheral interface (CXPI) transceiver
- CAPSENSE™ (multi-sense converter) block
Multi-sense converter (MSC) provides a best-in-class signal-to-noise ratio (SNR) (>5:1) and water tolerance for capacitive sensing
One MSC converter supported
Autonomous channel scanning without CPU assistance
- Functional safety for ASIL-B
The device will be developed according to the development process of ISO 26262 for ASIL-B as a Safety Element out of Context (SEooC) (according to ISO 26262-10:2018E, clause 9)
Memory protection unit (MPU)
Window watchdog timer (WDT) with challenge-response functionality
Supply monitoring; detection of overvoltage and brownout events for 3.3 V or 5 V, and 1.8 V supplies
Hardware error detection and correction (SECDED ECC) on all safety-critical memories (SRAM, flash)
- Timing and pulse-width modulation
Five 16-bit timer, counter, pulse-width modulator (TCPWM) blocks
Center-aligned, edge, and pseudo-random modes
Memory protection unit (MPU)
Comparator-based triggering of Kill signals for motor drive and other high-reliability digital logic applications
Quadrature decoder
- Clock sources
±2% 24 MHz to 48 MHz internal main oscillator (IMO)
±1% 2 MHz high-precision oscillator (HPOSC)
±5% 32 kHz precision internal low-power oscillator (PILO)
±1% accuracy on IMO and PILO when software calibrated to the HPOSC
40 kHz internal low-speed oscillator (ILO)
- Communication
Two independent run-time reconfigurable Serial Communication Blocks (SCBs) with reconfigurable I 2 C, SPI, UART, or LIN slave functionality
Up to two independent Local interconnect network (LIN) channels
LIN protocol compliant with LIN 2.2A and ISO 17987
Up to two CXPI channels with data rate up to 20 kbps
- I/O
Up to 41 GPIOs
Any GPIO pin can be CAPSENSE™, analog, or digital
Drive modes, strengths, and slew rates are programmable
- Packages
32-lead QFN with wettable flanks (6 mm × 6 mm)
48-lead QFN with wettable flanks (7 mm × 7 mm)
56-lead QFN with wettable flanks (8 mm × 8 mm)
My first PSOC™ 4 HV MS MCU design using Eclipse IDE for ModusToolbox™ software
This section provides the following:
Demonstrates how to build a simple design based on PSOC™ 4 HV MS MCU and program it on to the development kit
Provides detailed steps that make it easy to learn PSOC™ 4 HV MS MCU design techniques and how to use the Eclipse IDE for ModusToolbox™ software
Prerequisites
Before you get started, ensure that you have the appropriate development kit for your PSOC™ 4 HV MS MCU product line, and have installed the required software. You also need Internet access to the GitHub repositories during project creation.
Hardware
The design is developed for PSOC™ 4 HV MS Evaluation Kit . However, you can build the projects for other development kits. See the Using these instructions section
Software
ModusToolbox™ 3.2 or above
After installing the software, see the
ModusToolbox™ user guide
to get an overview of the software.
Note: For a list of known issues, see mt_release_notes.pdf included with the ModusToolbox™ installation. The default location of this file is <user-home>/ModusToolbox/docs_3.2.