Kitprog3 debug error

Hi all,
After building HelloWord app I tried to program Onethinx flash using kitprog3.The status led blinks and I got the following error:
(I updated kitprog3 firmware )


Open On-Chip Debugger 0.10.0+dev-2.1.0.99 (2019-02-01-05:23)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1500 kHz
adapter speed: 1000 kHz
** Auto-acquire enabled, use “set ENABLE_ACQUIRE 0” to disable
cortex_m reset_config sysresetreq
cortex_m reset_config vectreset
adapter_nsrst_delay: 200
Info : CMSIS-DAP: SWD 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 : VTarget = 0.000 V
Info : kitprog3: acquiring PSoC device…
Error: kitprog3: failed to acquire PSoC device
Info : clock speed 1000 kHz
Error: DAP ‘psoc6.cpu’ initialization failed (check connection, power, etc.)
** OpenOCD init failed **
shutdown command invoked
** Program operation failed **
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

I had a similar looking issue “Error: DAP ‘psoc6.cpu’ initialization failed (check connection, power, etc.)” that turned out to be a “bad” board…

That said I have only been able to program the demo board using the debug/run configuration “debug” (not “erase” or “program”)
AND…

Only after pressing the “mode” button on the “KitProg3” to put it into “CMSIS-DAP HID” (status LED will ramp/strobe at a 1 Hz rate, OpenOCD reports "FW version = 1.2.0) vs “CMSIS-DAP BULK” (status LED on steady, OpenOCD reports “FW Version = 2.0.0”)
OR…
Replace debug configuration line -c "source [find interface/kitprog3.cfg]" with -c "source [find interface/cmsis-dap.cfg]"
so that both modes of the latest kitprog3 firmware work.

My (working) debug configuration “Debug” debugger config options:

-s "${cy_tools_path:openocd}/scripts"
-s "${workspace_loc}/OnethinxCore_00_config/GeneratedSource"
-c "source [find interface/cmsis-dap.cfg]"
-c "transport select swd"
-c "set ENABLE_CM0 0"
-c "set ENABLE_AQUIRE  0"
-c "source [find target/psoc6.cfg]"
-c "puts stderr {Started by GNU MCU Eclipse}"
-c "init; reset init"

Open On-Chip Debugger 0.10.0+dev-2.1.0.99 (2019-02-01-13:18)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
0
0
adapter speed: 1000 kHz
** Test Mode acquire not supported by selected adapter
cortex_m reset_config sysresetreq
adapter_nsrst_delay: 200
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.2.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 : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
** SFlash SiliconID: 0xE2072300

Scott.

Hi Scott,
Thanks for feedback.I will test later

  1. As Scott mentioned, the KitProg should be in HID mode (the amber led should be ‘breathing’ according Cypress).
  2. Sometimes the M4 cannot be aquired in so called ‘testmode’. This mode will acquire the M4 before any code is started. However this is a critical procedure (timing dependent). In some cases the M4 cannot be acquired in testmode, this is mostly the case when IPC calls are done directly after the M4 is started (for example by calling LoRaWAN_Init). In debug mode a CyDelay(1000); at the beginning of main.c will be enough for testmode acquire to succeed.
    Once the device is programmed without delay, it is useful to acquire in non-testmode by setting:
    set ENABLE_AQUIRE 0
    and / or using
    source [find interface/cmsis-dap.cfg]

Hope this helps!

Hi Rolf,

I tested Scott configuration.Got some read memory errors but I think the flash is programmed .

This test is just a HelloWorld to blink led.After terminate debug led does not blink.

Open On-Chip Debugger 0.10.0+dev-2.1.0.99 (2019-02-01-05:23)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
0
0
adapter speed: 1000 kHz
** Test Mode acquire not supported by selected adapter
cortex_m reset_config sysresetreq
adapter_nsrst_delay: 200
Started by GNU MCU Eclipse
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.2.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 : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
** SFlash SiliconID: 0xE2072300
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000f00 msp: 0x08047800
Started by GNU MCU Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting ‘gdb’ connection on tcp/3333
Info : MainFlash size overridden: 1024 kB
semihosting is enabled
** SFlash SiliconID: 0xE2072300
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000f00 msp: 0x08047800, semihosting

[ 7%] [## ] [ Erasing ]
[ 11%] [### ] [ Erasing ]
[ 15%] [#### ] [ Erasing ]
[ 19%] [###### ] [ Erasing ]
[ 23%] [####### ] [ Erasing ]
[ 26%] [######## ] [ Erasing ]
[ 30%] [######### ] [ Erasing ]
[ 34%] [########## ] [ Erasing ]
[ 38%] [############ ] [ Erasing ]
[ 42%] [############# ] [ Erasing ]
[ 46%] [############## ] [ Erasing ]
[ 50%] [################ ] [ Erasing ]
[ 57%] [################## ] [ Erasing ]
[ 61%] [################### ] [ Erasing ]
[ 65%] [#################### ] [ Erasing ]
[ 69%] [###################### ] [ Erasing ]
[ 73%] [####################### ] [ Erasing ]
[ 76%] [######################## ] [ Erasing ]
[ 80%] [######################### ] [ Erasing ]
[ 84%] [########################## ] [ Erasing ]
[ 88%] [############################ ] [ Erasing ]
[ 92%] [############################# ] [ Erasing ]
[ 96%] [############################## ] [ Erasing ]
[100%] [################################] [ Erasing ]
Info : Padding image section 0 at 0x10003318 with 232 bytes (bank write end alignment)

[ 57%] [################## ] [ Programming ]
[ 61%] [################### ] [ Programming ]
[ 76%] [######################## ] [ Programming ]
[100%] [################################] [ Programming ]
** SFlash SiliconID: 0xE2072300
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x16002008
Error: mem2array: Read @ 0x16002004, w=4, cnt=1, failed
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000f00 msp: 0x08047800, semihosting
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x41000003 pc: 0x10002060 msp: 0x0803ef8c, semihosting
Info : psoc6.cpu.cm4: bkpt @0x100002CF, issuing SYSRESETREQ
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x41000003 pc: 0x10002060 msp: 0x0803ef8c, semihosting
===== arm v7m registers
(0) r0 (/32): 0x0803EF98
(1) r1 (/32): 0x16001810
(2) r2 (/32): 0x16001810
(3) r3 (/32): 0x00000000
(4) r4 (/32): 0x00000001
(5) r5 (/32): 0x10002D94
(6) r6 (/32): 0x00000001
(7) r7 (/32): 0x00000001
(8) r8 (/32): 0x232E8AFA
(9) r9 (/32): 0x81F7D5CC
(10) r10 (/32): 0x51E3EEFE
(11) r11 (/32): 0x3D9ACE56
(12) r12 (/32): 0x0000001A
(13) sp (/32): 0x0803EF8C
(14) lr (/32): 0x100020FD
(15) pc (/32): 0x10002060
(16) xPSR (/32): 0x41000003
(17) msp (/32): 0x0803EF8C
(18) psp (/32): 0xF96E2C4C
(19) primask (/1): 0x01
(20) basepri (/8): 0x00
(21) faultmask (/1): 0x00
(22) control (/2): 0x00
(23) d0 (/64): 0x7FBFA5E2FFC7FDFD
(24) d1 (/64): 0x7FCFC5167FADFD0F
(25) d2 (/64): 0xFFCE3089FFE82113
(26) d3 (/64): 0xFFC803B35FEF6186
(27) d4 (/64): 0xFDBD639947F7EEB1
(28) d5 (/64): 0xFFCAF3BFFFA5D537
(29) d6 (/64): 0xFCFE9BEB7FDB0C27
(30) d7 (/64): 0xFF85FDA9FDC7E125
(31) d8 (/64): 0xFFD261ECFFAFE3B7
(32) d9 (/64): 0x7EAFFF2B7F8E99AF
(33) d10 (/64): 0xFFC21456F3A7011C
(34) d11 (/64): 0xCBF763CC7BC83F7C
(35) d12 (/64): 0x7FBCC9F9EB8AE28C
(36) d13 (/64): 0xFFDBB9AB3F9AEFA9
(37) d14 (/64): 0xB9B5B2B5FFDFCFB7
(38) d15 (/64): 0xFFA61F6A7F9BC5BF
(39) fpscr (/32): 0x00000000
===== Cortex-M DWT registers
Info : dropped ‘gdb’ connection

Hi Marcio,

Looks like you are taking a hard fault… (and the handler is likely an infinite loop.)

target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000f00 msp: 0x08047800, semihosting
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x41000003 pc: 0x10002060 msp: 0x0803ef8c, semihosting
Info : psoc6.cpu.cm4: bkpt @0x100002CF, issuing SYSRESETREQ
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x41000003 pc: 0x10002060 msp: 0x0803ef8c, semihosting
===== arm v7m registers

I also ran into some hard faults when building the existing demos with the latest Modus Toolbox. You can see my issues and workarounds here:
https://forum.onethinx.com/t/modus-1-1-demo-programs-hard-fault-in-cy-syspm-ldosetvoltage/284

Be careful while poking around in the device configurator… It is easy to make a big broken mess in there… :wink:

Scott.