- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you know if KP3_REQUEST_ACQUIRE in Kitprog3/Miniprog4 firmware should work with CCG3PA?
I opened a GitHub issue to represent what I am attempting:
https://github.com/cypresssemi
I am trying to use MiniProg4 (KitProg3 FW version: 2.10.878) with CCG3PA (CYPD3171-24LQXQ). Currently, I can not get past the KP3_REQUEST_ACQUIRE USB request. Here is OpenOCD command that I am
using:
openocd -s ../scripts -f interface/kitprog3.cfg -f target/psoc4.cfg -c "kitprog3 power_config on 3300; kitprog3 acquire_config on 0 1 5; init; kitprog3 acquire_psoc; reset init; shutdown"
where "kitprog3 acquire_config on 0 1 5" means 0 for psoc4, 1 for power-cycle mode as CCG3GA lacks XRES pin and attempts is 5.
I modified src/flash/nor/psoc4.c to add CCG3PA family ID 0xB0 to psoc4_families[]. The MiniProg4 can connect to the DAP inside CCG3PA over SWD and read memory from the ROM table in the CCG3PA in
psoc4_get_family():
******************************
** Silicon: 0x2003, Family: 0xB0, Rev.: 0x12 (A1)
** Detected Family: CCG3PA USB Type-C Port Controller
** Detected Main Flash size, kb: 64
** Chip Protection: protection OPEN
******************************
Unfortunately, 'kitprog3 acquire_psoc' fails with error code -4. Here is the full log:
https://gist.github.com/pdp7/8
MiniProg4 seems to receive the KP3_REQUEST_ACQUIRE usb request OK but it fails to actually run KP3_REQUEST_ACQUIRE inside the MiniProg4 firmware successfully:
https://github.com/cypresssemi
I would very much appreciate any additional insights you could provide.
Solved! Go to Solution.
- Labels:
-
USB EZ-PD Type-C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
UPDATE: I was able to program CCG3PA from OpenOCD using MiniProg4. I had to add the family ID:
This is PR #5: https://github.com/cypresssemiconductorco/openocd/pull/5
```
pdp7@x1:~/dev/dojofive/bcd/openocd$ git diff
diff --git a/jimtcl b/jimtcl
--- a/jimtcl
+++ b/jimtcl
@@ -1 +1 @@
-Subproject commit 0aa0fb4e3a38d38a49de9eb585d93d63a370dcf6
+Subproject commit 0aa0fb4e3a38d38a49de9eb585d93d63a370dcf6-dirty
diff --git a/src/flash/nor/psoc4.c b/src/flash/nor/psoc4.c
index 405d452cdd32..7ccb12f23579 100644
--- a/src/flash/nor/psoc4.c
+++ b/src/flash/nor/psoc4.c
@@ -251,6 +251,7 @@ const struct psoc4_chip_family psoc4_families[] = {
{ 0xAB, "PSoC 4100S", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xAC, "PSoC 4100PS/PSoC Analog Coprocessor", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xAE, "PSoC 4xx8 BLE", .flags = PSOC4_FLAG_IMO_NOT_REQUIRED, .spcif_ver = spcif_v2 },
+ { 0xB0, "CCG3PA USB Type-C Port Controller", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xB5, "PSoC 4100S Plus", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xB8, "PSoC 4100S Plus/PSoC 4500", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xBE, "PSoC 4100S Max", .flags = 0, .spcif_ver = spcif_v3 },
pdp7@x1:~/dev/dojofive/bcd/openocd$
```
Here are the results:
```
pdp7@x1:~/dev/dojofive/bcd/openocd$ openocd -s tcl -f interface/kitprog3.cfg -f target/psoc4.cfg -c "kitprog3 power_config on 3300; kitprog3 acquire_config on 0r1 5; init; kitprog3 acquire_psoc; program CYPD3171-24LQXQ_cla.hex verify reset exit"
Open On-Chip Debugger 0.10.0+dev-gd526e667dedf-dirty (2021-02-22-17:17)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
** Auto-acquire enabled, use "set PSOC4_USE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : KitProg3: FW version: 2.10.878
Info : KitProg3: Pipelined transfers enabled
Info : kitprog3: powering up target device using KitProg3 (VTarg = 3300 mV)
Info : VTarget = 3.307 V
Info : kitprog3: acquiring the device...
Info : clock speed 2000 kHz
Info : Power dropout detected, running power_dropout proc.
Sensed power dropout.
Info : SWD DPIDR 0x0bb11477
Info : psoc4.cpu: hardware has 4 breakpoints, 2 watchpoints
*****************************************
** Silicon: 0x2003, Family: 0xB0, Rev.: 0x12 (A1)
** Detected Family: CCG3PA USB Type-C Port Controller
** Detected Main Flash size, kb: 64
** Chip Protection: protection OPEN
*****************************************
Info : starting gdb server for psoc4.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : kitprog3: acquiring the device...
Info : psoc4.cpu: external reset detected
Info : SWD DPIDR 0x0bb11477
Info : SWD DPIDR 0x0bb11477
Error: DP initialisation failed
Info : kitprog3: acquiring the device...
Info : SWD DPIDR 0x0bb11477
psoc4.cpu halted due to debug-request, current mode: Thread
xPSR: 0xa1000000 pc: 0x1000003e msp: 0x20001fe8
** Device acquired successfully
** Programming Started **
auto erase enabled
Info : ignoring flash probed value, using configured bank size
[100%] [################################] [ Programming ]
Warn : no flash bank found for address 0x90300000
Warn : no flash bank found for address 0x90500000
Warn : no flash bank found for address 0x90600000
wrote 65600 bytes from file CYPD3171-24LQXQ_cla.hex in 1.789399s (35.801 KiB/s)
** Programming Finished **
** Verify Started **
verified 65600 bytes in 0.161609s (396.404 KiB/s)
** Verified OK **
** Resetting Target **
Info : SWD DPIDR 0x0bb11477
Info : SWD DPIDR 0x0bb11477
Error: DP initialisation failed
shutdown command invoked
Info : psoc4.dap: powering down debug domain...
Warn : Failed to power down Debug Domains
```
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please note that OpenOCD doesnt formally support CCG3PA. However, we tested with the CCG3PA EVK, MiniProg4 and OpenOCD 4.1.0 which is released on the Github page. The device was acquired successfully using the OpenOCD command you used, please see the attached logs.
If you are using the CGC3PA EVK, please ensure jumpers J6, J7, J9 on the Power Board are left open and J6 on the Main Board is connected between pins 2-3 for the SWD pins to be accessible for programming/debugging. If you're using your custom hardware, please provide the part of the schematic with CCG3PA connections for us to review.
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sananya - thank you so much for your response! I have been struggling to figure out a solution.
Would you be able to share which .cfg files are used? Is it kitprog3.cfg and psoc4.cfg?
Better yet, is it possible to share the openocd command line that you think may work?
This is what I am using:
openocd -s ../scripts -f interface/kitprog3.cfg -f target/psoc4.cfg -c "kitprog3 power_config on 3300; kitprog3 acquire_config on 0 1 5; init; kitprog3 acquire_psoc; reset init; shutdown"
But I get this error:
Debug: 677 15548 command.c:638 run_command(): Command 'kitprog3 acquire_psoc' failed with error code -4
Full log here:
https://gist.github.com/pdp7/8ad3056959d4c626a540a9894c59bbcc
I would really appreciate any additional insights as I'm at the point now where I have logic analyzer setup on the SWD lines to understand why it works from PSoC Programmer in Windows but not with OpenOCD.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Yes, I have used kitprog3.cfg and psoc4.cfg files and I have actually used the same command since you had mentioned that in your first post-
openocd -s ../scripts -f interface/kitprog3.cfg -f target/psoc4.cfg -c "kitprog3 power_config on 3300; kitprog3 acquire_config on 0 1 5; init; kitprog3 acquire_psoc; reset init; shutdown"
Please note that I used the release version of OpenOCD from the page without any modifications to any of the files.
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Sananya_14 thank you for your reply, are you using the CCG3PA as the target?
Could you please post a screenshot of the results of running the command you quoted?
I am using that release but I did have to change the psoc_families in psoc4.c:
https://github.com/cypresssemiconductorco/openocd/blob/cypress/src/flash/nor/psoc4.c#L241
I do not know how it would work without adding the silicon family ID for the CCG3PA?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Yes, the target is CCG3PA and I have used the CCG3PA EVK with the jumper settings mentioned in my first response. The screenshot of the logs are also attached in the first response, I am re-attaching here for your reference.
It could be possible without modification to psoc_families since CCG3PA is based on PSoC 4 and could be part of the existing PSoC 4 families in psoc4.c file. Please try using the release without any modifications and let us know if you get the same error.
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply. Could you confirm whether you are using the MiniProg3 or MiniProg4? I have both and I believe only MiniProg4 works with OpenOCD?
I was getting the error before I modified psoc_families[]:
"Error: 455 5143 psoc4.c:1544 psoc4_read_geometry(): PSoC 4 family with id 0xB0 is not supported."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm using MiniProg4, unfortunately I dont have a MiniProg3 currently to check if it works.
I did see this error in the complete logs since I didnt add the modification but the device was still acquired successfully.
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
An update- only MiniProg4 is supported with OpenOCD so please use it for testing with CCG3PA.
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you verify the checksum was correct when using MiniProg4 in OpenOCD?
I can now program the CCG3PA which requires adding the family ID (https://github.com/cypresssemiconductorco/openocd/pull/5) using:
openocd -s tcl -f interface/kitprog3.cfg -f target/psoc4.cfg -c "kitprog3 power_config on 3300; kitprog3 acquire_config on 0 1 5; init; kitprog3 acquire_psoc; program CYPD3171-24LQXQ_cla.hex verify reset"
However, when I use the MiniProg3 with PSoC Programmer in Windows to read the checksum it does not match the checksum record in the hex file:
Thus, it seems something is going wrong in OpenOCD.
How did you verify the checksum when using OpenOCD?
I also noticed that Cypress did not implement of the PSoC4 SROM call to read checksum from target. Per the CCGx programming spec (https://www.cypress.com/documentation/programming-specifications/ccgx-cypdxxxx-programming-specifica...), this would be:
SROM_CMD_CHECKSUM 0x0B Verifies the checksums of all flash contents (user and privileged rows).
You can see in psoc4.c that this SROM request is not defined at all:
https://github.com/cypresssemiconductorco/openocd/blob/cypress/src/flash/nor/psoc4.c#L140
Also please note, that MiniProg4 does not appear to work with the CCG3PA in either PSoC Programmer:
or Cypress Programmer (OpenOCD-based) Windows applications:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regarding the incorrect checksum, I have opened a GitHub issue:
PSoC4: verify_image_checksum should call SROM_CMD_CHECKSUM instead of generic ARM CRC32#6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
After confirmed with OPENOCD of Cypress developer and re-produced this issue with MiniProg3/4 and CY4532 board. We have to say that Cypress OpenOCD command-line interface (CLI) is not supporting CCGx devices currently. We are strongly recommend you use PSoC Programmer with MiniProg3/4 for SWD programming of CCGx Device. Or the third party of programmer have verified by Cypress/IFX could find out from the link:
https://www.cypress.com/products/device-programmer-system-partners
Thank you for your understanding.
Best Regards,
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
UPDATE: I was able to program CCG3PA from OpenOCD using MiniProg4. I had to add the family ID:
This is PR #5: https://github.com/cypresssemiconductorco/openocd/pull/5
```
pdp7@x1:~/dev/dojofive/bcd/openocd$ git diff
diff --git a/jimtcl b/jimtcl
--- a/jimtcl
+++ b/jimtcl
@@ -1 +1 @@
-Subproject commit 0aa0fb4e3a38d38a49de9eb585d93d63a370dcf6
+Subproject commit 0aa0fb4e3a38d38a49de9eb585d93d63a370dcf6-dirty
diff --git a/src/flash/nor/psoc4.c b/src/flash/nor/psoc4.c
index 405d452cdd32..7ccb12f23579 100644
--- a/src/flash/nor/psoc4.c
+++ b/src/flash/nor/psoc4.c
@@ -251,6 +251,7 @@ const struct psoc4_chip_family psoc4_families[] = {
{ 0xAB, "PSoC 4100S", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xAC, "PSoC 4100PS/PSoC Analog Coprocessor", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xAE, "PSoC 4xx8 BLE", .flags = PSOC4_FLAG_IMO_NOT_REQUIRED, .spcif_ver = spcif_v2 },
+ { 0xB0, "CCG3PA USB Type-C Port Controller", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xB5, "PSoC 4100S Plus", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xB8, "PSoC 4100S Plus/PSoC 4500", .flags = 0, .spcif_ver = spcif_v3 },
{ 0xBE, "PSoC 4100S Max", .flags = 0, .spcif_ver = spcif_v3 },
pdp7@x1:~/dev/dojofive/bcd/openocd$
```
Here are the results:
```
pdp7@x1:~/dev/dojofive/bcd/openocd$ openocd -s tcl -f interface/kitprog3.cfg -f target/psoc4.cfg -c "kitprog3 power_config on 3300; kitprog3 acquire_config on 0r1 5; init; kitprog3 acquire_psoc; program CYPD3171-24LQXQ_cla.hex verify reset exit"
Open On-Chip Debugger 0.10.0+dev-gd526e667dedf-dirty (2021-02-22-17:17)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
** Auto-acquire enabled, use "set PSOC4_USE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : KitProg3: FW version: 2.10.878
Info : KitProg3: Pipelined transfers enabled
Info : kitprog3: powering up target device using KitProg3 (VTarg = 3300 mV)
Info : VTarget = 3.307 V
Info : kitprog3: acquiring the device...
Info : clock speed 2000 kHz
Info : Power dropout detected, running power_dropout proc.
Sensed power dropout.
Info : SWD DPIDR 0x0bb11477
Info : psoc4.cpu: hardware has 4 breakpoints, 2 watchpoints
*****************************************
** Silicon: 0x2003, Family: 0xB0, Rev.: 0x12 (A1)
** Detected Family: CCG3PA USB Type-C Port Controller
** Detected Main Flash size, kb: 64
** Chip Protection: protection OPEN
*****************************************
Info : starting gdb server for psoc4.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : kitprog3: acquiring the device...
Info : psoc4.cpu: external reset detected
Info : SWD DPIDR 0x0bb11477
Info : SWD DPIDR 0x0bb11477
Error: DP initialisation failed
Info : kitprog3: acquiring the device...
Info : SWD DPIDR 0x0bb11477
psoc4.cpu halted due to debug-request, current mode: Thread
xPSR: 0xa1000000 pc: 0x1000003e msp: 0x20001fe8
** Device acquired successfully
** Programming Started **
auto erase enabled
Info : ignoring flash probed value, using configured bank size
[100%] [################################] [ Programming ]
Warn : no flash bank found for address 0x90300000
Warn : no flash bank found for address 0x90500000
Warn : no flash bank found for address 0x90600000
wrote 65600 bytes from file CYPD3171-24LQXQ_cla.hex in 1.789399s (35.801 KiB/s)
** Programming Finished **
** Verify Started **
verified 65600 bytes in 0.161609s (396.404 KiB/s)
** Verified OK **
** Resetting Target **
Info : SWD DPIDR 0x0bb11477
Info : SWD DPIDR 0x0bb11477
Error: DP initialisation failed
shutdown command invoked
Info : psoc4.dap: powering down debug domain...
Warn : Failed to power down Debug Domains
```