cancel
Showing results for 
Search instead for 
Did you mean: 

Using SWD pins to flash code

bhoomika_patil
Associate

Hi,

 

I am using STM32H503 controller and wanted to understand if SWDIO pin can be used to flash the code.

1 ACCEPTED SOLUTION

Accepted Solutions

Not on its own.

The SWD interface consists of two pins:

  1. SWDIO is the (bidirectional) data pin;
  2. SWCLK is the clock pin.

You need both plus, of course, GND.

https://developer.arm.com/documentation/101636/0100/Debug-and-Trace/JTAG-SWD-Interface

https://learn.sparkfun.com/tutorials/arm-programming/jtag-and-swd

https://kb.segger.com/Target_Interface_SWD

Although not always strictly necessary, you should also include NRST in your debugger/programmer connection - it can get you out of some "bricked" states.

In addition, most debug/programming probes (eg, ST-Link) also want a connection to the target's VDD line.

See the documentation for your debug/programming probe.

See Application note AN5711Getting started with STM32H5 MCU hardware development:
https://www.st.com/resource/en/application_note/an5711-getting-started-with-stm32h5-mcu-hardware-development-stmicroelectronics.pdf#page=27

 

 

 

View solution in original post

5 REPLIES 5
TDK
Guru

Yes, the SWD connection is the typical way code is flashed using STM32CubeProgrammer and an ST-Link programmer.

If you feel a post has answered your question, please click "Accept as Solution".

Not on its own.

The SWD interface consists of two pins:

  1. SWDIO is the (bidirectional) data pin;
  2. SWCLK is the clock pin.

You need both plus, of course, GND.

https://developer.arm.com/documentation/101636/0100/Debug-and-Trace/JTAG-SWD-Interface

https://learn.sparkfun.com/tutorials/arm-programming/jtag-and-swd

https://kb.segger.com/Target_Interface_SWD

Although not always strictly necessary, you should also include NRST in your debugger/programmer connection - it can get you out of some "bricked" states.

In addition, most debug/programming probes (eg, ST-Link) also want a connection to the target's VDD line.

See the documentation for your debug/programming probe.

See Application note AN5711Getting started with STM32H5 MCU hardware development:
https://www.st.com/resource/en/application_note/an5711-getting-started-with-stm32h5-mcu-hardware-development-stmicroelectronics.pdf#page=27

 

 

 

Thank you!

@bhoomika_patil please mark a solution in this thread.

I've moved your new question to a new thread:

https://community.st.com/t5/stm32-mcus-products/using-swd-and-usb-dfu-to-flash-code/m-p/759568#U759568