Developing an Application or Script to Program PSoC® Devices - KBA88207

Version: *B



How do I create an application or a script to program PSoC devices?




Rather than developing an application or script from scratch, you can use the Cypress-provided code examples with minimal modifications to program a PSoC device. All code examples are included with the installation of PSoC Programmer and are located in the install directory. The default path for the examples is as follows.

  1. For 32-bit operating systems, the default path is:
      “C:\Program Files\Cypress\Programmer\Examples\Programming\”
  2. For 64-bit operating systems, the default path is:
      “C:\Program Files (x86)\Cypress\Programmer\ Examples\Programming\”

Located in these file paths are code examples for developing an application or script in a variety of programming languages, including C#, C++, Perl, and Python. An example of programming a PSoC device is provided for each language depending on the PSoC device and its supported programming interfaces. Table 1 lists the PSoC device families and programming interfaces for which code examples are available.

Table 1: Available Code Examples

Device FamilyProgramming Interface
PSoC 3/PSoC 5LPSWD and JTAG (Single and Chained)

All examples demonstrate how to program the PSoC device using the COM interface and can be easily adapted to accommodate specific programming requirements. For example, the JTAG examples for PSoC 3 and PSoC 5LP include a framework to program a single device or a chain of JTAG devices with the ProgramAll() API. Additionally, by changing the file path of the HEX_ReadFile() API, different HEX files can be loaded for individual devices on the JTAG chain.

Note that when using these examples, you must specify the correct hex file for the target silicon in the HEX_ReadFile() API in each code example. By default, the HEX file path in each example is linked to a PSoC 3 hex file, which is distributed with the C# examples. Additionally, these examples only support the MiniProg3 as a programming device. To use JTAG programming on PSoC 3 or PSoC 5LP devices, ensure that DEBUG_PORT = JTAG (or SWD) and DEBUG_EN = ON is configured in NVLs. These options can be set in the PSoC Creator project and reprogrammed by PSoC Programmer.

Refer to the psoc_programmer_com.pdf and PSoC Programmer Example Code ReadMe.pdf documents for more information on using and modifying these code examples. These documents can be found in one of the following folder paths.

  1. For 32-bit operating systems, the default path is:
      “C:\Program Files\Cypress\Programmer\Documents\”
  2. For 64-bit operating systems, the default path is:
      “C:\Program Files (x86)\Cypress\Programmer\ Documents\”