psoc 4 command line programming

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

cross mob
RaKa_4742981
Level 1
Level 1

Hi

How can I programm CY8C4124 using command line?

I have script:

GetPorts

OpenPort "MiniProg4 (CMSIS-DAP/BULK/1C210EC800287400)" .

SetAcquireMode “Reset”

SetAcquireMode “Power”

SetProtocol 8

SetProtocolClock 224

SetProtocolConnector 1

SetPowerVoltage 3.3

PowerOn

DAP_Acquire

PSoC4_EraseAll

PSoC4_GetFlashInfo

PSoC4_GetSiliconID

HEX_ReadFile "c:\\Pokus\\O.5.23.12.3C.hex"

Program

quit

Looks all command are working, but not Program here I have:

Program
E

Program returned 8003001f
8003001f OK

But loading hex file was OK, can I load hex file that all setting will be loaded also and I will only program hex?

Thanks

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

The Program command pertains only to PSoC1 as seen in the Command Overview section in the PSoC Programmer CLI User Guide as shown below:

pastedImage_0.png

For programming the PSoC4 you need to make use of the PSoC4_ProgramRow or the PSoC4_ProgramRowFromHex APIs. I would suggest using the latter since you have the hex file.

PSoC4_ProgramRowFromHex API takes the Row ID as the parameter. For example, to program the first row, you would run:

>> PSoC4_ProgramRowFromHex 0

To get the number of rows to be programmed you need to see the return value of HEX_GetRowsCount. Based on that number, keep calling the PSoC4_ProgramRowFromHex API by incrementing the Row ID upto the rows count in the hex.

So, your script would look something like this:

OpenPort "MiniProg4 (CMSIS-DAP/BULK/1C210EC800287400)" .

SetAcquireMode “Reset”

SetAcquireMode “Power”

SetProtocol 8

SetProtocolClock 224

SetProtocolConnector 1

SetPowerVoltage 3.3

PowerOn

DAP_Acquire

PSoC4_EraseAll

PSoC4_GetFlashInfo

PSoC4_GetSiliconID

HEX_ReadFile "c:\\Pokus\\O.5.23.12.3C.hex"

PSoC4_ProgramRowFromHex 0

PSoC4_ProgramRowFromHex 1

PSoC4_ProgramRowFromHex 2

.....

.....

PSoC4_ProgramRowFromHex n

See the Ordering Information in the datasheet for the actual flash size for the part number of interest and divide the flash size by the row size to get the actual number of rows.

This process of writing the API to program each row might be tedious and I recommend making use of the scripts in the path "C:\Program Files (x86)\Cypress\Programmer\Examples\Programming\PSoC4\SWD" as they make of a simple for loop and then do the programming. We have example scripts in multiple languages in this path and you can use the one you are most comfortable with.

Let me know if this solves your issue

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

The Program command pertains only to PSoC1 as seen in the Command Overview section in the PSoC Programmer CLI User Guide as shown below:

pastedImage_0.png

For programming the PSoC4 you need to make use of the PSoC4_ProgramRow or the PSoC4_ProgramRowFromHex APIs. I would suggest using the latter since you have the hex file.

PSoC4_ProgramRowFromHex API takes the Row ID as the parameter. For example, to program the first row, you would run:

>> PSoC4_ProgramRowFromHex 0

To get the number of rows to be programmed you need to see the return value of HEX_GetRowsCount. Based on that number, keep calling the PSoC4_ProgramRowFromHex API by incrementing the Row ID upto the rows count in the hex.

So, your script would look something like this:

OpenPort "MiniProg4 (CMSIS-DAP/BULK/1C210EC800287400)" .

SetAcquireMode “Reset”

SetAcquireMode “Power”

SetProtocol 8

SetProtocolClock 224

SetProtocolConnector 1

SetPowerVoltage 3.3

PowerOn

DAP_Acquire

PSoC4_EraseAll

PSoC4_GetFlashInfo

PSoC4_GetSiliconID

HEX_ReadFile "c:\\Pokus\\O.5.23.12.3C.hex"

PSoC4_ProgramRowFromHex 0

PSoC4_ProgramRowFromHex 1

PSoC4_ProgramRowFromHex 2

.....

.....

PSoC4_ProgramRowFromHex n

See the Ordering Information in the datasheet for the actual flash size for the part number of interest and divide the flash size by the row size to get the actual number of rows.

This process of writing the API to program each row might be tedious and I recommend making use of the scripts in the path "C:\Program Files (x86)\Cypress\Programmer\Examples\Programming\PSoC4\SWD" as they make of a simple for loop and then do the programming. We have example scripts in multiple languages in this path and you can use the one you are most comfortable with.

Let me know if this solves your issue

Regards,

Dheeraj

0 Likes

Hi Dheeraj,

I already solved this and your answer is right, I did it like this way.

Thank and have a nice day

Rado

0 Likes