Fix ST-Link for STM32 Blue Pill

Van Chan Ngo · January 22, 2021

In this post of fixing ST-link utility on Linux such as Ubuntu.

Issues

When we run st-link on Ubuntu to reset or erease the STM32 blue pill board.

$ st-flash reset
st-flash 1.6.1
2021-01-21T01:35:02 WARN usb.c: NRST is not connected
2021-01-21T01:35:02 WARN common.c: unknown chip id! 0x3748
Failed to connect to target
$ st-flash erase
st-flash 1.6.1
2021-01-21T01:43:16 WARN usb.c: NRST is not connected
2021-01-21T01:43:16 WARN common.c: unknown chip id! 0x3748
Failed to connect to target

We get the error messages

unknown chip id! or Failed to connect to target

The following shows a possible way to resolve this issue.

How to fix

We can perform the following steps to resolve the issue.

  • Step 1: Set the board into programming mode as shown in the image

Programming mode

  • Step 2: Run the command st-flash erase while press the reset button
$ st-flash erase
st-flash 1.6.1
2021-01-21T01:43:22 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 0 KiB flash in at least 1 KiB pages.
Mass erasing