Failure to upload from ST-LINK/V2 to STM32F411 black pill 3.1

I am starting to use a black pill V3.1 F411. I connect with a (genuine, I think) ST-LINK/V2. The connection is made as per the Barnaby Walters article on this.

Basically he describes two ways - powered from the ST-LINK, and self powered. The former uses 5 wires - GND, DIO, CLK, 3V3 (power from ST-LINK) and 3V3 also fed back to STLINK VAPP pin for power monitoring. The latter just uses 4 wires - GND, DIO, CLK, and 3V3 fed back to STLINK VAPP pin for power monitoring.

I’ve using self powered and all was fine, uploading, debugging etc was all good.

But, when I swapped to self powered (the black pill being powered from a 5V0 supply), I cannot connect to upload. A typical error is:

xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

hla_swd
Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1

I have tried various combinations of powering up with boot0 or nrst down, makes no difference. The code is unchanged - upload works one way, not the other. I’m not using PA13/14 for anything. The only way I can get it to upload and debug is when powered from the ST-LINK/V2, however, once the code is loaded, the board and app run perfectly well off 5V0/0V.

Pretty much all of it must be OK, or I couldn’t upload and debug when powered from the ST-LINK. The onboard regulator is generating 3.308V, so that all looks good.

A bit stuck here, can anyone advise?