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 can be done, but you need to make sure that the SWDIO pin is connected to D- and SWCLK to D+. This is because the SWCLK input is normally low. If the D+ pin were to be driven high, it will trigger the USB host to try and identify the USB device and pulse the D+/D- pins causing the nRF to sporadically enter debug mode. I recommend that you put a 22ohm resistor in series with each data line and to protect it with a 3V3 TVS to ground. The TVS should go on the nRF side not the USB side, obviously.

Reply
  • This can be done, but you need to make sure that the SWDIO pin is connected to D- and SWCLK to D+. This is because the SWCLK input is normally low. If the D+ pin were to be driven high, it will trigger the USB host to try and identify the USB device and pulse the D+/D- pins causing the nRF to sporadically enter debug mode. I recommend that you put a 22ohm resistor in series with each data line and to protect it with a 3V3 TVS to ground. The TVS should go on the nRF side not the USB side, obviously.

Children
No Data
Related