Hello everyone, I recently started working on a nucleo F091rc. My problem is that at the moment I cannot flash it using a st-link v2 with platformio on VSCode.
From the command line, platformio does not list the device (platformio device list). Instead with (st-info --probe) I get some informations:
Found 1 stlink programmers
version: V2J40S7
serial: 53FF6A068389505228432467
flash: 262144 (pagesize: 2048)
sram: 32768
chipid: 0x0442
descr: F09X
I am using a Mac m1 with MacOS Ventura. This is the list I get from the dependencies section:
Resolving nucleo_f091rc dependencies…
Platform ststm32 @ 15.4.1 (required: ststm32)
├── framework-arduinoststm32 @ 4.20200.221104 (required: platformio/framework-arduinoststm32 @ ~4.20200.0)
├── framework-cmsis @ 2.50700.210515 (required: platformio/framework-cmsis @ ~2.50700.0)
├── framework-cmsis-stm32f0 @ 2.3.4 (required: platformio/framework-cmsis-stm32f0 @ ~2.3.4)
├── framework-stm32cubef0 @ 1.11.3 (required: platformio/framework-stm32cubef0 @ ~1.11.0)
├── framework-stm32cubef1 @ 1.8.4 (required: platformio/framework-stm32cubef1 @ ~1.8.0)
├── framework-stm32cubef2 @ 1.9.3 (required: platformio/framework-stm32cubef2 @ ~1.9.0)
├── framework-stm32cubef4 @ 1.26.2 (required: platformio/framework-stm32cubef4 @ ~1.26.0)
├── tool-dfuutil @ 1.11.0 (required: platformio/tool-dfuutil @ ~1.11.0)
├── tool-ldscripts-ststm32 @ 0.2.0 (required: platformio/tool-ldscripts-ststm32 @ ~0.2.0)
├── tool-openocd @ 2.1100.211028 (required: platformio/tool-openocd @ ~2.1100.0)
├── tool-stm32duino @ 1.0.1 (required: platformio/tool-stm32duino @ ~1.0.1)
└── toolchain-gccarmnoneeabi @ 1.90201.191206 (required: platformio/toolchain-gccarmnoneeabi @ ~1.90201.0)Libraries
└── STM32duino FreeRTOS @ 10.3.1 (required: stm32duino/STM32duino FreeRTOS @ ^10.3.1)
The following is the error that I get from flashing the device. When flashing the light on the st-link blinks yellow and red.
Executing task: platformio run --verbose --target upload --environment nucleo_f091rc
Processing nucleo_f091rc (upload_speed: 9600; board: nucleo_f091rc; lib_deps: stm32duino/STM32duino FreeRTOS@^10.3.1; upload_protocol: stlink; debug_tool: stlink; platform: ststm32; framework: arduino; monitor_speed: 115200; upload_flags: -c, reset_config none separate)
CONFIGURATION: Redirecting...
PLATFORM: ST STM32 (15.4.1) > ST Nucleo F091RC
HARDWARE: STM32F091RCT6 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink)
PACKAGES:
- framework-arduinoststm32 @ 4.20200.221104 (2.2.0)
- framework-cmsis @ 2.50700.210515 (5.7.0)
- tool-dfuutil @ 1.11.0
- tool-openocd @ 2.1100.211028 (11.0)
- tool-stm32duino @ 1.0.1
- toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 13 compatible libraries
Scanning dependencies…
Dependency Graph
|-- STM32duino FreeRTOS @ 10.3.1 (License: Unknown, Path: /Users/beppemarinelli/Documents/PlatformIO/Projects/Freerduino_try1/.pio/libdeps/nucleo_f091rc/STM32duino FreeRTOS)
Building in release mode
MethodWrapper([“checkprogsize”], [“.pio/build/nucleo_f091rc/firmware.elf”])
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [ ] 4.2% (used 1376 bytes from 32768 bytes)
Flash: [= ] 7.8% (used 20500 bytes from 262144 bytes)
.pio/build/nucleo_f091rc/firmware.elf :
section size addr
.isr_vector 188 134217728
.text 18180 134217920
.rodata 2176 134236100
.ARM.extab 0 134238276
.ARM 0 134238276
.preinit_array 0 134238276
.init_array 16 134238276
.fini_array 8 134238292
.data 144 536870912
.bss 1232 536871056
.noinit 0 536872288
._user_heap_stack 1536 536872288
.ARM.attributes 40 0
.comment 102 0
.debug_frame 1076 0
Total 24698
([“upload”], [“.pio/build/nucleo_f091rc/firmware.elf”])
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
openocd -c “reset_config none separate” -d2 -s /Users/beppemarinelli/.platformio/packages/tool-openocd/scripts -f board/st_nucleo_f0.cfg -c “program {.pio/build/nucleo_f091rc/firmware.elf} verify reset; shutdown;”
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-17-00:18)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
debug_level: 2none separate
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srstInfo : clock speed 1000 kHz
Info : STLINK V2J40S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.229062
Info : stm32f0x.cpu: Cortex-M0 r0p0 processor detected
Info : stm32f0x.cpu: target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for stm32f0x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Error: timed out while waiting for target halted
embedded:startup.tcl:1070: Error: ** Unable to reset target **
in procedure ‘program’
in procedure ‘program_error’ called at file “embedded:startup.tcl”, line 1107
at file “embedded:startup.tcl”, line 1070
*** [upload] Error 1
This is my platformio.ini:
[env]
platform = ststm32
framework = arduino[env:nucleo_f091rc]
board = nucleo_f091rc
lib_deps = stm32duino/STM32duino FreeRTOS@^10.3.1
upload_protocol = stlink
debug_tool = stlink
I am really stuck and everything I try doesn’t seem to get me anywhere. Any help is really appreciated!