cancel
Showing results for 
Search instead for 
Did you mean: 

How to use STM32F407-DISC1 onboard ST-LINK to program another STM

GCraf.1
Associate II

Hi

I'm trying to use my STM32F407-DISC1 board's onboard ST-LINK to program a STM32 black pill (STM32F103C8), but can't get it working for the life of me.

I've connected the two boards as follows:

  • Discovery SWD Pin 2 (SWCLK) -> Black Pill SCLK
  • Discovery SWD Pin 3 (GND) -> Black Pill GND
  • Discovery SWD Pin 4 (SWDIO) -> Black Pill DIO
  • Discovery JP1 -> Black Pill Vcc (Powering the black pill instead of the STM32F407). I've also tried powering the black pill through usb and connecting Discovery SWD Pin 1 -> Black Pill Vcc

I've updated the Discovery's ST-Link to the newest firmware.

Using the st-info utility, I'm able to detect the ST-Link on the Discovery board correctly, but st-info --descr either returns nothing or "unknown board".

When I set the black pill's jumpers to pull BOOT0 high, I can see the correct output from st-info --descr, but when I use Atollic TrueSTUDIO to upload the program to the black pill while BOOT0 is high, it uploads successfully but immediately loses the debug connection.

When BOOT0 is low, I can't upload at all.

What could I be doing wrong?

Regards

Gerrie

1 ACCEPTED SOLUTION

Accepted Solutions
GCraf.1
Associate II

I finally figured out what the problem was, so I'm adding it here in case anyone has a similar problem in future.

I found the solution in this stackoverflow post.

The default project generated by CubeMX was disabling Debug, so I simply had to set Debug to Serial Wire under the SYS tab in CubeMX. Then I set the jumper to pull BOOT0 high, uploaded the new project (with Debug enabled), moved the BOOT0 jumper back to low and now it works perfectly.

View solution in original post

3 REPLIES 3

Remove the two jumpers connecting the onboard target

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GCraf.1
Associate II

Sorry I forgot to mention that I have already removed those jumpers.

Is there anything else I could be missing?

GCraf.1
Associate II

I finally figured out what the problem was, so I'm adding it here in case anyone has a similar problem in future.

I found the solution in this stackoverflow post.

The default project generated by CubeMX was disabling Debug, so I simply had to set Debug to Serial Wire under the SYS tab in CubeMX. Then I set the jumper to pull BOOT0 high, uploaded the new project (with Debug enabled), moved the BOOT0 jumper back to low and now it works perfectly.