cancel
Showing results for 
Search instead for 
Did you mean: 

macOS USB hub st-link serial addresses not showing up

oihqw3bei
Associate

I am running macOS Sonoma and using PlatformIO within Visual Studio Code.

I have multiple STM32 microcontrollers connected via ST-LINKs to a USB hub¹. My ST-LINK USB devices are correctly listed in 1) the USB Device Tree within the macOS System Information, and 2) via Terminal when using `st-info --probe`.

I am also able to utilise these ST-LINKs to upload code to a single microcontroller individually. Even when all are connected I am able to upload code to one of these microcontrollers.

However, this happens semi-randomly. I cannot specify to which of these connected microcontrollers my code is being uploaded.

I am aware that I need a serial device address to define `upload_port` in my platformio.ini file. To find this address I am using `ls -l /dev/cu.*` in the Terminal. But the only port being returned is `/dev/cu.Bluetooth-Incoming-Port`.

Why isn’t `ls -l /dev/cu.*` showing the serial addresses of my connected ST-LINK devices? After several days of troubleshooting without any success, I would be very grateful for any insights or suggestions that could help resolve this issue!

1= Anker 4-Port Ultra-Slim USB 3.0 Hub

1 ACCEPTED SOLUTION

Accepted Solutions
oihqw3bei
Associate

Now without using port serials, and also thanks to the gethla tool on GitHub by a-v-s and rewriting that script to have it fully functional on macOS, I realised a different and way more simpler method:

1. Use the shell command st-info --probe to list all connected stlink programmers. When having 3 devices connected you'll see an output like the following:

Found 3 STLINK programmers
1.
version: V2J37S7
serial: 420062000E0000543233574E
flash: 524288 (pagesize: 16384)
sram: 131072
chipid: 0x0431
descr: stm32f411re
2.
version: V2J43S7
serial: 39005700180000344159544E
flash: 524288 (pagesize: 16384)
sram: 131072
chipid: 0x0431
descr: stm32f411re
3.
version: V2J43S7
serial: 18002300020000304131574E
flash: 524288 (pagesize: 16384)
sram: 131072
chipid: 0x0431
descr: stm32f411re

 

2. Then, integrate the device's serial number into your `platformio.ini` file using the following line:

upload_flags = -c adapter serial <serial>

 

3. And this made it work for me! 🥳

View solution in original post

2 REPLIES 2
Pavel A.
Evangelist III

ST-LINKs are not serial ports (though some of them contain an extra VCP function), so  "cu" devices are not what you specify for tools as ST-LINK devices.

 

oihqw3bei
Associate

Now without using port serials, and also thanks to the gethla tool on GitHub by a-v-s and rewriting that script to have it fully functional on macOS, I realised a different and way more simpler method:

1. Use the shell command st-info --probe to list all connected stlink programmers. When having 3 devices connected you'll see an output like the following:

Found 3 STLINK programmers
1.
version: V2J37S7
serial: 420062000E0000543233574E
flash: 524288 (pagesize: 16384)
sram: 131072
chipid: 0x0431
descr: stm32f411re
2.
version: V2J43S7
serial: 39005700180000344159544E
flash: 524288 (pagesize: 16384)
sram: 131072
chipid: 0x0431
descr: stm32f411re
3.
version: V2J43S7
serial: 18002300020000304131574E
flash: 524288 (pagesize: 16384)
sram: 131072
chipid: 0x0431
descr: stm32f411re

 

2. Then, integrate the device's serial number into your `platformio.ini` file using the following line:

upload_flags = -c adapter serial <serial>

 

3. And this made it work for me! 🥳