2026-04-02 6:52 PM - last edited on 2026-04-03 3:17 AM by Andrew Neil
Hi all, I have reached the point of desperation, and I am all out of ideas how to get my STM32U031 project working.
I designed a very simple PCB which has only a few components. I have attached the KiCad files in case it is helpful. I followed guidelines for decoupling capacitors and broke out the SWDIO and SWCLK pins.
The issue I have is this: I can not program/connect to the chip over SWD.
When I power the PCB from 3V, the first noticeable problem is GPIO PA3 goes high. You can notice that because that pin is connected to the gate of a mosfet which is used to switch some LEDs, so when it goes high, the LEDs turn on. It is especially strange because I put an external pulldown resistor on the pin, so the fresh unprogrammed MCU is driving it high for some reason. I also connected my ST Link to the PCB, but when I try to connect with any speed or reset settings, I see this error:
02:27:47 : UR connection mode is defined with the SWrst reset mode
02:27:47 : ST-LINK SN : 003B00243333511831363730
02:27:47 : ST-LINK FW : V3J16M7
02:27:47 : Board : STLINK-V3MINIE
02:27:47 : Voltage : 2.96V
02:27:47 : Error: Unable to get core ID
02:27:47 : Error: ST-LINK error (DEV_TARGET_CMD_ERR)
I initially thought the issue was a damaged MCU during soldering, so I ordered a new MCU and soldered it using low temperature paste to a new PCB with just the MCU and decoupling caps to eliminate the possibility of other things on the circuit causing issues. As far as I can tell the second assembled circuit has the exact same problems.
I also tried soldering a wire to the reset pin to allow me to manually reset the chip and add an external pull up resistor (even though the IC has a built in pullup on NRST), but that didn't make any difference either.
To further try to diagnose the issue, I have soldered another new chip to a DIP breakout PCB I had lying around. I soldered decoupling caps the best I could, but it is still not ideal how far away they are from the chip. I still think it should be a good way to test things though.
Sadly, even with the chip on a breakout I have the same problems! I can not program it, and some GPIO are at weird voltage levels. PA3 is high like my previous attempts. Some other pins are also weird like PB1 is at 2V for some reason, PA5 is at 1.3V, the list goes on. Also, I will mention that I have seen the chip draw between 1mA and 4mA from a 3V supply of my Nordic PPK 2. One time it drew 1mA and some time later after debugging things it randomly is seems to draw 4mA, so not sure what is causing the change.
The strange voltages make me feel like the chips are damaged, but I seriously doubt three chips in a row have been damaged. They were ordered form the ST E Store, kept in sealed ESD bags, and assembled with low temp paste.
I also thought perhaps I got the orientation wrong, but as far as I can tell I have it right. On my PCB and on my breakout board. I do find it weird that in CubeMX, the ST logo and MPN on the chip are in a different orientation than on the actual chip. However I have double checked the pin I marking on the underside of the MCU and it matches the pin 1 marking dot on the top of the MCU.
I am out of ideas now, so if anyone can suggest something, please do!
I have uploaded photos of things I think could be useful.
Thank you in advance!
Solved! Go to Solution.
2026-04-03 4:57 PM
Since I could get the MCU on the dip breakout connecting, but not the one on the PCB, I decided to solder a new PCB with the known good chip from the DIP breakout. I also reduced the wire length from the PCB to the programmer, and now I can connect!
I do not need to have the NRST pin connected to the programmer for a successful connection. I also do not need the 100nF cap between NRST and ground, however I will add that in the next revision to be safe.
It seems to me the issue was caused by too long cable lengths from the ST link to the MCU and potentially a damaged chip on the PCB. Either way I am glad it is working, thank you for all the help everyone!
2026-04-02 8:27 PM - edited 2026-04-02 8:29 PM
You have pictures of two, as far as I can tell, unrelated setups. One is a heart shaped board and one is rectangular board on a breadboard. Which one are you trying to debug here?
I see, the heart shaped board is the target and the other one is the breakout to further help and debug.
The issue is likely wiring, or chip orientation, or soldering.
2026-04-03 1:13 AM
Yes that is correct, the heart is the target but I am also trying a breakout board to eliminate the possibility of mistakes in the PCB.
A soldering problem seems very unlikely to me. I used a stencil with a hot air station and low temperature 130° paste so they were definitely not over heated I also kept them in their dry anti static packaging until assembly. The solder joints look very good overall and can not find any shorts between pins.
As for chip orientation, I have verified orientation with the pin 1 marking on the top of the package and also by checking the pin 1 marking (chamfered part of exposed pad) on the underside of the chip. Unless the die inside is somehow oriented differently to how the package suggests, I have the orientation correct.
I have checked the schematic and breadboard wiring many times, it looks correct to me. Only thing I can think of is I will check the stlink signals on my scope when I try to connect to verify it is doing something.
2026-04-03 3:20 AM
How to solve connection errors when connecting and programming the STM32 target board.
How to solve debugger connection issues
2026-04-03 8:12 AM
I suppose it goes to bootloader...
you have PF3 open, that would possibly start the bootloader; connect PF3 to gnd and try connect again.
And maybe a 100nF cap on PF2 to gnd , to have longer reset at start.
2026-04-03 8:24 AM
@AScha.3 wrote:a 100nF cap on PF2 to gnd , to have longer reset at start.
@EricNava - as recommended in the datasheet:
https://www.st.com/resource/en/datasheet/stm32u031k4.pdf#page=81
2026-04-03 8:55 AM
That is a good idea, but I don't think it is.
From what I understand, the NBOOT_SEL option bit is set by default so the BOOT0 pin (PF3) should have no effect during boot.
I will try the cap to ground though on reset, that could be the issue. Thanks
2026-04-03 9:00 AM
Thank you for the suggestion.
I will try adding the capacitor to the reset pin later today as I can't access the hardware at the moment.
I have actually since posting had some success connecting to the MCU on the DIP breakout.
I don't think I have changed anything compared to my previous attempts, so that is confusing. I am thinking perhaps a connection from my ST Link is potentially bad. At least it rules out some possible causes of the issues.
When I connect I see these logs:
11:57:30 : UR connection mode is defined with the SWrst reset mode
11:57:30 : ST-LINK SN : 003B00243333511831363730
11:57:30 : ST-LINK FW : V3J16M7
11:57:30 : Board : STLINK-V3MINIE
11:57:30 : Voltage : 2.95V
11:57:30 : SWD freq : 8000 KHz
11:57:30 : Connect mode: Normal
11:57:30 : Reset mode : Software reset
11:57:30 : Device ID : 0x459
11:57:30 : Revision ID : Rev A
11:57:30 : Debug in Low Power mode is not supported for this device.
11:57:30 : UPLOADING OPTION BYTES DATA ...
11:57:30 : Bank : 0x00
11:57:30 : Address : 0x40022020
11:57:30 : Size : 100 Bytes
11:57:30 : UPLOADING ...
11:57:30 : Size : 1024 Bytes
11:57:30 : Address : 0x8000000
11:57:30 : Read progress:
11:57:30 : Data read successfully
11:57:30 : Time elapsed during the read operation is: 00:00:00.048
Unfortunately the MCU on my PCB still can't be connected, so I will try the capacitor later and see.
2026-04-03 9:25 AM
Maybe - but ds shows:
So just try it.
And your last post - now working, without chaging anything - could be just: pin was at lo level on start, so no bootloader started. (boot0 state is checked only once some clocks after reset ending.)
2026-04-03 9:45 AM
@EricNava wrote:perhaps a connection from my ST Link is potentially bad.
Yes, that is certainly a possibility - connections on solderless breadboards are notoriously unreliable!