
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Programming PSoC™ 3, PSoC™ 4, and PSoC™ 5LP MCUs using PPCLI – KBA232937
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:
- Running the PPCLI tool by passing a script file
- Executing the PPCLI tool
- 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
Figure 2. Example script file
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: |
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_VerifyRowFromHex <array_ID> <row_ID> <ECC_option> |
Verifies the addressed row data with the data from the hex file. Usage: |
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_VerifyRowFromHex <row_ID > |
|
Verifies the addressed row data with the data from the hex file. Usage: |
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
If the command results in failure, the error is displayed as shown in Figure 4.
Figure 4. Command execution resulting in an error
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
If you must use this method, do the following:
- Open a command prompt in the PSoC™ programmer installation directory.
- Run the PPCLI tool using the ppcli.exe command.
- 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