1
\$\begingroup\$

I am designing a custom PCB based on STM32F401RCT6 microcontroller. I am using SWD interface and STlink to program and Debug the micro controller.

I understood that reset pin is used to RESET the MCU which includes all the registers clocks etc. When Reset pin is connected to ground externally it is in Reset state when it is not connected to ground it is not in reset state.

I also understood that the ST-LINK resets and then sends the program through SWD interface.

Question 1:

My question is how ST-Link resets because as per datasheet Reset pin of the micro controller should be connected to the ground via button switch so that we can manually reset by pressing it. But when I refer to the schematics to connect the reset pin to SWD interface, I saw two connections: one is via button switch to ground and another is directly connected to the SWD connector. Then I got confused like the reset pin is connected to ground via button switch and how STlink will reset the MCU when Reset pin is directly connected to the SWD connector without connecting it to ground.

So when we want to reset we need to do manually reset by pressing button. If it is like that then why we need reset pin for SWD interface to ST link?

Or is it like Inside Stlink Programmer Reset pin is connected to GND. So for automatic reset via STlink we are using RESET pin in SWD interface and for manual reset we are using button. Am I correct? If I am wrong correct me.

enter image description here

And my other question is: I am using SWD interface for programming and debugging since I am using SWD interface and not using Bootloader, should I connect Boot0 pin to ground. Or is there any use of Boot0 pin (Bootloader) while programming using SWD interface?

\$\endgroup\$
3
\$\begingroup\$

I've just completed a PCB for a STM32 (STM32F042). The design is minimal:

  • BOOT0 is connected to ground
  • NRST is not connected at all
  • SWDIO and SWDCLK are available for programming and debugging

The ST-Link can reset the MCU using a command via SWD interface. If you want to connect NRST, go as described by Justme.

Update

To clarify question 2: BOOT0 is not needed if you use SWD. It would be needed if you want to upload firmware via UART. So just connect it to ground.

\$\endgroup\$
2
\$\begingroup\$

The pushbutton connects reset pin to ground only when it is pushed. It does not prevent the ST-Link pull it to ground to reset it.

If you don't want or need a physical reset button then don't draw it.

The ST-Link can reset the target via SWD or with the physical reset pin. It does not need the physical reset pin, it is there for cases when target uses SWD pins for something else so reset via SWD is not available.

If you never want to run the built-in bootloader, connect the Boot0 to ground to always run the user program.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.