programming CY8C4xxx-BLE chip using cli

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

cross mob
StBE_4717036
Level 1
Level 1

Hello,

I am trying to program a PSoC4 chip using the cli interface and ppcli.exe.

The final aim is to use it in production to automatize programming process using a Qt C++ software.

I am able to program the chip using the PSoC Programmer both in Reset or Power Cycle mode.

But when I try using the cli I get errors and I am not able to find the correct command... I am quite sure the answer is simple but after few hours reading the cli datasheet in every directions I feel like I am missing something quite important.

Please see below the script that I am using  and the response from the cli :

OpenPort "MiniProg4 (CMSIS-DAP/BULK/1C1F0F8B02237400)" "C:\Program Files (x86)\Cypress\Programmer"

HEX_ReadFile "C:\\ADM-F-Q00.hex"

SetAcquireMode "Reset"

SetPowerVoltage 3.3

SetProtocol 8

SetProtocolClock 152

SetProtocolConnector 1

SetChipType 0x04

DAP_Acquire

PSoC4_EraseAll

Program

Verify

OpenPort "MiniProg4 (CMSIS-DAP/BULK/1C1F0F8B02237400)" "C:\Program Files (x86)\Cypress\Programmer"

<

0 OK

HEX_ReadFile "C:\\ADM-F-Q00.hex"

<0x00040000

0 OK

SetAcquireMode "Reset"

<

0 OK

SetPowerVoltage 3.3

<

0 OK

SetProtocol 8

<

0 OK

SetProtocolClock 152

<

0 OK

SetProtocolConnector 1

<

0 OK

SetChipType 0x04

<

0 OK

DAP_Acquire

<

0 OK

PSoC4_EraseAll

<

0 OK

Program

E

Program returned 8003001f

8003001f OK

Verify

E

Verify returned 8003001f

8003001f OK

<

0 OK

<OK

Program and Verify functions give me errors and I saw page 15 of the cli datasheet that they are not supposed to be used for PSoC4 chip.

The problem for me is to program using the HEX file. I can't find the correct function for this and trying to program each row with PSoC4_WriteRow don't seem to be the more efficient solution.

Thank you for any advice you can give me.

Regards.

Steve BERNARD

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

You are seeing errors when you use "Program" and "Verify" commands because they are PSoC1 APIs and not to be used for PSoC4. Please refer to the section Command Overview in the PSoC Programmer CLI User Guide to get more information on what APIs are supported for PSoC4.

Since you are reading the hex file in the beginning, you can make use of the PSoC4_ProgramRowFromHex API and provide the row IDs to program the device. You need to call this until all the rows are written which might be something tedious.

Since the end goal is to integrate this into a Qt C++ application, I would recommend making use of PSoC Programmer COM library to write the C++ code for programming the device. You can find the example here: "C:\Program Files (x86)\Cypress\Programmer\Examples\Programming\PSoC4\SWD\Cpp_Ex"

Let me know if you have any further queries.

Regards,

Dheeraj

View solution in original post

0 Likes
2 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

You are seeing errors when you use "Program" and "Verify" commands because they are PSoC1 APIs and not to be used for PSoC4. Please refer to the section Command Overview in the PSoC Programmer CLI User Guide to get more information on what APIs are supported for PSoC4.

Since you are reading the hex file in the beginning, you can make use of the PSoC4_ProgramRowFromHex API and provide the row IDs to program the device. You need to call this until all the rows are written which might be something tedious.

Since the end goal is to integrate this into a Qt C++ application, I would recommend making use of PSoC Programmer COM library to write the C++ code for programming the device. You can find the example here: "C:\Program Files (x86)\Cypress\Programmer\Examples\Programming\PSoC4\SWD\Cpp_Ex"

Let me know if you have any further queries.

Regards,

Dheeraj

0 Likes

Thank you Dheeraj for your response. I actually use PSoC4_ProgramRowFromHex to program the chip and it works fine, I just have a really long list of commands in my text file.

I will make an improvment of my code using PSoC Programmer COM library as you suggest when I will be less in a hurry.

Regards.

Steve.

0 Likes