Skip to main content
Visitor II
September 12, 2020
Solved

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

  • September 12, 2020
  • 3 replies
  • 4355 views

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

    This topic has been closed for replies.
    Best answer by GCraf.1

    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.

    3 replies

    Graduate II
    September 13, 2020

    Remove the two jumpers connecting the onboard target

    GCraf.1Author
    Visitor II
    September 13, 2020

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

    Is there anything else I could be missing?

    GCraf.1AuthorAnswer
    Visitor II
    September 13, 2020

    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.