Unable to upload to STM32 discovery board (on Mac OS and new to PlatformIO)

Hi, I’m new to PlatformIO and working with STM32 but I have previous experience working with the Arduino boards/IDE and PIC microcontrollers. Compared to PIC and Arduino, getting my head around STM32 has been a real uphill battle for me and I would really be grateful if anyone could help me out.

So I’m on a Mac and I’ve managed to install VS Code and PlatformIO. I was able to successfully build a LED blink project.The problem arises when I try to upload it to my Discovery board (disco_f429zi). Seems like my setup is unable to detect my board. I can’t see anything related to the STM32 discovery board under “Devices” and I am getting this error message in the terminal:

Error: init mode failed (unable to connect to the target)

This is my platformio.ini file:

[env:disco_f429zi]
platform = ststm32
board = disco_f429zi
framework = stm32cube
upload_protocol = stlink
debug_tool = stlink

Would really appreciate it if someone could let me know what I am missing or how I can verify if my Mac can connect/find my discovery board. Thanks in advance!

On macos you can use the following command in the terminal to list connected devices:

ls /dev/{tty,cu}.*

This will show connections via usb and bluetooth, if its connected via USB then it should show something like /dev/cu.usbmodem1245…

When you remove that will it try to use the CMSIS-DAP or mbed protocol to upload the binary? Does that succeed?