Fixing the 0V Target Voltage Issue with NUCLEO ST-Link/V2 on an External Target
Introduction
I was trying to use the ST-Link/V2 separated from a NUCLEO board to debug a custom PCB (AT32F405RTC7). However, I ran into an issue where OpenOCD recognized the target voltage as 0V and could not establish a connection.
The root cause turned out to be the resistor placement on the NUCLEO board, and the problem was resolved by relocating the resistor. This article explains the cause and the fix.
Symptom
When launching OpenOCD, the target voltage is reported as 0.0V and debugging cannot start:
Target voltage: 0.000000
Even though measuring the test point confirmed that 3.3V was being supplied correctly, the ST-Link was unable to detect it.
Root Cause: ST-Link Target Voltage Detection Circuit
ST-Link/V2 has a mechanism that detects the power supply voltage (VDD) of the debug target and matches the SWD I/O levels accordingly. On the NUCLEO board, this voltage detection circuit is connected to the VDD of the on-board MCU (STM32F303K8).
In other words, the circuit is designed with the assumption that you are debugging the on-board MCU, so the external target’s VDD never reaches the ST-Link’s voltage detection pin.
Looking at the NUCLEO board schematic, the voltage-divider resistors used by the internal STM32F103 of the ST-Link to detect voltage are connected to the on-board MCU side via solder bridges (SB) on the board.
Fix: Relocating the Resistor
To make the ST-Link recognize the external target’s voltage, the following modification was made:
- Identify the resistor involved in voltage detection on the NUCLEO board (in this case, R23)
- Remove R23 from the on-board MCU’s VDD pad
- Relocate it to pad R9 on the VDD pin (Pin 1) side of the SWD connector
This routes the external target’s VDD into the ST-Link’s voltage detection circuit.
Verification After Modification
After relocating the resistor, launching OpenOCD successfully detected the target voltage:
Target voltage: 3.271672
This enabled SWD-based debugging of the external target AT32F405.
SWD Wiring
For reference, the wiring from NUCLEO-F303K8’s CN4 (SWD connector) to the external target is as follows:
| CN4 Pin | Signal | Connection |
|---|---|---|
| 1 | VDD | Target 3.3V |
| 2 | SWCLK | Target SWCLK |
| 3 | GND | Target GND |
| 4 | SWDIO | Target SWDIO |
| 5 | NRST | Target NRST |
Summary
When repurposing a NUCLEO board’s ST-Link for an external target, you need to reroute the voltage detection circuit. By consulting the schematic and switching the target voltage detection path to the SWD connector side, the ST-Link will function correctly.
If you are stuck with “Target voltage: 0.0V”, start by checking the connections of the voltage detection resistors and solder bridges on your board.