This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is it safe to use USB dp/dm pins for SWD interface?

We are building a new version of a small device with the new nRF52832. Its only external connection is a micro USB plug that we use for charging - we do not need it as USB data interface. But would like to (mis-)use the two data pins for Serial Wire Debug (SWCLK/SWDIO) for flashing, debugging, and RTT. As long as charging is done with our standard charger, everything is fine, because we do not connect the USB data lines.

Is it safe, if the device is connected/charged via a USB host, e.g. a PC, or is it possible that an USB host causes mal-functioning of the nRF52832, i.e. stops/crashes the application code?

EDIT: Assume that signals are clipped to protect the SWD-pins electrically from over-voltage.

Has anyone experience with a similar setting?

Parents
  • This is a follow up. I would also like to use this approach. However, I noticed that as soon as I plug a standard USB cable that routes D+/D- to SWDIO and SWDCLK, the device shuts down (I assume it goes into debug mode). I am also using the +5V USB line to both power up the device and charge the device, so I can't use the switch trick (charger module needs 5V). Did any manage to get this to work by modifying the circuit somehow?

  • I can only see two options here:

    • Disable progamming interface or debug mode in software (is that even possible? ask at nordic support website)
    • Put mosfets between USB and SWD pins, then control this mosfets with some gpio pins, but then you need some event to know when to enable the programming interface (user buton, bluetooth message...) Or if your programmer is 3V and the power is 5V, connect power pin to an ADC pin with a resistor ladder and monitor if it is 3 or 5 V, so you know if your programmer is connected, then enable the SWD mosfets
Reply
  • I can only see two options here:

    • Disable progamming interface or debug mode in software (is that even possible? ask at nordic support website)
    • Put mosfets between USB and SWD pins, then control this mosfets with some gpio pins, but then you need some event to know when to enable the programming interface (user buton, bluetooth message...) Or if your programmer is 3V and the power is 5V, connect power pin to an ADC pin with a resistor ladder and monitor if it is 3 or 5 V, so you know if your programmer is connected, then enable the SWD mosfets
Children
No Data
Related