Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Programming PSoC™ 3, PSoC™ 4, and PSoC™ 5LP MCUs using PPCLI – KBA232937

lock attach
Attachments are accessible only for community members.

Programming PSoC™ 3, PSoC™ 4, and PSoC™ 5LP MCUs using PPCLI – KBA232937

ArunKumarChoul
Employee
Employee
50 questions asked 50 sign-ins 25 sign-ins

Community Translation: PPCLIを使用したPSoC™ 3、PSoC™ 4、およびPSoC™ 5LP MCUのプログラミング

Version: **

The PSoC™ programmer command-line interface (PPCLI) tool in the PSoC™ programmer installation directory (C:\Program Files (x86)\Cypress\Programmer\ is the default) provides CLI access to all features of the PSoC™ programmer tool. The tool can be run in a command prompt instance or through a script which provides a means of automating the programming of your devices. See the PSoC™ programmer command-line interface guide for details.

The PPCLI tool can be used in the following ways:

  1. Running the PPCLI tool by passing a script file
  2. Executing the PPCLI tool
  3. Executing the PPCLI tool using the command prompt

These options are described in the following sections.

1.    Running the PPCLI tool by passing a script file

You can pass a script file in .cli format to ppcli.exe using the --runfile command line option as shown in Figure 1.

Run the script using the following command:
ppcli.exe “--runfile <path_to_script>”
Ensure that the <path_to_script> uses forward slash (/) and does not have space or special characters.

Figure 1. Passing a script file to ppcli.exe

ArunKumarChoul_0-1631778117288.png

 

Figure 2. Example script file

ArunKumarChoul_1-1631778171521.png

 

1.1      Creating the script file

An example .cli script for PSoC™ 4 and PSoC™ 3/5LP MCUs is attached with this document. The script can be used to program the hex file for a sample application (Blinky LED project for CY8CKIT-043 kit (PSoC™ 4 MCU) and CY8CKIT-059 kit (PSoC™ 5LP MCU)).

The following tables provide the details of commands used in the example script:

Table 1. Initial configuration and device acquire process (common for PSoC™ 3, PSoC™, 5LP, and PSoC™ 4 MCUs)

PPCLI Command

Description

OpenPort <port> <psoc_programmer_installation_directory>

Opens the port. Use the GetPorts command in a different PPCLI instance to get the port string for your device.

Usage:
OpenPort KitProg/1A06163201324400 "C:\Program Files (x86)\Cypress\Programmer\"

HEX_ReadFile "C:/Path/to/example/hex/example.hex"

Reads the hex file that is to be programmed to the device.

Change the location of the hex file according to where the hex file is placed. Ensure that you use forward slash (/) when providing the hex file path.

SetAcquireMode "Reset"

     

Sets the device acquire mode.

Use Power (for power-cycle mode) or Reset depending on your application.

SetProtocol 8

Sets the SWD protocol. Here, “8” denotes SWD. If you require JTAG, use “1”.

SetProtocolClock 152

Sets the programming clock to 1.6 MHz.

SetProtocolConnector 1

Sets the connector to 10-pin connector. Use “0” if you have a 5-pin connector.

SetPowerVoltage 3.3

Sets the programming voltage to 3.3 V.

PowerOn

Applies power to the device.

DAP_Acquire

Acquires the device. If this command returns an error, ensure that all the programming parameters are set correctly.

 

Table 2. Programming the device (for PSoC™ 3 and PSoC™ 5LP MCUs)

Command

Description

PSoC3_EraseAll

Erases the entire flash and protection settings.

PSoC3_ProgramRowFromHex <array_ID> <row_ID> <ECC_option>

Programs the addressed row of the flash array with the data from the hex file.

Usage:
PSoC3_ProgramRowFromHex 0x00 0 0x01

PSoC3_VerifyRowFromHex <array_ID> <row_ID> <ECC_option>

Verifies the addressed row data with the data from the hex file.

Usage:
PSoC3_VerifyRowFromHex 0x00 0 0x01

PSoC3_ProtectAll

Applies the flash protection settings from the hex file.

PSoC3_VerifyProtect

Verifies the protection area of all flash arrays.

 

Table 3. Programming the device (for PSoC™ 4 MCUs)

PPCLI Command

 

Description

PSoC4_EraseAll

 

Erases the entire flash and protection settings.

PSoC4_ProgramRowFromHex <row_ID>

 

Programs the addressed flash row with the data from the hex file.

Usage:
PSoC4_ProgramRowFromHex 0

PSoC4_VerifyRowFromHex <row_ID >

 

Verifies the addressed row data with the data from the hex file.

Usage:
PSoC4_VerifyRowFromHex 0

PSoC4_ProtectAll

 

Applies the flash protection settings from the hex file.

PSoC4_VerifyProtect

 

Verifies the protection area of all flash arrays.

 

Table 4. Closing the port (common for PSoC™ 3, PSoC™ 5LP, and PSoC™ 4 MCUs)

PPCLI Command

Description

DAP_ReleaseChip

Releases the acquired device.

ClosePort

Closes the opened port.

Quit

Terminates the PPCLI application.


See the PSoC™ programmer command-line interface (CLI) guide for additional information on the commands used in the script.

2.    Executing the PPCLI tool

You can run the PPCLI tool to open a blank terminal. If the PPCLI command results in success, the tool output is OK as shown in Figure 3.

Figure 3. Successful command execution

ArunKumarChoul_2-1631779167446.png

If the command results in failure, the error is displayed as shown in Figure 4.

Figure 4. Command execution resulting in an error

ArunKumarChoul_3-1631779250366.png

 

3.    Executing the PPCLI tool using the command prompt

This method is not recommended. Use the methods described earlier in this document to run PPCLI.
This option is not recommended because of the following reasons:

  • All command-line options must be passed at once because each time ppcli.exe is executed, it creates a new instance; the commands will not be continued from the previous instance.
  • Commands with quotes are not recognized as shown in Figure 5.

Figure 5. Quotes/spaces in the commands result in an error

ArunKumarChoul_4-1631779376661.png


If you must use this method, do the following:

  1. Open a command prompt in the PSoC™ programmer installation directory.
  2. Run the PPCLI tool using the ppcli.exe command.
  3. Call the commands by directly passing them as command-line options to the PPCLI tool as shown in Figure 6 .

Figure 6. Running ppcli.exe using the command prompt

ArunKumarChoul_5-1631779455107.png

 

Attachments
2595 Views