Problems using the Photon2 with the Particle debugger

Hi all

Has anyone sucesfully used the particle debugger with the Photon 2.
I'we updated firmware in the debugger to v0254.2.

When toggling reset, i can connect to the device, with following log

/Users/au263437/.particle/toolchains/openocd/0.11.0-particle.4/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /Users/au263437/.particle/toolchains/openocd/0.11.0-particle.4/share/openocd/scripts -f /Users/au263437/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/cmsis-dap.cfg -f target/rtl872x_km4_debug.cfg
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2022-03-25-19:34)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDLiveWatchSetup
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : CMSIS-DAP: SWD  supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: FW Version = 0254.2
Info : CMSIS-DAP: Serial# = 310436023138a9461239333437353533a5a5a5a597969908
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 : [rtl872x.cpu] Cortex-M55 r1p0 processor detected
Info : [rtl872x.cpu] target has 2 breakpoints, 1 watchpoints
Info : [rtl872x.cpu] external reset detected
Info : starting gdb server for rtl872x.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1010aa94 msp: 0x10004d84
> KM4: reset-assert-post event
0x480003f8: 02000201 

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x10100100 msp: 0x1007effc
Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0x00000100

I use the suggested debug configuration in VSCode, and have experimented with disabling rtos, alternating between attach and launch.

I cannot capture execution at any breakpoints

    "configurations": [
        {
            "type": "cortex-debug",
            "request": "attach",
//            "request": "launch",
            "servertype": "openocd",
            "name": "Particle Debugger",
            "cwd": "${workspaceRoot}",
//            "rtos": "FreeRTOS",
            "armToolchainPath": "${command:particle.getDebuggerCompilerDir}",
            "executable": "${command:particle.getDebuggerExecutable}",
            "serverpath": "${command:particle.getDebuggerOpenocdPath}",
//            "preLaunchTask": "Particle: Flash application for debug (local)",
            "showDevDebugOutput": "raw",
            
            "searchDir": [
                "${command:particle.getDebuggerSearchDir}"
            ],
            "configFiles": [
                "${command:particle.getDebuggerConfigFiles}"
            ],
            "postAttachCommands": [
                "${command:particle.getDebuggerPostAttachCommands}"
            ],
            "particle": {
                "version": "1.0.1",
                "debugger": "particle-debugger"
            }
        },
1 Like

Hi-

Photon 2 is not fully supported by the debugger yet- we are working on it and there have been varying cases of success. We're looking into your issue internally and will see if we can recreate it.

1 Like

Hi Colleen,

Has there been any progress on supporting the Photon 2 with the particle debugger?

I am trying to connect a hardware debugger to the Photon 2, but I get the following log.

/Users/r/.particle/toolchains/openocd/0.11.0-particle.4/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /Users/r/.particle/toolchains/openocd/0.11.0-particle.4/share/openocd/scripts -f /Users/r/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/cmsis-dap.cfg -f target/rtl872x_km4_debug.cfg -c "CDRTOSConfigure FreeRTOS"
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2022-03-25-19:34)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDLiveWatchSetup
/Users/r/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl: rtl872x.cpu configure -rtos FreeRTOS
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : CMSIS-DAP: SWD  supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: FW Version = 0254.2
Info : CMSIS-DAP: Serial# = 310436023138ce401239333437353533a5a5a5a597969908
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
Error: Error connecting DP: cannot read IDR

I am using the default debug configuration in VSCode. I've already verified that the debugger works properly with an Argon.

You should be able to use a CMSIS/DAP debugger like the Particle debugger with the P2, Photon 2, and M-SoM.

  • Make sure you have flashed debug-enabled firmware to the device. Because SWD is on pins shared with GPIO it defaults to not being enabled once user firmware starts.
  • "cannot read IDR" sometimes happens when the device or debugger get into a bad state and unplugging and powering down the Particle device and debugger and plugging everything back in helps
  • Make sure your Photon 2 is powered by USB or battery; it cannot be powered by the debugger.
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.