cancel
Showing results for 
Search instead for 
Did you mean: 

Using Multiple ST-Links on the command line interface

AEmer.2
Associate II

I am building an application which will program 4 STM32G030 mounted on built PCBs in a test rig but cannot work out how to use 4 ST-Links connected to a USB hub in my test rig to do this. I need to run the ST-Links in parallel, not sequentially, to save programming time. I need to use a command-line interface script to call from my application.

What I need to do is run a pre-test on the 4 boards. Then program the STM32 on each board in parallel which passed that first test, so if all 4 boards passed then I would program all 4 STM32s in parallel, so all at once. If boards #1 and #3 were to fail the first test then I would program boards #2 and #4 both at the same time. I need to use the command line interface to control this process.

I’ve read the manuals but it is unclear how I would do this. Does the command line interface support selective programming of multiple targets in parallel...., and how are the results passed back my process in the case of successful or unsuccessful programming?

Should I use St Link Utility or SMT32CubeProgrammer?

Thanks!

5 REPLIES 5

Hi @AEmer.2​ 

Yes, you can do that.Also, you have to add the serial number of each board.

Try to use this command :

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd sn=066DFF525149787867194916 -c port=swd sn=066CFF485649785087054321

Best regards,

Nesrine

Hi Nesrine, Ok thanks .... I am waiting for 2 ST_Links to experiment with so I will try that.

In the meantime, a few more questions ....

Where on the command line is the file to be programmed specified? And the commands to program/verify? And speed etc? Can you show me a complete command line example please?

How do I receive the programming result (success or not)

Does this happen in parallel (all ST-Links programming at once, not sequentially)

Will this work also with ST-Link V3?

Thanks!

Pretty sure you'll need to start multiple instances of the application, in parallel, each pointing at specific device, file name typically at the latter end of the command line. Status returned as an exit code, as I recall.

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

Yes, it seems that the CLI can only connect one at a time, the commands after the -c connect are actioned on that serial number only, so if you connect 2 like Nesrine suggested only the last connected one responds. So if I do :-

STM32_Programmer_CLI.exe -c port=swd sn=210F090029135147324D4E00 -w C:\Users\Andy\temp\test.hex -rst -c port=swd sn=2518080029135147324D4E00 -w C:\Users\Andy\temp\test.hex -rst

It programs and resets each device in sequence, not at the same time which is what I need.

Any ideas about how to do all devices at the same time in the same command box, i.e. on the same command line? I can't open multiple instances in my application...

Thanks!

AEmer.2
Associate II

Andi if I try connecting both first and then running just one command, they run sequentially again, i.e. :-

STM32_Programmer_CLI.exe -c port=swd sn=210F090029135147324D4E00 -c port=swd sn=2518080029135147324D4E00 -w C:\Users\Andy\temp\test.hex -rst