Skip to main content
Graduate
October 18, 2024
Solved

No SWD target connection with STM32F103 on custom PCB

  • October 18, 2024
  • 6 replies
  • 5725 views

Dear all,

I'm unable to connect via SWD to my STM32F103C8T6. What ever I try I get no target found with STM32CubeProgrammer or ST-LINK Utility (I have tried all combinations at slow and high speeds).

 

- device is virgin

- BOOT0 is low

- NRST unconnected (shows 3V3) and connected/removed while testing

- Connections go through from ST-Link to STM32 pins

- 30 Ohm and 0 Ohm tested for SWCLK and SWDIO (GND and 3V3 connection to ST-Link with no resistor)

- Correct mapping of ST-LINK pins to STM32 checked multiple times

- There are no obvious shorts between any of the paths

- 3V3 is stable and GND closed

- The ST-Link was tested with a "blue pill" board with the same STM32 on it and it worked flawlessly

 

I have also tried:

- Cutting the path to the esternal 16MHz crystal curcuit

- Connecting/Disconnecting VCC

- Soldered a new STM32 onto the board

 

I am currently running out of ideas, I think there is either a fault in the PCB design that damages the MCU or prevents booting or maybe some config that I have missed? I'm grateful for any ideas..

 

Some info on the board: It's a 2-Layer 1 mm board with a solid GND plane on the backside, I have attached sreenshots of the schematic and the routing. Please not that the LED on the BOOT0 path has been replaced with a 0 Ohm resistor to actually pull the pin low. Please let me know any further info required.

 

akenvi_3-1729247754968.png

akenvi_0-1729246953860.png

akenvi_1-1729247086851.png

