# Tips for using particle debugger SWD with photon

**URL:** <https://community.particle.io/t/tips-for-using-particle-debugger-swd-with-photon/55155>\
**Category:** Firmware\
**Created:** [March 13, 2020, 2:04am UTC](https://community.particle.io/t/tips-for-using-particle-debugger-swd-with-photon/55155 "2020-03-13T02:04:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khp](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@khp](https://community.particle.io/u/khp)\
**Post date:** [March 13, 2020, 2:04am UTC](https://community.particle.io/t/tips-for-using-particle-debugger-swd-with-photon/55155/1 "2020-03-13T02:04:40Z")

</div>

I’m trying to use the latest particle debugger dongle to debug a photon app over SWD. I have the monolithic build based on 1.4.4 flashed and have followed this [step-by-step tutorial](https://medium.com/@jvanier/5-steps-to-setup-and-use-a-debugger-with-the-particle-photon-ad0e0fb43a34#.6hx9v7e1c) but as soon as I continue after setting my first breakpoint, the connection to openocd falls over. I’m assuming this is because the photon’s system f/w is taking over pins D6 and D7; my app definitely doesn’t use these pins.

Is this supposed to work? I realize that the tutorial was written for the programming shield which uses JTAG to talk to the photon but I was hoping to make it work with SWD. @rickkas7, can you elaborate on your comment “you will likely have problems using SWD in normal operating mode (breathing cyan)” in your [JTAG and SWD post?](https://github.com/rickkas7/particle_jtag)?

Any tips greatly appreciated, and if this is a dead-end/unsupported path it would be helpful to know that too.

Thank you,  
Kevin

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [March 13, 2020, 10:05am UTC](https://community.particle.io/t/tips-for-using-particle-debugger-swd-with-photon/55155/2 "2020-03-13T10:05:46Z")

</div>

You cannot use pins D6 and D7 in user firmware when SWD debugging on Gen 2 devices (Photon, P1, Electron, and E Series) as those pins are used for the debugger.

You can’t use SWD for user firmware binaries that are not compiled for JTAG/SWD. For example, any cloud build. However if you use a " for debug" option in Particle Workbench the SWD build flag is set and you can debug your firmware in normal operating mode (but still can’t use D6 and D7).

---

<div class="post-metadata">

**Author:** ![khp](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@khp](https://community.particle.io/u/khp)\
**Post date:** [March 13, 2020, 4:16pm UTC](https://community.particle.io/t/tips-for-using-particle-debugger-swd-with-photon/55155/3 "2020-03-13T16:16:06Z")

</div>

@rickkas7 Thank you for the quick reply and nudge.

I am building the device-os tree from source, in the device-os/main dir:

> make clean all PLATFORM=photon USE\_SWD\_JTAG=y MODULAR=n APPDIR=...

and for sure I'm not using D6, D7 in my app. After re-building with a clean device-os tree and re-flashing the monolithic build I am able to get gdb connected, stopping at breakpoints, etc. In my prior attempt I must have had library dependencies that were built without USE\_SWD\_JTAG=y MODULAR=n.

Thanks again.  
Kevin

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [September 12, 2020, 4:16am UTC](https://community.particle.io/t/tips-for-using-particle-debugger-swd-with-photon/55155/4 "2020-09-12T04:16:08Z")

</div>

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