cancel
Showing results for 
Search instead for 
Did you mean: 

Why do I need ST-link for STM32CubeIDE when the Arduino editor doesn't seem to need it?

Nello
Associate II

I've just started with STM32s and have to say I'm finding the whole toolset incredibly confusing. I've managed to put together a first USB host project in STM32CubeIDE after doing a very simple one in the Arduino IDE very easily, but now I seem need to go and buy an ST-link?

I'm particularly unclear of the role of STM32CubeProgrammer. I'm using it on Mac and it connects to my STM32F411 "Black Pill' over USB just great. But that doesn't seem to be a very useful thing, as it doesn't connect to STM32CubeIDE and I still can't then use the IDE to do anything except compile. Even stranger is that STM32CubeProgrammer seems to be the way the Arduino IDE connects to my STM32 and that works great.

Any clues here would be very much appreciated.

(Also apologies if this is the wrong spot for such newbie questions, but the search functionality on these forums doesn't seem to change what I results I see no matter what I search on.)

1 ACCEPTED SOLUTION

Accepted Solutions
Nikita91
Lead II

AFAIK the arduino only allows to download the file through a bootloader in the target (USB downloader in your case). So the target own 2 applications: the bootloader and the application.

The STM32 has a native bootloader in the "system RAM" (USB bus, and also UART, CAN...), so STM32CubeProgrammer can download the application to the STM32 trough this native bootloader.

So the STM32CubeProgrammer do it's work: programming the target.

STM32CubeIDE is another thing. Its a development tool that allows debug. So it use a different interface: JTAG or SWD. The NUCLEO and Discovery boards from ST embeds a STLINK interface (with USB on the IDE side and SWD on the device side) to program and debug the application in the target.

So to fully use the IDE you need a kind of STLINK or SEGGER J-LINK to debug your application.

You can purchase a very low cost Chinese ST-LINK V2 (without the useful VCP link). Low cost but very limited.

You can buy a cheap NUCLEO 64 with the ST-LINK-V2-1, which have straps to use an external target (your Black Pill). An other advantage, it's providing the 3.3V power supply to the target.

It's what I use.

Don't buy a NUCLEO with STLINK-V3 for this purpose, it lacks the ability to drive an external device (Too bad ST abandoned a good idea...)

Buy a kind of STLINK V3/MODS/MINIE https://www.st.com/en/development-tools/stlink-v3minie.html

Beware: connectors are not 0.1", and does not provide 3.3V power supply (Not practical for a hobbyist).

You'd be glad you could buy one, there's a global shortage...

Even ST echop is out of stock!!!!

View solution in original post

7 REPLIES 7
Nikita91
Lead II

AFAIK the arduino only allows to download the file through a bootloader in the target (USB downloader in your case). So the target own 2 applications: the bootloader and the application.

The STM32 has a native bootloader in the "system RAM" (USB bus, and also UART, CAN...), so STM32CubeProgrammer can download the application to the STM32 trough this native bootloader.

So the STM32CubeProgrammer do it's work: programming the target.

STM32CubeIDE is another thing. Its a development tool that allows debug. So it use a different interface: JTAG or SWD. The NUCLEO and Discovery boards from ST embeds a STLINK interface (with USB on the IDE side and SWD on the device side) to program and debug the application in the target.

So to fully use the IDE you need a kind of STLINK or SEGGER J-LINK to debug your application.

You can purchase a very low cost Chinese ST-LINK V2 (without the useful VCP link). Low cost but very limited.

You can buy a cheap NUCLEO 64 with the ST-LINK-V2-1, which have straps to use an external target (your Black Pill). An other advantage, it's providing the 3.3V power supply to the target.

It's what I use.

Don't buy a NUCLEO with STLINK-V3 for this purpose, it lacks the ability to drive an external device (Too bad ST abandoned a good idea...)

Buy a kind of STLINK V3/MODS/MINIE https://www.st.com/en/development-tools/stlink-v3minie.html

Beware: connectors are not 0.1", and does not provide 3.3V power supply (Not practical for a hobbyist).

You'd be glad you could buy one, there's a global shortage...

Even ST echop is out of stock!!!!

KnarfB
Principal III

The STM32cubeIDE generates an .elf binary file which the STM32CubeProgrammer can download to your Black Pill. It is a valid question why downloading is not avail in STM32CubeIDE, but, as @Nikita91​ pointed out, the IDE workflow is compile, link, debug.

Note that there is a command line version of STM32CubeProgrammer and by using that, you can automate the download step in the IDE with a post-build step command like (for Windows):

"C:/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI.exe" -c port=usb1 -w ${ProjDirPath}/${ConfigName}/${BuildArtifactFileName}

hth

KnarfB

Arduino IDE has also the option to flash programs with an STLINK, no USB needed

Thanks for the detailed (and quick) answer. That was incredibly helpful! I've ordered an ST-LINK-V2 already, so hopefully that will do for what I need. Cheers!

Nice! Thanks so much for the quick and helpful answer.

Thanks. I'm using a Black Pill STM32F411 which comes with USB, so for me the difference is between plugging in a lead or buying an ST-LINK. Anyway, I've ordered the link 🙂

standalone STlinks are great, but most of the time as @Nikita91​ said you are good buying one of the cheap NUCLEO boards and rewiring the builtin stlink.