Programming PSoc 5 with CommandLineInterface

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

cross mob
andy_1992
Level 1
Level 1
First reply posted First like given First question asked

Hello everbody,

i hope you can help me a little bit.

At the moment I am trying to program a PSoC 5 (CY8C5268LTI-LP030) with the CommandLineInterface.
Unfortunatey it isn´t working properly 😞

What have I done...

At the moment I am using this commands in a script:

 

OpenPort KitProg/0720063201324400 C:\Program Files (x86)\Cypress\Programmer
HEX_ReadFile "C:/HexFile/Testfile.hex"
SetAcquireMode "Reset"
SetProtocol 8
SetProtocolClock 152
SetProtocolConnector 0
SetPowerVoltage 5.0
//PowerOn
DAP_AcquireChip
PSoC3_EraseAll
PSoC3_ProgramRowFromHex 0x03 0 0
DAP_ReleaseChip
ClosePort
quit

Till the command "PSoC3_ProgramRowFromHex 0x03 0 0 " everything looks good. But while using this command I get following error message:

"PSoC3_ProgramRowFromHex 0x03 0 0
E
Timeout of SPC polling. Lost communication with chip (Status = 0x00)
PSoC3_ProgramRowFromHex 0x03 0 0 returned 80004005
80004005 OK"

And I am not sure how to fix it. I don´t know the problem... Is there anybody with an idea how to fix it?

Question 2:

Is there a command to program the whole hexfile without the rowId and arrayId? For example the command Program(). Unfortunately the UserGuid tells me it is only for PsoC1 😞

And is the arrayId 0x03 the correct id?

Many thanks in advance. I hope somebody can help me! 🙂

 

Ando some more informationen.
I am using a KitProg2 and the programming with PsocCreator oder PscoCProgrammer is working without any problems. So I guess there is no hardwareproblem.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

I've attached a working example of programming 5LP with 256kbyte of FLASH.  Edit the script for your Kitprog ID and hex file target.  At the very bottom of file, is PSoC3_ProtectALL(), you can comment this out if you like, it doesn't hurt anything.  To be honest, the CLI manual doesn't really describe what this does.  Very vague!

From 5LP Tech Ref Manual:
"For example, if a PSoC 5LP device has 256 KB Flash, there are four arrays, and the only valid array IDs are 0x00 – 0x03."

Looks like you have arrayID starting at the last arrayID (0x03).  Was that was your intention?  Normally it would start programming at arrayID 0x00.  Starting at arrayID (0x03) is valid, I just don't know if it's correct for reading from the hex file (which I assume starts from beginning of hex file where arrayID (0x00) data would be located).

Unfortunately, there is no equivalent to Program() for 5LP (as you discovered).  You have to explicitly give a pplci command for each FLASH row.  The good news is, the attachment has this done for you.

So, make some script changes and let us know if you're successful of not.

View solution in original post

3 Replies
lock attach
Attachments are accessible only for community members.
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

I've attached a working example of programming 5LP with 256kbyte of FLASH.  Edit the script for your Kitprog ID and hex file target.  At the very bottom of file, is PSoC3_ProtectALL(), you can comment this out if you like, it doesn't hurt anything.  To be honest, the CLI manual doesn't really describe what this does.  Very vague!

From 5LP Tech Ref Manual:
"For example, if a PSoC 5LP device has 256 KB Flash, there are four arrays, and the only valid array IDs are 0x00 – 0x03."

Looks like you have arrayID starting at the last arrayID (0x03).  Was that was your intention?  Normally it would start programming at arrayID 0x00.  Starting at arrayID (0x03) is valid, I just don't know if it's correct for reading from the hex file (which I assume starts from beginning of hex file where arrayID (0x00) data would be located).

Unfortunately, there is no equivalent to Program() for 5LP (as you discovered).  You have to explicitly give a pplci command for each FLASH row.  The good news is, the attachment has this done for you.

So, make some script changes and let us know if you're successful of not.

andy_1992
Level 1
Level 1
First reply posted First like given First question asked

Hi,

your script works fine 🙂 Thanks a lot. I had the arrayId 0x03 from the output window in the PSoc-Programmer tool. There it is the UserFlash area. My itention was to have a look if it is possible to change something in the flash. But I think that was the problem. So thank you very much for your help 🙂

Best regards

0 Likes

Hi.

Good to hear you've got it programming.

BTW, yes, you can purposely modify FLASH using ppcli, but be aware that if using a bootloader, it checks a Bootloadable FLASH checksum and if it computes wrong, the bootloadable project will not run.  It will sit in bootloader waiting for a valid bootloadable download.  The way around this is to turn on Checksum Exclude in the bootloadable configuration.  You can read how to use it in bootloadable component datasheet.

I've also found it useful to use ppcli interactively.  I put the scripts into a text file and copy/paste them into the ppcli command line.  So, when I modify flash, I read the row, paste the result into my text file, edit the data, erase the row, program the row with my new data.  Works well for changing a few bytes.  Otherwise, yes, automate the process using a hex file.

Good luck with your project.

0 Likes