Nucleo-F303RE cannot connect via USB

Hi there,

I’m working on a project for uni and I would like to use PlatformIO for the project development, since it seems more practical than the Arduino IDE. However, I keep getting this error when trying to upload any file to my Nucleo F303RE.

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f303re.html
PLATFORM: ST STM32 (19.0.0) > ST Nucleo F303RE
HARDWARE: STM32F303RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink)
PACKAGES:
 - framework-arduinoststm32 @ 4.20900.0 (2.9.0)
 - framework-cmsis @ 2.50900.0 (5.9.0)
 - tool-dfuutil @ 1.11.0
 - tool-dfuutil-arduino @ 1.11.0
 - tool-openocd @ 3.1200.0 (12.0)
 - tool-stm32duino @ 1.0.2
 - toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 14 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio\build\nucleo_f303re\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   1.8% (used 1204 bytes from 65536 bytes)
Flash: [          ]   1.8% (used 9336 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
Uploading .pio\build\nucleo_f303re\firmware.elf
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Error: libusb_open() failed with LIBUSB_ERROR_NOT_FOUND
Error: open failed
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1

This is the whole upload log when I try to upload the project (after already compiling it).

I’ve read through some other topics and the errors others seem to have with other boards was that they’re improperly connected/missing a channel/etc. but the Nucleo should only need the one usb cable.

The Nucleo works fine with the Arduino IDE and I was able to upload to it many times, so I don’t understand why it gives a LIBUSB_ERROR_NOT_FOUND. I also tried setting the exact upload_port to com7, which is the usb port I use, but it didn’t change anything.

Does anyone have any insights? Cause I’m not experienced enough to fix this…

ETA: My platformio.ini is this:

[env:nucleo_f303re]
platform = ststm32
board = nucleo_f303re
framework = arduino

Do you have the Arduino IDE open in parallel, or any other program that could access the ST-Link? Close them if yes.

Did you install ST-Link drivers? https://www.st.com/en/development-tools/stsw-link009.html

The Arduino IDE might use a different upload program like stm32cubeprogrammer instead of OpenOCD, so it may expect a different drvier.

A classmate of mine helped me get everything set up. It indeed was that missing driver :slight_smile: