Debug support for Electron


#1

The Workbench info page on the website says “Out of box support for step through debugging right in the editor. Works with Particle’s 3rd generation debugger.”, and the Particle Debugger page says “you’ll be able to program Particle mesh-ready hardware”, so should I infer that debugging for Electron will not be supported?


#2

Hi Darren,

The Particle Debugger has specific features to make it easier to debug 3rd-generation hardware. For example, both the Particle Debugger and all 3rd-generation hardware have on-board 10-pin 0.05" connectors so that they can be easily interfaced with a single cable. And with Workbench, we’re providing automatic configuration of the Particle Debugger to be used with the 3rd-generation hardware.

That said, it may be possible to manually configure Workbench to support debugging other Particle devices. The new Debugger is CMSIS-DAP-compliant, which means it should be able to debug any Arm device with the correct configuration. Workbench provides hooks to consume the needed configs so that a hardware debugger can work with the Debugging UI. And since the Electron doesn’t have an on-board 10-pin 0.05" connector, you’ll need to source an adapter of some kind to make the connection.

In the future we may add support for automatic configuration of more devices but for now, only the Particle Debugger and 3rd-generation hardware will be supported.


#3

I’ve debugged an electron using the Particle Debugger via Workbench but it required soldering some jumper wires to D6/D7/GND for the SWD connection. Any other debug hardware you have handy might also work assuming it is supported by OpenOCD.

You’ll have to supply your own debug launch configuration for the Electron so I’m copying the launch.json I use. If you have a different debugger you can just swap out the “interface/…” under configFiles.

{
    "version": "0.1.0",
    "configurations": [
        {
            "cwd": "${workspaceRoot}",
            "executable": "./target/YOUR-FIRMWARE.elf",
            "name": "Debug Electron",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "openocd",
            "device": "STM32F205RG",
            "interface": "swd",
            "configFiles":[
                "interface/cmsis-dap.cfg",
                "target/stm32f2x.cfg"
            ],
        },
    ]
 }

#4

Oh cool… I have a couple of J-Links here so would be cool to get that working. Thanks!


#5

There is an “interface/jlink.cfg” that should hopefully work out of the box. I think you only need to connect D6 as SWCLK, D7 as SWDIO, and GND.

Depending on your platform you might need to disable/remove any existing JLINK drivers. It looks like OpenOCD wants to interact with JLINK in a low-level fashion. See https://wiki.segger.com/OpenOCD.

Good luck and definitely post back with any issues or a success story! I don’t have a JLINK myself to test with so am very curious :slight_smile:


#6

The Segger J-Link is used at Particle (mainly by hardware people, as it’s expensive). The ST-LINK/V2 and clones are also widely used. The new Particle Debugger (CMSIS-DAP) is very cool and works with both mesh devices and the Photon/P1/Electron/E Series. It’s also a handy USB to UART serial adapter.


#7

Has anyone tried IDAP-Link?


#8

I was under the impression that the debug feature in Particle Workbench was going to be released later on. It looks like it’s already out… that’s great.
@rickkas7, can you confirm that the ST-LINK/V2 can be used to debug Photon, Electron and Mesh with Particle Workbench, provided I wire it up?
I am about to place an order and I am wondering if I should include the new debugger. I am not sure the CMSIS-DAP provides much more value compared to the ST-LINK.
I also have other USB-UART adapters, so do I really need one more?


#9

If you have a working ST-LINK there’s no need to get the Particle Debugger for working with the Photon/P1/Electron/E Series.

However if you are also going to work with mesh devices, you’ll want to get the Particle Debugger.


#10

Thanks @rickkas7. Do you mean that the ST-LINK will not work, or that it is a major hassle to get it working with Mesh devices?
Having 4 of these gadgets already, I am wondering what is the “need” vs “want” ratio.


#11

I haven’t actually tried it, but I’m guessing the ST-LINK won’t work with the mesh devices. Primarily because the Nordic nRF52840 isn’t a STMicroelectronics STM32 processor. They’re both ARM Cortex processors, but the Nordic processor is not a STM32.

The CMSIS-DAP really is nice. It’s driverless, using a HID device, and is way easier to set up than any other debugger I’ve used.