CCG3PA: OpenOCD SWD configuration for CYPD3175?

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

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

cross mob
drewfustini
Level 3
Level 3
10 replies posted 10 sign-ins 5 replies posted

I would like to program firmware onto a CCG3PA CYPD3175-24LQXQ using the SWD lines and OpenOCD.  However, I can not figure out the appropriate OpenOCD configuration file for the part.  Is there anywhere to find that?

1 Solution
drewfustini
Level 3
Level 3
10 replies posted 10 sign-ins 5 replies posted

UPDATE: I was able to program CCG3PA from OpenOCD using MiniProg4 as follows:

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 },



This PR #5: https://github.com/cypresssemiconductorco/openocd/pull/5

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

View solution in original post

0 Likes
5 Replies
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

If you have chance to find Cypress PSoC4/4A OpenOCD and Programming Specification of CYPD3175, you could achieve CYPD3175 programming with slightly delay changes based on PSoC 4/4A.

0 Likes


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/cypresssemiconductorco/openocd/issues/4

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/8ad3056959d4c626a540a9894c59bbcc

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/cypresssemiconductorco/openocd/blob/d526e667dedfdadead74b9ff4292344b07a5af1c/src/...

I would very much appreciate any additional insights you could provide.

0 Likes
drewfustini
Level 3
Level 3
10 replies posted 10 sign-ins 5 replies posted

Thank you. 

I am looking at:
https://github.com/cypresssemiconductorco/openocd/blob/cypress/src/flash/nor/psoc4.c

and:
https://github.com/cypresssemiconductorco/openocd/blob/cypress/tcl/target/psoc4.cfg

Could you provide any guidance on how to change the delays?

Is the CCGx (CYPDxxxx) Programming Specifications meant to cover  the CCG3PA (CYPD3175 )?

It references on page 24:

// Sufficient delay after reset for boot process
Delay(5 ms); 
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

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

0 Likes
drewfustini
Level 3
Level 3
10 replies posted 10 sign-ins 5 replies posted

UPDATE: I was able to program CCG3PA from OpenOCD using MiniProg4 as follows:

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 },



This PR #5: https://github.com/cypresssemiconductorco/openocd/pull/5

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
0 Likes