akenvi_2-1729247556002.png

 

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    Analogue power

    Part Orientation 

    6 replies

    Technical Moderator
    October 18, 2024

    Welcome @akenvi, to the community!

    Why do you have an LED in the direction of BOOT0? If you set the switch to GND, the LED is in the blocking direction, which means that BOOT0 cannot recognise a clear low.

    In addition, you should no longer use ST-LINK Utility, as it was replaced by STM32CubeProg a long time ago.

    Blue Pill is by no means a reference, as it is not an ST product and fake MCUs have been used there for years. Is the ST-LINK one of these colourful tin cans?

    Regards
    /Peter

    akenviAuthor
    Graduate
    October 18, 2024

    @Peter BENSCH 

    Hi Peter, thank you for your answer!

    I realized my mistake with the LED after I created it and changed the LED to a 0 Ohm resistor - I verified the BOOT0 is low. Thanks on the ST-LINK Utility info, I was not aware and that it would be the more in-depth program.

     

    I am using one of those colourful tin cans - but I thought if it works on the blue pill without any problem it should also work on this one. (I checked the pins at which SWCLK and SWDIO connect and they are the same as on my MCU) I have however ordered a "real" one yesterday, also for enhanced features.

     

    @Andrew Neil 

    Hi Andrew, thank you too - I tried Connect under Reset, Hot Plug, Normal and Power Down to no avail. I did leave NRST open on most tries though - although some said that it might need to be toggled.

    The clone is the upper one shown in the post you linked.

    Super User
    October 18, 2024

    @akenvi wrote:

    I tried Connect under Reset, Hot Plug, Normal and Power Down to no avail. I did leave NRST open on most tries though


    Connect under reset won't work unless NRST is connected to the ST-Link!

    Super User
    October 18, 2024

    Have you tried with NRST connected to the ST-Link, and configured for 'Connect under reset' ?

    As @Peter BENSCH said, do you have one of these clone ST-Links:

    https://community.st.com/t5/stm32-mcus/how-to-recognize-a-genuine-st-link-v2-versus-a-cloned-one/tac-p/703663/highlight/true#M965https://community.st.com/t5/stm32-mcus-products/debug-problem-with-clone-st-linkv2/m-p/661306/highlight/true#M240845

     


    @akenvi wrote:

    - Correct mapping of ST-LINK pins to STM32 checked multiple times


    As noted in the above link, Beware that the pinouts of the clones are not consistent!

    akenviAuthor
    Graduate
    October 19, 2024

    Hi, so this is what I get.

    akenvi_0-1729329369428.png

    akenvi_1-1729329424671.png

     

    There is one peculiar thing: When I switched on the power with the previous MCU (before desoldering it) the LEDs D3 and D5 lit up very dimly, leading me to believe the chip was faulty, the new chip also did it shortly but stopped after I disconnected it from power immediately. (Not a good sign either) A test with an older, less complex PCB design (different purpose board) also showed LEDs glowing dimly after some seconds but here the SWD is indeed working. So I'm asking myself again if the my new chip is faulty and if the problem is with the board design. Is it normal for some regular unprogrammed GPIO pins to go high after boot? One problem I could see is that 3V3 connection to the ST-LINK is straight through without a resistor and when I unplug the PCB the ST-LINK will feed the 3V3 to the board - might that have damaged something?

     

    PS: Is there any way for me to check if the MCU is defective or not? I usually read that its not easy with virgin devices, but maybe with an oscilloscope probe to specific pins?

    Super User
    October 19, 2024

    Hi,

    Is it normal for some regular unprogrammed GPIO pins to go high after boot? 

    Yes. See pin functions at start/reset : you need sdw, jtag working, so these pins do something, pullup on, etc.

     

    AScha3_0-1729331577880.png

    AScha3_1-1729331729765.png

    +

    >Is there any way for me to check if the MCU is defective or not?

    Not really ; see power consumption -> normal , as ds tells ? chip getting hot or pulls no power at all ?

    ESD handling ...? solder station grounded/ESD protected ? --- just some indication , not more.

    Then connects on swd ? (Thats my usual "test" : cpu seems good - or not. )

    +

    The F103 is very old, i had my first about 14 years ago; so its impossible , that you discover a "new" problem on this series.

    If your swd/swc pins are connected to st-link (not puzzled! )and cpu has 3v3 : it will connect - if alive.

    So if you sure, all vcc/vdda/gnd is connected and power consumption looks "normal" : it will connect.

    Otherwise: find the hardware/connection error.

    Graduate II
    October 19, 2024

    Analogue power

    Part Orientation 

    akenviAuthor
    Graduate
    October 22, 2024

    Thank you,

     

    apparently it was the VDDA pin that was not powered properly. With the pin powered the MCU boots and connection via STM32CubeProgrammer was possible in a first try. I think that solved the riddle.

    Visitor II
    October 20, 2024

    SWD lines (SWCLK, SWDIO) should be routed properly with minimal length and no sharp turns or excessive vias. These lines should also avoid high-noise areas. A solid ground return path for the SWD lines is critical, so verify the integrity of the ground plane and the connections between ST-Link and STM32. You mentioned that NRST is unconnected.  You can connect it directly to the ST-Link reset pin and attempt a reset before programming to ensure a clean reset signal. Before printing the PCB, it is always better to simulate the schematic. You can use simulation software for this task.

    https://www.richardelectronics.com/blog/categories/integrated%20circuit/what-are-the-popular-electronic-component-simulation-software

    Super User
    October 21, 2024

    @liaifat85 wrote:

    You mentioned that NRST is unconnected.  You can connect it directly to the ST-Link reset pin and attempt a reset before programming to ensure a clean reset signal.


    Indeed.
    @akenvi although NRST isn't strictly necessary, it is always wise to include it in the debugger/programmer connection - it will get you out of some situations where just the SWDIO+SWCLK can be locked-out.

     

     


    @liaifat85 wrote:

    Before printing the PCB, it is always better to simulate the schematic.


    Would any of those simulators actually simulate the SWD link?

    akenviAuthor
    Graduate
    October 22, 2024

    Thanks all for your further answers!

     

    It appears though as the problem is somewhere on the HW config side. We now tested several boards with the "real" ST-LINK V2 and NRST connected to no avail. When checking the levels of the signals close to the MCU pins or at the MCU pins there was a decent signal quality with almost no overshoot and a ripple of 100 mV peak-peak at 3.25V, SWCLK and SWDIO both looked similar in quality and NRST had a bit slower rise/fall time due to the capacitor as expected, but signal was very smooth.

    On one board we had many GPIOs high while on others almost none were (NRST was always high though).

     

    The next step is to build the board in the most basic config without any unnecessary components and check from there again.

    Super User
    October 22, 2024

    The marked solution from @Tesla DeLorean suggests Analogue Power or Part Orientation - which was it?

     

    Sorry - posted too quickly!