cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

BoKo_3748966
New Contributor

Hi everyone,

I'm trying to use Python_Ex.py script to program PSoC5 using KitProg3 programmer.  When I run Python_Ex.py, everything seems to go well - data is transferred, all checks pass, chip is released. However, after script is finished it looks like the chip is left in a "bad" state. The code clearly doesn't work and when I try to debug it with attach to running target option, it looks like the CPU is either not running or executing some random code. What is interesting is that I can program the CPU with the same hex file using PSoC Programmer GUI with no issues. Another interesting observation is that I can remove all the parts of the Python_Ex.py that deal with actual programming and just run the chip acquisition and release and again the CPU is no longer working. I can restore CPU to working state by simply running checksum in PSoC Programmer GUI.

My question is this, what does PSoC Programmer GUI do that's different from Python_Ex.py when acquiring and then releasing the CPU?

Thank you for you help,

Boris

0 Likes
1 Solution
Rakshith
Moderator
Moderator

Hi Boris,

I am sorry I missed responding to this thread.

In the Python_Ex.py file there is a comment - #For PSoC5 LP call "Allow_Hard_Reset()" as in C#/C++ example

I implemented the function and called that before DAP_ReleaseChip and that worked for me. I have attached the python script for your reference. Please let me know if this works for you.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

7 Replies
Rakshith
Moderator
Moderator

Hi Boris,

I'm trying to use Python_Ex.py script to program PSoC5 using KitProg3 programmer

I think you are referring to KitProg and not KitProg3. Can you please confirm that you are using KitProg to program your PSoC 5LP device?

You mentioned that you are able to program your device. So, did you add KitProg in the OpenPort() function?

I tried programming CY8CKIT-059​ using the script and I was able to program the device successfully. Can you please try resetting the device after programming?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
BoKo_3748966
New Contributor

Hi Rakshith,

Yes, I added KitProg to OpenPort(). Like I said, the script runs successfully and all checks passed, so I must have done this part correctly.

When you mean resetting the device, what API function are you referring to? I'm under the impression that pp.DAP_ReleaseChip(), toggles XRES pin to reset the uC. I verified that with an oscilloscope and XRES indeed gets toggled at the end same as PSoC programmer GUI.

Boris

0 Likes
Rakshith
Moderator
Moderator

Hi Boris,

I actually was not referring to an API. Can you try physically resetting the device by pressing the reset button or removing power and powering the device back again? Please let me know if this makes any difference.

Regards,

Rakshith

Thanks and Regards,
Rakshith M B
0 Likes
BoKo_3748966
New Contributor

Hi Rakshith,

Pressing the reset button didn't work but power cycling did. Is it possible that the CPU is simply paused? I used PSoC Creator, Attach to Running target and noticed the CPU is sitting at the start of Reset() function. Once I resume execution, everything starts working again.

Boris

0 Likes
BoKo_3748966
New Contributor

Any updates?

0 Likes
Rakshith
Moderator
Moderator

Hi Boris,

I am sorry I missed responding to this thread.

In the Python_Ex.py file there is a comment - #For PSoC5 LP call "Allow_Hard_Reset()" as in C#/C++ example

I implemented the function and called that before DAP_ReleaseChip and that worked for me. I have attached the python script for your reference. Please let me know if this works for you.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

BoKo_3748966
New Contributor

Hi Rakshith,

The extra code resolved the issue. Thank you so much.

Boris

0 Likes